focal package¶
Fiber Cleave Processing Package
A machine learning package for fiber cleave quality classification and tension prediction using CNN and MLP models.
- class focal.BuildHyperModel(image_shape: Tuple[int, int, int], param_shape: Tuple[int, ...], backbone: str | None = 'mobilenet')[source]¶
Bases:
HyperModelHyperModel for determining optimal hyperparameters for the combined CNN+MLP model.
This class builds a model architecture that combines image features from MobileNetV2 with numerical parameters for fiber cleave classification.
- class focal.BuildMLPHyperModel(model_path: str)[source]¶
Bases:
HyperModelHyperModel for MLP-based tension prediction.
This class builds a model that uses features extracted from a pre- trained CNN to predict optimal tension values.
- class focal.BuildMLPModel(cnn_model_path: str, train_ds: Any, test_ds: Any, num_classes: int)[source]¶
Bases:
CustomModelMLP model for tension prediction using features from pre-trained CNN.
This class builds regression models that use features extracted from a CNN to predict optimal tension values for fiber cleaving.
- compile_model(dense1: int, dense2: int, dropout1: float, dropout2: float, dropout3: float, param_shape: Tuple[int, ...], learning_rate: float = 0.001, metrics: List[str] | None = None) Model[source]¶
Compile MLP model for regression.
- Parameters:
dense1 – Number of neurons in first FC layer.
dense2 – Number of neurons in second FC layer.
dropout1 – Amount of dropout for CNN output
dropout2 – Amount of dropout for feature input.
dropout3 – Amount of dropout for concatenated image+features
param_shape – Dimensions of numerical parameters
learning_rate – Learning rate for optimization
metrics – List of metrics to monitor
- Returns:
Compiled regression model
- Return type:
tf.keras.Model
- create_checkpoints(checkpoint_filepath: str = './checkpoints/mlp_model.keras', monitor: str = 'val_mae', mode: str = 'min', save_best_only: bool = True) ModelCheckpoint[source]¶
Create model checkpoints for MLP model.
- Parameters:
checkpoint_filepath – Path to save model checkpoints
monitor – Metric to monitor during training
mode – Method to determine stopping point (min for regression)
save_best_only – Whether to save only the best model
- Returns:
Checkpoint callback
- Return type:
tf.keras.callbacks.ModelCheckpoint
- create_early_stopping(patience: int = 3, mode: str = 'min', monitor: str = 'val_mae') EarlyStopping[source]¶
Create early stopping callback for regression model.
- Parameters:
patience – Number of epochs to wait before stopping
mode – Method to track monitor (min for regression)
monitor – Metric to monitor during training
- Returns:
Early stopping callback
- Return type:
tf.keras.callbacks.EarlyStopping
- static get_averages_from_kfold(kfold_histories: List[History], scaler: any) None[source]¶
Calculate and display average metrics from k-fold cross validation for MLP.
- Parameters:
kfold_histories – List of training histories from k-fold training
scaler – Scaler used for tension values (for denormalization)
- static train_kfold_mlp(datasets: List[Tuple], cnn_model_path: str, param_shape: Tuple[int, ...], learning_rate: float, num_classes: int, dense1: int, dense2: int, dropout1: float, dropout2: float, dropout3: float, checkpoints: ModelCheckpoint | None = None, epochs: int = 5, initial_epoch: int = 0, early_stopping: EarlyStopping | None = None, history_file: str | None = None, save_model_file: str | None = None) Tuple[List[Model], List[History]][source]¶
Train MLP model using k-fold cross validation.
- Parameters:
datasets – List of (train_ds, test_ds) tuples for each fold
cnn_model_path – Path to the pre-trained CNN model
param_shape – Dimensions of numerical parameters
learning_rate – Learning rate for optimization
checkpoints – Checkpoint callback
epochs – Number of training epochs
initial_epoch – Starting epoch number
early_stopping – Early stopping callback
history_file – Base filename for saving training history
model_file – Base filename for saving models
- Returns:
Tuple of (list of trained models, list of training histories)
- class focal.CustomModel(train_ds: DatasetV2, test_ds: DatasetV2, num_classes: int, classification_type: str | None = 'binary')[source]¶
Bases:
objectClass for defining custom models using pre-trained MobileNetV2.
This class provides functionality for building, compiling, and training CNN models for fiber cleave classification.
- compile_custom_model(image_shape: Tuple[int, int, int], learning_rate: float = 0.001, metrics: List[str] | None = None, num_classes: int | None = 5) Model[source]¶
Compile custom model after calling build_custom_model function.
- Parameters:
image_shape – Dimensions of input images
param_shape – Dimensions of numerical parameters
learning_rate – Learning rate for optimization
metrics – List of metrics to monitor
num_class – number of output classes
- Returns:
Compiled model ready for training
- Return type:
tf.keras.Model
- compile_image_only_model(image_shape: Tuple[int, int, int], learning_rate: float = 0.001, metrics: List[str] | None = None, backbone: str | None = 'mobilenet', num_classes: int = 5, dropout1: float | None = 0.1, dense1: int | None = 32, dropout2: float | None = 0.2, l2_factor: float | None = None, unfreeze_from: int | None = None) Model[source]¶
Compile an image-only model.
- Parameters:
image_shape – Dimensions of input images
learning_rate – Learning rate for optimization
metrics – List of metrics to monitor
- Returns:
Compiled image-only model
- Return type:
tf.keras.Model
- compile_model(image_shape: Tuple[int, int, int], param_shape: Tuple[int, ...], dropout1: float, dense1: int, dropout2: float, dense2: int, dropout3: float, brightness: float, height: float, width: float, contrast: float, rotation: float, learning_rate: float = 0.001, metrics: List[str] | None = None, unfreeze_from: int | None = None, backbone: str | None = 'mobilenet') Model[source]¶
Compile the custom model head on top of pre-trained backbone.
- Parameters:
image_shape (Tuple[int, int, int]) – Shape of each image.
param_shape (Tuple[int, ...]) – Shape of feature vector.
dropout1 (float) – Amount of dropout for image layer.
dense1 (int) – Amount of neurons for first FC layer.
dropout2 (float) – Amount of dropout for feature input.
dense2 (int) – Amount of neruons for second FC layer.
dropout3 (float) – Amount of dropout for concatenated images+features.
brightness (float) – Brightness amount for image.
height (float) – Height of augmented image.
width (float) – Width of augmented image.
contrast (float) – Contrast amount of augmented image.
rotation (float) – Rotation amount of augmented image.
learning_rate (float, optional) – Size of steps to take during optimization. Defaults to 0.001.
metrics (Optional[List[str]], optional) – Saved metrics. Defaults to None.
unfreeze_from (Optional[int], optional) – Layer to start training pre-trained backbone. Defaults to None.
backbone (Optional[str], optional) – Name of pre-trained backbone. Defaults to “mobilenet”.
- Returns:
Compiled custom head on pre-trained model backbone.
- Return type:
Model
- create_checkpoints(checkpoint_filepath: str = './checkpoints/model.keras', monitor: str = 'val_accuracy', mode: str = 'max', save_best_only: bool = True) ModelCheckpoint[source]¶
Create model checkpoints to avoid losing data while training.
- Parameters:
checkpoint_filepath – Path to save model checkpoints
monitor – Metric to monitor during training
mode – Method to determine stopping point of metric (max, min, auto)
save_best_only – Whether to save only the best model
- Returns:
Checkpoint callback
- Return type:
tf.keras.callbacks.ModelCheckpoint
- create_early_stopping(patience: int = 3, mode: str = 'max', monitor: str = 'val_accuracy') EarlyStopping[source]¶
Create early stopping callback to monitor training success and prevent overfitting.
- Parameters:
patience – Number of epochs to wait before stopping when monitor plateaus
mode – Method to track monitor (max, min, auto)
monitor – Metric to monitor during training
- Returns:
Early stopping callback
- Return type:
tf.keras.callbacks.EarlyStopping
- create_tensorboard_callback(log_dir: str = './logs', histogram_freq: int = 1) TensorBoard[source]¶
Create TensorBoard callback for monitoring training.
- Parameters:
log_dir – Directory for TensorBoard logs
histogram_freq – Frequency for computing weight histograms
- Returns:
TensorBoard callback
- Return type:
tf.keras.callbacks.TensorBoard
- static get_averages_from_kfold(kfold_histories: List[History]) None[source]¶
Calculate and display average metrics from k-fold cross validation.
- Parameters:
kfold_histories – List of training histories from k-fold training
- get_data_augmentation(rotation: float, brightness: float, height: float, width: float, contrast: float)[source]¶
Get data augmentation parameters for training model.
- Parameters:
rotation (float) – Rotation amount of image.
brightness (float) – Brightness amount of image.
height (float) – Height of image.
width (float) – Widht of image.
contrast (float) – Contrast amount of image.
- Returns:
Data augmentation model.
- Return type:
tf.keras.models.Model
- plot_metric(title: str, metric_1: List[float], metric_2: List[float], metric_1_label: str, metric_2_label: str, x_label: str, y_label: str, model_path: str) None[source]¶
Plot training metrics for visualization.
- Parameters:
title – Title for the plot
metric_1 – First metric values to plot
metric_2 – Second metric values to plot
metric_1_label – Label for first metric
metric_2_label – Label for second metric
x_label – Label for x-axis
y_label – Label for y-axis
- reduce_on_plateau(patience: int = 3, mode: str = 'auto', factor: float = 2.0, monitor: str = 'val_accuracy') ReduceLROnPlateau[source]¶
Create reduced learning rate callback if monitored value stops improving.
- Parameters:
patience – Number of epochs before reducing learning rate
mode – Method to monitor (min, max, auto)
factor – Factor by which to reduce learning rate
monitor – Value to monitor before reducing learning rate
- Returns:
Reduce learning rate callback
- Return type:
tf.keras.callbacks.ReduceLROnPlateau
- static train_kfold(datasets: List[Tuple], image_shape: Tuple[int, int, int], param_shape: Tuple[int, ...], learning_rate: float, num_classes: int, dropout1: float, dense1: int, dropout2: float, dense2: int, dropout3: float, brightness: float, height: float, width: float, contrast: float, rotation: float, metrics: List[str] | None = None, epochs: int = 5, initial_epoch: int = 0, history_file: str | None = None, save_model_file: str | None = None, callbacks: List | None = None) Tuple[List[Model], List[History]][source]¶
Train model using k-fold cross validation.
- Parameters:
datasets – List of (train_ds, test_ds) tuples for each fold
image_shape – Dimensions of input images
param_shape – Dimensions of numerical parameters
learning_rate – Learning rate for optimization
metrics – List of metrics to monitor
epochs – Number of training epochs
initial_epoch – Starting epoch number
history_file – Base filename for saving training history
model_file – Base filename for saving models
- Returns:
Tuple of (list of trained models, list of training histories)
- train_model(class_weights, model: Model, epochs: int = 5, initial_epoch: int = 0, callbacks: List | None = None, history_file: str | None = None, save_model_file: str | None = None) History[source]¶
Train model with possible callbacks to prevent overfitting.
- Parameters:
model – Model to be trained
checkpoints – Checkpoints to save model
epochs – Number of training epochs
initial_epoch – Starting epoch number
early_stopping – Early stopping callback
reduce_lr – Reduce learning rate callback
tensorboard – TensorBoard callback
history_file – File to save training history
model_file – File to save trained model
- Returns:
Training history
- Return type:
tf.keras.callbacks.History
- class focal.DataCollector(csv_path: str, img_folder: str, angle_threshold: float, diameter_threshold: float, classification_type: str | None = 'binary', backbone: str | None = 'mobilenet', set_mask: str | None = 'n', encoder_path: str | None = None)[source]¶
Bases:
objectClass for collecting and preprocessing data from CSV files and image folders.
This class handles loading cleave metadata from CSV files, processing images, and creating TensorFlow datasets for training machine learning models.
- create_custom_dataset(image_shape: Tuple[int, int, int], test_size: float = 0.2, buffer_size: int = 32, batch_size: int = 16) Tuple[DatasetV2, DatasetV2][source]¶
Create datasets using only grayscale images and labels with a custom image shape.
- Parameters:
image_shape – Desired image shape (height, width, channels)
test_size – Fraction of data to use for testing
buffer_size – Buffer size for shuffling
batch_size – Batch size for training
- Returns:
Tuple of (train_ds, test_ds)
- create_datasets(images: ndarray, features: ndarray, labels: ndarray, test_size: float, buffer_size: int, batch_size: int, train_p: float, test_p: float, feature_scaler_path: str | None = None) Tuple[DatasetV2, DatasetV2, dict[int, float] | None][source]¶
Create train and test datasets with feature scaling.
- Parameters:
images – Array of image paths
features – Array of numerical features
labels – Array of target labels
test_size – Fraction of data to use for testing
buffer_size – Buffer size for dataset shuffling
batch_size – Batch size for training
feature_scaler_path – Optional path to save feature scaler
train_p – Masking probability for training.
test_p – Masking probability for testing.
- Returns:
Tuple of (train_ds, test_ds)
- create_kfold_datasets(images: ndarray, features: ndarray, labels: ndarray, buffer_size: int, batch_size: int, train_p: float, test_p: float, n_splits: int = 5) List[Tuple[DatasetV2, DatasetV2]][source]¶
Create datasets based on stratified k-fold cross validation.
- Parameters:
images – Array of image paths
features – Array of numerical features
labels – Array of target labels
buffer_size – Buffer size for dataset shuffling
batch_size – Batch size for training
n_splits – Number of k-fold splits
train_p – Masking probability for training
test_p – Masking probabilty for testing
- Returns:
List of (train_ds, test_ds) tuples for each fold
- property df: DataFrame | None¶
Lazy loading for memory efficiency.
- extract_data() Tuple[ndarray, ndarray, ndarray][source]¶
Extract data from DataFrame into separate arrays for model training.
- Returns:
Tuple of (images, features, labels) arrays
- get_backbone_preprocessor(backbone: str)[source]¶
Return the preprocessing function for the specified backbone model.
- Parameters:
backbone (str) – Name of the backbone to use. Must be one of: - “mobilenet” - “resnet” - “efficientnet”
- Returns:
The preprocess_input function tied to the chosen backbone.
- Return type:
Callable
- Raises:
ValueError – If backbone is not one of the supported options.
- image_only_dataset(original_dataset: DatasetV2) DatasetV2[source]¶
Convert dataset to image-only format (remove feature inputs).
- Parameters:
original_dataset – Original dataset with (image, features) inputs
- Returns:
Dataset with only image inputs
- Return type:
tf.data.Dataset
- class focal.GradCAM(model_path: str, image_folder: str, class_index: int | None = 0, backbone: str | None = None, conv_layer_name: str | None = None)[source]¶
Bases:
object- compute_all_heatmaps(save_path: str) None[source]¶
Computes heatmaps for a number of images.
- Parameters:
save_path – path to save the computed heatmap plot
- class focal.HyperParameterTuning(image_shape: Tuple[int, int, int], feature_shape: Tuple[int, ...], max_epochs: int = 20, objective: str = 'val_accuracy', directory: str = './tuner_logs', project_name: str = 'Cleave_Tuner', backbone: str | None = 'mobilenet', class_weights: str | None = None)[source]¶
Bases:
objectClass for tuning hyperparameters for the combined CNN+MLP model.
- get_best_hyperparameters() object[source]¶
Get best hyperparameters from hyperparameter search.
- Returns:
Best hyperparameters from hyperparameter search
- Return type:
keras_tuner.engine.hyperparameters.HyperParameters
- get_best_model() Model[source]¶
Get best model from hyperparameter search.
- Returns:
Best model from hyperparameter search
- Return type:
tf.keras.Model
- run_search(train_ds: DatasetV2, test_ds: DatasetV2, max_epochs: int) None[source]¶
Run hyperparameter search.
- Parameters:
train_ds – tf.data.Dataset - Training dataset
test_ds – tf.data.Dataset - Testing dataset
max_epochs – maximum number of training epochs
- save_best_model(pathname: str) None[source]¶
Save the best model from hyperparameter search.
- Parameters:
pathname – Path where to save the model
- tuner¶
self.tuner = Hyperband( hypermodel, objective=objective, max_epochs=max_epochs, directory=directory,
project_name=project_name )
- class focal.ImageHyperparameterTuning(image_shape: Tuple[int, int, int], max_epochs: int = 20, objective: str = 'val_accuracy', directory: str = './tuner_logs', project_name: str = 'CNN_Image_Only', backbone: str | None = 'mobilenet', num_classes: int | None = 5, class_weights: str | None = None)[source]¶
Bases:
HyperParameterTuningHyperparameter tuning specifically for image-only models.
- tuner¶
self.tuner = Hyperband( hypermodel, objective=objective, max_epochs=max_epochs, directory=directory,
project_name=project_name )
- class focal.ImageOnlyHyperModel(image_shape: Tuple[int, int, int], num_classes: int = 5, backbone: str | None = 'mobilenet', classification_type: str | None = 'binary')[source]¶
Bases:
HyperModelHyperModel for image-only classification (no numerical parameters).
- class focal.MLPDataCollector(csv_path: str, img_folder: str, angle_threshold: float, diameter_threshold: float, backbone: str | None = None)[source]¶
Bases:
DataCollectorData collector specifically for MLP regression models.
This class handles data preparation for tension prediction models, including proper scaling of both features and labels.
- create_datasets(images: ndarray, features: ndarray, labels: ndarray, test_size: float, buffer_size: int, batch_size: int, feature_scaler_path: str | None = None, tension_scaler_path: str | None = None) Tuple[DatasetV2, DatasetV2][source]¶
Create train and test datasets for MLP regression with proper scaling.
- Parameters:
images – Array of image paths
features – Array of numerical features
labels – Array of tension values
test_size – Fraction of data to use for testing
buffer_size – Buffer size for dataset shuffling
batch_size – Batch size for training
feature_scaler_path – Optional path to save feature scaler
tension_scaler_path – Optional path to save tension scaler
- Returns:
Tuple of (train_ds, test_ds)
- create_kfold_datasets(images: ndarray, features: ndarray, labels: ndarray, buffer_size: int, batch_size: int, n_splits: int = 5) Tuple[List[Tuple[DatasetV2, DatasetV2]], MinMaxScaler][source]¶
Create k-fold datasets for MLP regression with proper scaling.
- Parameters:
images – Array of image paths
features – Array of numerical features
labels – Array of tension values
buffer_size – Buffer size for dataset shuffling
batch_size – Batch size for training
n_splits – Number of k-fold splits
- Returns:
Tuple of (datasets, label_scaler)
- class focal.MLPHyperparameterTuning(cnn_path: str, max_epochs: int = 20, objective: str = 'val_mae', directory: str = './tuner_logs', project_name: str = 'MLPTuner', class_weights=None)[source]¶
Bases:
HyperParameterTuningHyperparameter tuning specifically for MLP models.
- class focal.TensionPredictor(model_path: str, image_folder: str, csv_path: str, angle_threshold: float, diameter_threshold: float, tension_scaler_path: str | None = None)[source]¶
Bases:
objectPredicts tension values using a trained MLP model and preprocessed image/features.
- load_and_preprocess_image(file_path: str, img_folder: str) Tensor[source]¶
Load and preprocess image from file path.
- Parameters:
file_path (str) – Path to image file.
img_folder (str) – Path to image folder.
- Returns:
Preprocessed image tensor.
- Return type:
tf.Tensor
- plot_metric(title: str, X: list[float], y: list[float], x_label: str, y_label: str, x_legend: str, y_legend: str) None[source]¶
Plot a metric for model evaluation.
- Parameters:
title (str) – Title of plot.
X (list[float]) – List of x values.
y (list[float]) – List of y values.
x_label (str) – Label for x axis.
y_label (str) – Label for y axis.
x_legend (str) – Legend for x axis.
y_legend (str) – Legend for y axis.
- class focal.TestPredictions(model_path: str, csv_path: str, scalar_path: str, img_folder: str, angle_threshold: float, diameter_threshold: float, encoder_path: str | None = None, image_only: bool = False, backbone: str = 'efficientnet', classification_type: str = 'binary', threshold: float | None = 0.5)[source]¶
Bases:
DataCollectorThis class is used to test model performance on unseen data using metrics such as accuracy, precision, recall, and confusion matrix.
Supports both image+feature and image-only CNNs.
- display_classification_report(true_labels: ndarray, pred_labels: List[int], classification_path: str | None = None) None[source]¶
Display classification report comparing true labels to predicted labels.
- Parameters:
true_labels (np.ndarray) – Array of true labels.
pred_labels (list[int]) – List of predicted labels.
classification_path (str, optional) – Optional path to save classification report.
- display_confusion_matrix(true_labels: ndarray, pred_labels: list[int], model_path: str) None[source]¶
Display confusion matrix comparing true labels to predicted labels.
- Parameters:
true_labels (np.ndarray) – Array of true labels.
pred_labels (list[int]) – List of predicted labels.
- gather_predictions() Tuple[ndarray, list, list] | Tuple[None, None, None][source]¶
Gather multiple predictions from test data.
- Returns:
(true_labels, pred_labels, predictions) or (None, None, None) if no data.
- Return type:
tuple
- plot_roc(title: str, true_labels: ndarray, pred_probabilites: ndarray) None[source]¶
Plot ROC curve for predictions.
- Parameters:
title (str) – Title for the plot.
true_labels (np.ndarray) – Array of true labels.
pred_probabilites (np.ndarray) – Array of predicted probabilities.
- test_prediction(image_path: str, feature_vector: ndarray | None = None) ndarray[source]¶
Generate prediction for a single image (and features if not image_only).
- Parameters:
image_path (str) – Path to image to predict.
feature_vector (np.ndarray | None) – Numerical features (ignored if image_only).
- Returns:
Model prediction.
- Return type:
np.ndarray
- class focal.XGBoostModel(csv_path: str, cnn_model_path: str, train_ds: Any, test_ds: Any)[source]¶
Bases:
objectThis class provides basic logic for training the XGBoost regressor.
- plot_metrics(title: str, metric1, metric2, metric1_label: str, metric2_label: str, x_label: str, y_label: str) None[source]¶
Basic plotting function for viewing metrics.
- Parameters:
title – Title of metric plot
metric1 – First metric to plot
metric2 – Second metric to plot
metric1_label – Metric 1 identifying label
metric2_labe – Metric 2 identifying label
x_label – X-axis label
y-Label – Y_axis label
- save(save_path: str) None[source]¶
Saves xgboost model.
- Parameters:
save_path – Path to save model.
- Raises:
ValueError – If trained model is None.
- train(error_type='reg:squarederror', n_estimators: int | None = 200, learning_rate: float | None = 0.05, max_depth: int | None = 4, random_state: int | None = 42, gamma: float | None = 0.0, subsample: float | None = 1.0, reg_lambda: float | None = 1.0)[source]¶
Training logic for the xgboost regression model.
- Parameters:
n_estimators – Maximum number of trees to use during training
learning_rate – Learning rate to update weights during training
max_depth – Maximum tree depth during training
random_state – Controls random state of model to ensure consitency across models
gamma – Minimum loss reduction.
subsample – Fraction of observations used for each tree.
reg_lambda – L2 regularization of leaf nodes.
- Returns:
Trained xgboost model
- class focal.XGBoostPredictor(csv_path: str, cnn_model_path: str, angle_threshold: float, diameter_threshold: float, xgb_path: str | None = None, scaler_path: str | None = None)[source]¶
Bases:
objectThis class implements basic logic for predicting and testing the change in tensions.
Subpackages¶
Submodules¶
- focal.config_schema module
BaseConfigCNNHyperparameterConfigCNNHyperparameterConfig.angle_thresholdCNNHyperparameterConfig.backboneCNNHyperparameterConfig.batch_sizeCNNHyperparameterConfig.buffer_sizeCNNHyperparameterConfig.diameter_thresholdCNNHyperparameterConfig.max_epochsCNNHyperparameterConfig.model_configCNNHyperparameterConfig.model_pathCNNHyperparameterConfig.project_nameCNNHyperparameterConfig.save_model_fileCNNHyperparameterConfig.test_pCNNHyperparameterConfig.test_sizeCNNHyperparameterConfig.train_pCNNHyperparameterConfig.tuner_directory
CheckpointMixinEarlyStoppingMixinGradCamConfigGradCamConfig.backboneGradCamConfig.class_indexGradCamConfig.conv_layer_nameGradCamConfig.fig_sizeGradCamConfig.heatmap_fileGradCamConfig.image_pathGradCamConfig.img_folderGradCamConfig.modeGradCamConfig.model_configGradCamConfig.model_pathGradCamConfig.multiple_imagesGradCamConfig.save_pathGradCamConfig.title
ImageHyperparameterConfigMLPHyperparameterConfigMLPHyperparameterConfig.angle_thresholdMLPHyperparameterConfig.backboneMLPHyperparameterConfig.batch_sizeMLPHyperparameterConfig.buffer_sizeMLPHyperparameterConfig.diameter_thresholdMLPHyperparameterConfig.max_epochsMLPHyperparameterConfig.model_configMLPHyperparameterConfig.model_pathMLPHyperparameterConfig.project_nameMLPHyperparameterConfig.save_model_fileMLPHyperparameterConfig.test_sizeMLPHyperparameterConfig.tuner_directory
ModelConfigModelConfig.batch_sizeModelConfig.brightnessModelConfig.buffer_sizeModelConfig.classification_pathModelConfig.continue_trainModelConfig.contrastModelConfig.encoder_pathModelConfig.feature_scaler_pathModelConfig.heightModelConfig.initial_epochsModelConfig.label_scaler_pathModelConfig.learning_rateModelConfig.max_epochsModelConfig.model_configModelConfig.model_pathModelConfig.objectiveModelConfig.project_nameModelConfig.rotationModelConfig.save_history_fileModelConfig.save_model_fileModelConfig.test_sizeModelConfig.tuner_directoryModelConfig.width
TestCNNConfigTestCNNConfig.angle_thresholdTestCNNConfig.backboneTestCNNConfig.classification_pathTestCNNConfig.classification_thresholdTestCNNConfig.cnn_modeTestCNNConfig.diameter_thresholdTestCNNConfig.encoder_pathTestCNNConfig.feature_scaler_pathTestCNNConfig.img_pathTestCNNConfig.label_scaler_pathTestCNNConfig.model_configTestCNNConfig.model_pathTestCNNConfig.tension_model_pathTestCNNConfig.tension_thresholdTestCNNConfig.test_featuresTestCNNConfig.valid_shapes()
TestImageOnlyConfigTestImageOnlyConfig.angle_thresholdTestImageOnlyConfig.backboneTestImageOnlyConfig.classification_pathTestImageOnlyConfig.classification_typeTestImageOnlyConfig.diameter_thresholdTestImageOnlyConfig.encoder_pathTestImageOnlyConfig.img_pathTestImageOnlyConfig.model_configTestImageOnlyConfig.model_path
TestMLPConfigTestRLConfigTestXGBoostConfigTrainCNNConfigTrainCNNConfig.angle_thresholdTrainCNNConfig.backboneTrainCNNConfig.classification_typeTrainCNNConfig.cnn_modeTrainCNNConfig.dense1TrainCNNConfig.dense2TrainCNNConfig.diameter_thresholdTrainCNNConfig.dropout1TrainCNNConfig.dropout2TrainCNNConfig.dropout3TrainCNNConfig.feature_shapeTrainCNNConfig.model_configTrainCNNConfig.num_classesTrainCNNConfig.reduce_lrTrainCNNConfig.reduce_lr_patienceTrainCNNConfig.tension_thresholdTrainCNNConfig.test_pTrainCNNConfig.train_pTrainCNNConfig.unfreeze_fromTrainCNNConfig.valid_shapes()
TrainImageOnlyConfigTrainImageOnlyConfig.angle_thresholdTrainImageOnlyConfig.backboneTrainImageOnlyConfig.best_tuner_paramsTrainImageOnlyConfig.brightnessTrainImageOnlyConfig.classification_typeTrainImageOnlyConfig.contrastTrainImageOnlyConfig.dense1TrainImageOnlyConfig.diameter_thresholdTrainImageOnlyConfig.dropout1TrainImageOnlyConfig.dropout2TrainImageOnlyConfig.heightTrainImageOnlyConfig.l2_factorTrainImageOnlyConfig.model_configTrainImageOnlyConfig.num_classesTrainImageOnlyConfig.reduce_lrTrainImageOnlyConfig.reduce_lr_patienceTrainImageOnlyConfig.rotationTrainImageOnlyConfig.unfreeze_fromTrainImageOnlyConfig.valid_shapes()TrainImageOnlyConfig.width
TrainKFoldCNNConfigTrainKFoldMLPConfigTrainMLPConfigTrainMLPConfig.angle_thresholdTrainMLPConfig.backboneTrainMLPConfig.dense1TrainMLPConfig.dense2TrainMLPConfig.diameter_thresholdTrainMLPConfig.dropout1TrainMLPConfig.dropout2TrainMLPConfig.dropout3TrainMLPConfig.img_pathTrainMLPConfig.model_configTrainMLPConfig.num_classesTrainMLPConfig.reduce_lrTrainMLPConfig.reduce_lr_patienceTrainMLPConfig.valid_shapes()
TrainRLConfigTrainRLConfig.agent_pathTrainRLConfig.batch_sizeTrainRLConfig.buffer_sizeTrainRLConfig.cnn_pathTrainRLConfig.csv_pathTrainRLConfig.feature_shapeTrainRLConfig.high_rangeTrainRLConfig.img_folderTrainRLConfig.learning_rateTrainRLConfig.low_rangeTrainRLConfig.max_deltaTrainRLConfig.max_stepsTrainRLConfig.max_tension_changeTrainRLConfig.modeTrainRLConfig.model_configTrainRLConfig.tauTrainRLConfig.thresholdTrainRLConfig.timesteps
TrainXGBoostConfigTrainXGBoostConfig.angle_thresholdTrainXGBoostConfig.diameter_thresholdTrainXGBoostConfig.error_typeTrainXGBoostConfig.gammaTrainXGBoostConfig.max_depthTrainXGBoostConfig.model_configTrainXGBoostConfig.n_estimatorsTrainXGBoostConfig.random_stateTrainXGBoostConfig.reg_lambdaTrainXGBoostConfig.subsampleTrainXGBoostConfig.xgb_path
load_config()
- focal.constants module
- focal.data_processing module
BadCleaveTensionClassifierDataCollectorDataCollector.create_custom_dataset()DataCollector.create_datasets()DataCollector.create_kfold_datasets()DataCollector.dfDataCollector.extract_data()DataCollector.get_backbone_preprocessor()DataCollector.image_only_dataset()DataCollector.load_process_images()DataCollector.save_scaler_encoder()
MLPDataCollector
- focal.grad_cam module
- focal.hyperparameter_tuning module
- focal.main module
- focal.mlflow_utils module
- focal.mlp_model module
- focal.model_pipeline module
CustomModelCustomModel.compile_custom_model()CustomModel.compile_image_only_model()CustomModel.compile_model()CustomModel.create_checkpoints()CustomModel.create_early_stopping()CustomModel.create_tensorboard_callback()CustomModel.get_averages_from_kfold()CustomModel.get_data_augmentation()CustomModel.plot_metric()CustomModel.reduce_on_plateau()CustomModel.train_kfold()CustomModel.train_model()
- focal.prediction_testing module
- focal.rl_pipeline module
- focal.xgboost_pipeline module