src.classification.plant package¶
Submodules¶
src.classification.plant.dense_classifier module¶
This file implements a Fully Connected classifier for the plant data.
- class src.classification.plant.dense_classifier.PlantDenseClassifier(parameters: Optional[Dict] = None)¶
Bases:
PlantNNBaseClassifier
Classifier consisting of Dense layers only.
- initialize_model(parameters: Dict) None ¶
Initializes a new and pretrained version of the Plant-Dense model
- Parameters:
parameters – Parameters for initializing the model.
src.classification.plant.lstm_classifier module¶
This file implements an LSTM based classifier for the plant data.
- class src.classification.plant.lstm_classifier.PlantLSTMClassifier(parameters: Optional[Dict] = None)¶
Bases:
PlantNNBaseClassifier
Classifier that uses LSTM layers and a Dense head for classification.
- initialize_model(parameters: Dict) None ¶
Initializes a new and pretrained version of the Plant-LSTM model
- Parameters:
parameters – Parameters for initializing the model.
src.classification.plant.mfcc_cnn_classifier module¶
This file implements a CNN classifier for the MFCC features derived from the plant data.
- class src.classification.plant.mfcc_cnn_classifier.PlantMFCCCNNClassifier(parameters: Optional[Dict] = None)¶
Bases:
PlantNNBaseClassifier
Model that uses MFCC features and Conv layers for classification.
- static init_parameters(parameters: Optional[Dict] = None, **kwargs) Dict ¶
Function that merges the parameters and kwargs
- Parameters:
parameters – Parameter dictionary
kwargs – Additional parameters in kwargs
- Returns:
Combined dictionary with parameters
- initialize_model(parameters: Dict) None ¶
Initializes a new and pretrained version of the Plant-MFCC-CNN model
- Parameters:
parameters – Parameters for initializing the model
src.classification.plant.mfcc_resnet_classifier module¶
This file implements a Resnet classifier for the MFCC features derived from the plant data.
- class src.classification.plant.mfcc_resnet_classifier.PlantMFCCResnetClassifier(parameters: Optional[Dict] = None)¶
Bases:
PlantNNBaseClassifier
Model that uses MFCC features and a resnet50 classifier.
- static init_parameters(parameters: Optional[Dict] = None, **kwargs) Dict ¶
Function that merges the parameters and kwargs
- Parameters:
parameters – Parameter dictionary
kwargs – Additional parameters in kwargs
- Returns:
Combined dictionary with parameters
- initialize_model(parameters: Dict) None ¶
Initializes a new and pretrained version of the Plant-MFCC-Resnet model
- Parameters:
parameters – Parameters for initializing the model
src.classification.plant.nn_classifier module¶
This file defines an interface for classifiers for the plant data.
- class src.classification.plant.nn_classifier.PlantNNBaseClassifier(name: str, parameters: Optional[Dict] = None)¶
Bases:
PlantEmotionClassifier
Base class for all NN classifiers in tensorflow for plant data.
- classify(parameters: Optional[Dict] = None, **kwargs) array ¶
Classification method used to classify emotions from plant data
- Parameters:
parameters – Parameter dictionary used for classification
kwargs – Additional kwargs parameters
- Returns:
An array with predicted emotion indices
- abstract initialize_model(parameters: Dict) None ¶
Abstract method that creates self.model, a tf Model instance
- Parameters:
parameters – Parameters for initializing the model
- load(parameters: Optional[Dict] = None, **kwargs) None ¶
Loading method that loads a previously trained model from disk.
- Parameters:
parameters – Parameters required for loading the model
kwargs – Additional kwargs parameters
- save(parameters: Optional[Dict] = None, **kwargs) None ¶
Saving method that saves a previously trained model on disk.
- Parameters:
parameters – Parameters required for storing the model
kwargs – Additional kwargs parameters
- train(parameters: Optional[Dict] = None, **kwargs) None ¶
Training method for plant models
- Parameters:
parameters – Parameter dictionary used for training
kwargs – Additional kwargs parameters
src.classification.plant.plant_emotion_classifier module¶
Base class for all plant emotion classifiers
- class src.classification.plant.plant_emotion_classifier.PlantEmotionClassifier(name: str = 'plant', parameters: Optional[Dict] = None)¶
Bases:
EmotionClassifier
Base class for all plant emotion classifiers. Contains common functions that concerns all plant classifiers.
- abstract classify(parameters: Optional[Dict] = None, **kwargs) array ¶
The virtual classification method for interfacing
- Parameters:
parameters – Parameter dictionary used for classification
kwargs – Additional kwargs parameters
- Returns:
An array with predicted emotion indices
- static compute_mfccs(audio_tensor: Tensor, parameters: Optional[Dict] = None) Tensor ¶
Function that computes MFCC features from the input tensor.
- Parameters:
audio_tensor – The tensor containing raw time series data.
parameters – Parameters for the MFCC computation.
- Returns:
Tensor with MFCC features.
- abstract load(parameters: Optional[Dict] = None, **kwargs) None ¶
Loading method that loads a previously trained model from disk.
- Parameters:
parameters – Parameters required for loading the model
kwargs – Additional kwargs parameters
- prepare_data(parameters: Dict) None ¶
Function that prepares speech datasets for training and stores them inside the class.
- Parameters:
parameters – Parameter dictionary that contains important params. including: which_set, batch_size, weighted
- prepare_training(parameters: Dict) None ¶
Function that prepares the training by initializing optimizer, loss, metrics and callbacks for training.
- Parameters:
parameters – Training parameters
- abstract save(parameters: Optional[Dict] = None, **kwargs) None ¶
Saving method that saves a previously trained model on disk.
- Parameters:
parameters – Parameters required for storing the model
kwargs – Additional kwargs parameters
- abstract train(parameters: Optional[Dict] = None, **kwargs) None ¶
Virtual training method for interfacing
- Parameters:
parameters – Parameter dictionary used for training
kwargs – Additional kwargs parameters
Module contents¶
Package for plant sensor emotion classifiers