Skip to content

AutoNN.CNN.cnn_generator.CreateCNN

class CreateCNN(_size:int=10):

Parameters:

  • _size : int | default = 10| Maximum number of CNN models to be generated

Methods:

create_config() :

This function will create configuration based on which CNN models will be generated.

Parameters:

min : int | minimum number of layers the gnerated CNN model can have

max : int | maximum number of layers the gnerated CNN model can have

Example
>>> print(CreateCNN.create_config(3,10))
>>> [('conv', 64, 64),
    ('pool', 1, 64),
    ('conv', 256, 512),
    ('conv', 64, 128),
    ('conv', 64, 64),
    ('pool', 0, 64)]

This function will print all the CNN architectures in PyTorch Format

Parameters: None

This function will print all the CNN architectures generated

Parameters: None

get_bestCNN()

Parameters:

path_trainset : str | path to the image training set

path_testset : str | Optional[str] | path to the image test set

split_required : bool | default = False | set to true if only there is no test set

batch_size : int | default = 16 | Batch size

lossFn : str | default = cross-entropy | Most multiclass image classification problems use CrossEntropyLoss

Info

Only Cross Entropy Loss has been implemented. Since most image classification tasks uses cross entropy loss as the preferred loss function.

LR : float | default = 3e4 | Learning Rate

EPOCHS : int | default = 10 | number Epochs

image_shape : Tuple[int,int] | default = (28,28) | dimension of the input image from the training dataset

Returns :

Returns a tuple containing the best CNN model generated, its configuration, and history of all models generated

( best_CNN_model, best_model_config, history_of_all_models)