https://github.com/ccomkhj/lightening_classifier
PyTorch Lightning wrapper to make training classifiers easier.
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.2%) to scientific vocabulary
Keywords
Repository
PyTorch Lightning wrapper to make training classifiers easier.
Basic Info
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
readme.MD
PyTorch Lightning Image Classifiers
This repository contains modular PyTorch Lightning implementations of popular deep learning models for image classification. All models inherit from a common BaseClassifier class, making it easy to modify, extend, and use for various tasks.
Currently Supported Classifiers
| Model | Train | Test | Inference | GRAD-CAM | |------------------|-------|------|-----------|----------| | SwinTransformer | ✅ | ✅ | ✅ | ✅ | | ResNet | ✅ | ✅ | ✅ | ❌ | | ResNext | ✅ | ✅ | ✅ | ❌ | | DenseNet | ✅ | ✅ | ✅ | ❌ | | EfficientNet | ✅ | ✅ | ✅ | ❌ | | ViT | ✅ | ✅ | ✅ | ❌ |
Features
- Modular Design: All models inherit from
BaseClassifier, ensuring consistent training, validation, and testing workflows. - Easy Configuration: Modify hyperparameters like learning rate, batch size, and optimizer directly in the configuration.
- Checkpointing: Automatically saves the best model during training.
- Early Stopping: Prevents overfitting by stopping training if validation performance plateaus.
Usage
Install Dependencies:
bash pip install pytorch_lightning torchvision transformers efficientnet-pytorchBenchmarking Models: Use the
train_all_models.pyscript to train and test all models and check what works the best.:
After completion, you will get report in csv as below. Based on the metric, decide which model is appropriate for your task.
| Model | Test Accuracy | Test Precision | Test Recall | Test F1 | Training Time | Timestamp | |------------------|-----------------|-----------------|-----------------|-----------------|----------------|----------------| | ResNext101 | 0.78899 | 0.79964 | 0.78899 | 0.78879 | 1:47:51.260405 | 20250221094927 | | ResNet101 | 0.78899 | 0.79463 | 0.78899 | 0.78770 | 1:03:14.367643 | 20250221113730 | | SwinTransformer | 0.88073 | 0.88272 | 0.88073 | 0.88030 | 0:22:18.137873 | 20250221124052 | | ViT | 0.84404 | 0.84723 | 0.84404 | 0.84415 | 0:22:27.548590 | 20250221130314 | | DenseNet121 | 0.85321 | 0.86235 | 0.85321 | 0.85291 | 0:58:01.608439 | 20250221132545 | | EfficientNetB7 | 0.84404 | 0.85011 | 0.84404 | 0.84465 | 3:06:57.563459 | 20250221142354 |
Train, Test and Inference demo Use the
demo.ipynbto follow the whole workflow with a model architecture.GRAD-CAM Visualization
The grad_cam.ipynb notebook provides a detailed workflow for generating Grad-CAM (Gradient-weighted Class Activation Mapping) heatmaps to visualize which regions of an image are most influential for the model's predictions.

Extending the Repository:
To add a new model:
- Create a new Python file under models directory. (e.g., newmodelclassifier.py).
- Inherit from BaseClassifier and implement the model-specific logic.
- If needed, Add the new model to the models_to_test dictionary in trainallmodels.py.
License
This project is licensed under the MIT License. See LICENSE for details.
Owner
- Name: Huijo
- Login: ccomkhj
- Kind: user
- Location: Germany
- Company: @hexafarms
- Website: https://ccomkhj.github.io/
- Repositories: 3
- Profile: https://github.com/ccomkhj
Self Learner
GitHub Events
Total
- Push event: 12
Last Year
- Push event: 12
Issues and Pull Requests
Last synced: 12 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0