Skip to content

image_supervised

_image_to_array

Read the image from the path and return it as an numpy.ndarray. Load the image file as an array

Args
  • img_path: a string whose value is the image file name

read_images

Read the images from the path and return their numpy.ndarray instances.

Args
  • img_file_names: List of strings representing image file names. # DEVELOPERS THERE'S PROBABLY A WAY TO MAKE THIS PARAM. OPTIONAL

  • images_dir_path: Path to the directory containing images.

  • parallel: (Default

Returns
  • x_train: a list of numpy.ndarrays containing the loaded images.

load_image_dataset

Load images from their files and load their labels from a csv file. Assumes the dataset is a set of images and the labels are in a CSV file. The CSV file should contain two columns whose names are 'File Name' and 'Label'. The file names in the first column should match the file names of the images with extensions, e.g., .jpg, .png. The path to the CSV file should be passed through the csv_file_path. The path to the directory containing all the images should be passed through image_path.

Args
  • csv_file_path: a string of the path to the CSV file

  • images_path: a string of the path containing the directory of the images

  • parallel: (Default

Returns
  • x: Four dimensional numpy.ndarray. The channel dimension is the last dimension.

  • y: a numpy.ndarray of the labels for the images

ImageSupervised

Abstract image supervised class. Inherits from DeepTaskSupervised.

Attributes
  • path: A string of the path to the directory to save the classifier as well as intermediate results.

  • cnn: CNN module from net_module.py.

  • y_encoder: Label encoder, used in transform_y or inverse_transform_y for encode the label. For example, if one hot encoder needed, y_encoder can be OneHotEncoder.

  • data_transformer: A transformer class to process the data. See example as ImageDataTransformer.

  • verbose: A boolean value indicating the verbosity mode which determines whether the search process will be printed to stdout.

  • augment: A boolean value indicating whether the data needs augmentation. If not define, then it will use the value of Constant.DATA_AUGMENTATION which is True by default.

  • searcher_args: A dictionary containing the parameters for the searcher's init function.

  • resize_shape: resize image height and width

init

Initialize the instance of the ImageSupervised class. The classifier will be loaded from the files in 'path' if parameter 'resume' is True. Otherwise it would create a new one.

Args
  • augment: A boolean value indicating whether the data needs augmentation. If not defined, then it will use the value of Constant.DATA_AUGMENTATION which is True by default.

  • **kwargs: Needed for using the init() function of ImageSupervised's superclass verbose

fit

Find the best neural architecture for classifying the training data and train it. Based on the given dataset, the function will find the best neural architecture for it. The dataset must be in numpy.ndarray format. The training and validation data should be passed through x, y. This method will automatically split the training and validation data into training and validation sets.

Args
  • x: A numpy.ndarray instance containing the training data or the training data combined with the validation data.

  • y: A numpy.ndarray instance containing the labels of the training data. or the label of the training data combined with the validation label.

  • time_limit: The time limit for the search in seconds. (optional, default = None, which turns into 24 hours in method)

  • cts:

ImageClassifier

ImageClassifier class. Inherits from ImageSupervised It is used for image classification. It searches convolutional neural network architectures for the best configuration for the image dataset.

Attributes
  • path: A string of the path to the directory to save the classifier as well as intermediate results.

  • cnn: CNN module from net_module.py.

  • y_encoder: Label encoder, used in transform_y or inverse_transform_y for encode the label. For example, if one hot encoder needed, y_encoder can be OneHotEncoder.

  • data_transformer: A transformer class to process the data. See example as ImageDataTransformer.

  • verbose: A boolean value indicating the verbosity mode which determines whether the search process will be printed to stdout.

  • augment: A boolean value indicating whether the data needs augmentation. If not define, then it will use the value of Constant.DATA_AUGMENTATION which is True by default.

  • searcher_args: A dictionary containing the parameters for the searcher's init function.

  • resize_shape: resize image height and width

transform_y

Transform the parameter y_train using the variable self.y_encoder

Args
  • y: list of labels to convert

inverse_transform_y

Convert the encoded labels back to the original label space.

Args
  • output: list of labels to decode

export_autokeras_model

Creates and Exports the AutoKeras model to the given filename.

Args
  • model_file_name: A string containing the name of the file to which the model should be saved

  • cts:

ImageClassifier1D

ImageClassifier1D class. It is used for 1D image classification. It searches convolutional neural network architectures for the best configuration for the 1D image dataset.

ImageClassifier3D

ImageClassifier3D class. It is used for 3D image classification. It searches convolutional neural network architectures for the best configuration for the 1D image dataset.

ImageRegressor

ImageRegressor class. It is used for image regression. It searches convolutional neural network architectures for the best configuration for the image dataset.

export_autokeras_model

Creates and Exports the AutoKeras model to the given filename.

ImageRegressor1D

ImageRegressor1D class. It is used for 1D image regression. It searches convolutional neural network architectures for the best configuration for the 1D image dataset.

ImageRegressor3D

ImageRegressor3D class. It is used for 3D image regression. It searches convolutional neural network architectures for the best configuration for the 1D image dataset.

PortableImageSupervised

init

Initialize the instance.

Args
  • graph: The graph form of the learned model