Add image classification models#653
Open
Creylay wants to merge 12 commits into
Open
Conversation
…t rate, and weight decay in MLPImageClassifier
… ResNet-50, VGG-16 - Implement EfficientNet-B0 image classifier with support for pretrained weights. - Implement LeNet-5 image classifier with configurable dropout and training parameters. - Implement ResNet-18 image classifier with skip connections and pretrained weights. - Implement ResNet-50 image classifier using bottleneck blocks and pretrained weights. - Implement VGG-16 image classifier with 3x3 convolutions and pretrained weights. - Add documentation for image classification models, including descriptions, architectures, and usage recommendations.
…ssification-models
…ssification-models
…ssification-models
Irozuku
requested changes
May 28, 2026
Collaborator
Irozuku
left a comment
There was a problem hiding this comment.
This is missing lazy imports for heavy dependencies such as torch. These imports should be moved inside the methods where they are actually used to avoid unnecessary startup overhead and memory consumption when the functionality is not needed.
It is also missing live metrics reporting for classification models. A call to calculate_metrics(...) should be added in each model so metrics are computed and reported consistently during training and evaluation.
Irozuku
requested changes
May 28, 2026
Collaborator
Irozuku
left a comment
There was a problem hiding this comment.
All models are missing a device parameter to explicitly select the execution device.
Member
|
Also missing de language (and i think this show we are also missing pt language on models) |
…nction - Replaced individual dataset classes with a common `_make_image_dataset` function across multiple classifiers (Torchvision, CNN, LeNet5, MLP). - Updated model definitions to utilize the new dataset function. - Simplified model architecture definitions by introducing `_build_*_model` functions for CNN, LeNet5, and MLP. - Removed redundant imports and organized code for better readability. - Enhanced training loops to include evaluation metrics for both training and validation datasets.
…ssification-models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds four new torchvision-based image classification models to DashAI and introduces a shared base class that consolidates all training logic. The MLP image classifier is also upgraded with new configurable hyperparameters. A defensive logging improvement in
BaseModelavoids silent failures when a metric returns a non-finite score (e.g., only one class present in a split).Type of Change
Changes (by file)
DashAI/back/models/base_torchvision_image_classifier.py: New shared base class (TorchvisionImageClassifier) for torchvision-backed models. Implements the full train/predict/save/load lifecycle, data augmentation pipeline, and a shared schema (TorchvisionImageClassifierSchema) with parameters:epochs,learning_rate,batch_size,image_size,dropout_rate,weight_decay.DashAI/back/models/cnn_image_classifier.py: NewCNNImageClassifier— a lightweight custom CNN with two conv blocks and a configurable number of filters.DashAI/back/models/lenet5_image_classifier.py: NewLeNet5ImageClassifier— LeNet-5 architecture (LeCun et al., 1998), adapted for multi-class output.DashAI/back/models/resnet18_image_classifier.py: NewResNet18ImageClassifier— ResNet-18 backbone with optional ImageNet pre-trained weights; final FC layer replaced to match target classes.DashAI/back/models/resnet50_image_classifier.py: NewResNet50ImageClassifier— ResNet-50 backbone with optional ImageNet pre-trained weights; final FC layer replaced.DashAI/back/models/efficientnet_b0_image_classifier.py: NewEfficientNetB0ImageClassifier— EfficientNet-B0 backbone with optional ImageNetDashAI/back/models/mlp_image_classifier.py: Addedbatch_size,image_size,dropout_rate, andweight_decayparameters; wired them through training, prediction, save, and load paths.DashAI/back/models/base_model.py: Added warning log when a metric returns a non-finite value (e.g.,NaN,inf) during evaluation; the metric is skipped instead of crashing or silently producing bad results.DashAI/back/tasks/image_classification_task.py: Shortened theDESCRIPTIONfield to a concise single sentence.DashAI/back/initial_components.py: RegisteredCNNImageClassifier,LeNet5ImageClassifier,ResNet18ImageClassifier,ResNet50ImageClassifier, andEfficientNetB0ImageClassifier. RemovedVGG16ImageClassifier(also deleted its file).Notes
TorchvisionImageClassifierand only need to implement_build_backboneand_classifier_head, keeping each model file minimal.pretrained=True(the default).