Smoker Detection with LoRA Fine-Tuning
Fine-tuned ResNet34 model using LoRA (Low-Rank Adaptation) for binary smoking detection in images.
Model Description
This model uses parameter-efficient fine-tuning with LoRA on a pretrained ResNet34 to classify images as "Smoker" or "Non-Smoker". By training only 2.14% of parameters, it achieves 89.73% test accuracy while preserving ImageNet knowledge.
- Model Type: ResNet34 + LoRA adapters
- Task: Binary Image Classification
- Framework: PyTorch
- License: MIT
Performance
| Split | Accuracy | F1-Score (Smoking) |
|---|---|---|
| Validation | 96.67% | |
| Test | 91.07% | 91.23% |
Efficiency:
- Trainable parameters: 465K (2.14% of model)
- Training time: ~15 minutes on Kaggle T4 GPU
Usage
Installation
pip install torch torchvision pillow
Load Model
python infer.py
Training Details
Dataset: 1,120 images from Kaggle Smoking Detection Dataset Training: 716 images (64%) Validation: 180 images (16%) Test: 224 images (20%)
Hyperparameters
Learning Rate: 1e-4 Optimizer: AdamW (weight decay: 1e-4) Batch Size: 32 Epochs: 20 LoRA Rank: 8
Model Architecture
ResNet34 (21.7M parameters) βββ Frozen Layers (21.3M - 97.86%) β βββ conv1, layer1, layer2 β βββ Pretrained ImageNet weights βββ Trainable Layers (465K - 2.14%) βββ LoRA adapters on layer3 (6 blocks) βββ LoRA adapters on layer4 (3 blocks) βββ Classification head fc (512 β 2)
- Downloads last month
- 12