deepblink.io module¶
Dataset preparation functions.
-
deepblink.io.
basename
(path: Union[str, os.PathLike[str]]) → str[source]¶ Returns the basename removing path and extension.
-
deepblink.io.
grab_files
(path: Union[str, os.PathLike[str]], extensions: Tuple[str, ...]) → List[str][source]¶ Grab all files in directory with listed extensions.
Parameters: - path – Path to files to be grabbed. Without trailing “/”.
- extensions – List of all file extensions. Without leading “.”.
Returns: Sorted list of all corresponding files.
Raises: OSError
– Path not existing.
-
deepblink.io.
load_image
(fname: Union[str, os.PathLike[str]], extensions: Tuple[str, ...] = ('tif', 'tiff', 'jpeg', 'jpg', 'png'), is_rgb: bool = False) → numpy.ndarray[source]¶ Import a single image as numpy array checking format requirements.
Parameters: - fname – Absolute or relative filepath of image.
- extensions – Allowed image extensions.
- is_rgb – If true, converts RGB images to grayscale.
-
deepblink.io.
load_model
(fname: Union[str, os.PathLike[str]]) → keras.engine.training.Model[source]¶ Import a deepBlink model from file.
-
deepblink.io.
load_npz
(fname: Union[str, os.PathLike[str]], test_only: bool = False) → List[numpy.ndarray][source]¶ Imports the standard npz file format used for custom training and inference.
Only for files saved using “np.savez_compressed(fname, x_train, y_train…)”.
Parameters: - fname – Path to npz file.
- test_only – Only return testing images and labels.
Returns: A list of the required numpy arrays. If no “test_only” arguments were passed, returns [x_train, y_train, x_valid, y_valid, x_test, y_test].
Raises: ValueError
– If not all datasets are found.