{"id":25944517,"url":"https://github.com/ccomkhj/lightening_classifier","last_synced_at":"2026-05-18T03:02:44.065Z","repository":{"id":278642850,"uuid":"936093842","full_name":"ccomkhj/Lightening_Classifier","owner":"ccomkhj","description":"PyTorch Lightning wrapper to make training classifiers easier.","archived":false,"fork":false,"pushed_at":"2025-03-01T14:47:37.000Z","size":4880,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-09T23:34:09.748Z","etag":null,"topics":["classification","classifier","computer-vision","ml","pytorch","pytorch-lightning","resnet","swin"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ccomkhj.png","metadata":{"files":{"readme":"readme.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-20T14:17:49.000Z","updated_at":"2025-06-13T17:23:21.000Z","dependencies_parsed_at":"2025-09-09T21:36:54.241Z","dependency_job_id":"985e155c-04cc-44fa-9dd4-fd483454d215","html_url":"https://github.com/ccomkhj/Lightening_Classifier","commit_stats":null,"previous_names":["ccomkhj/lightening_classifier"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ccomkhj/Lightening_Classifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccomkhj%2FLightening_Classifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccomkhj%2FLightening_Classifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccomkhj%2FLightening_Classifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccomkhj%2FLightening_Classifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ccomkhj","download_url":"https://codeload.github.com/ccomkhj/Lightening_Classifier/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccomkhj%2FLightening_Classifier/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278740832,"owners_count":26037480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classification","classifier","computer-vision","ml","pytorch","pytorch-lightning","resnet","swin"],"created_at":"2025-03-04T08:18:03.576Z","updated_at":"2025-10-07T07:40:03.883Z","avatar_url":"https://github.com/ccomkhj.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyTorch Lightning Image Classifiers\n\nThis 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.\n\n## Currently Supported Classifiers\n\n| Model            | Train | Test | Inference | GRAD-CAM |\n|------------------|-------|------|-----------|----------|\n| SwinTransformer  | ✅    | ✅   | ✅        | ✅       |\n| ResNet           | ✅    | ✅   | ✅        | ❌       |\n| ResNext          | ✅    | ✅   | ✅        | ❌       |\n| DenseNet         | ✅    | ✅   | ✅        | ❌       |\n| EfficientNet     | ✅    | ✅   | ✅        | ❌       |\n| ViT              | ✅    | ✅   | ✅        | ❌       |\n\n## Features\n\n- **Modular Design**: All models inherit from `BaseClassifier`, ensuring consistent training, validation, and testing workflows.\n- **Easy Configuration**: Modify hyperparameters like learning rate, batch size, and optimizer directly in the configuration.\n- **Checkpointing**: Automatically saves the best model during training.\n- **Early Stopping**: Prevents overfitting by stopping training if validation performance plateaus.\n\n## Usage\n\n1. **Install Dependencies**:\n```bash\npip install pytorch_lightning torchvision transformers efficientnet-pytorch\n```\n\n2. **Benchmarking Models**:\nUse the `train_all_models.py` script to train and test all models and check what works the best.:\n\nAfter completion, you will get report in csv as below.\nBased on the metric, decide which model is appropriate for your task.\n\n| Model            | Test Accuracy   | Test Precision  | Test Recall     | Test F1         | Training Time  | Timestamp      |\n|------------------|-----------------|-----------------|-----------------|-----------------|----------------|----------------|\n| ResNext101       | 0.78899         | 0.79964         | 0.78899         | 0.78879         | 1:47:51.260405 | 20250221_094927 |\n| ResNet101        | 0.78899         | 0.79463         | 0.78899         | 0.78770         | 1:03:14.367643 | 20250221_113730 |\n| SwinTransformer  | 0.88073         | 0.88272         | 0.88073         | 0.88030         | 0:22:18.137873 | 20250221_124052 |\n| ViT              | 0.84404         | 0.84723         | 0.84404         | 0.84415         | 0:22:27.548590 | 20250221_130314 |\n| DenseNet121      | 0.85321         | 0.86235         | 0.85321         | 0.85291         | 0:58:01.608439 | 20250221_132545 |\n| EfficientNetB7   | 0.84404         | 0.85011         | 0.84404         | 0.84465         | 3:06:57.563459 | 20250221_142354 |\n\n3. **Train, Test and Inference demo**\nUse the `demo.ipynb` to follow the whole workflow with a model architecture.\n\n4. **GRAD-CAM Visualization**\n\nThe [grad_cam.ipynb](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.\n\n![Grad-CAM Heatmap](demo/heat_map.png)\n\n## Extending the Repository:\n**To add a new model**:\n- Create a new Python file under `models` directory. (e.g., new_model_classifier.py).\n- Inherit from BaseClassifier and implement the model-specific logic.\n- If needed, Add the new model to the `models_to_test` dictionary in [train_all_models.py](train_all_models.py).\n\n## License\nThis project is licensed under the MIT License. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccomkhj%2Flightening_classifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fccomkhj%2Flightening_classifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccomkhj%2Flightening_classifier/lists"}