This project explores image classification using ResNet50 through two different approaches:
- Training from scratch (custom implementation in PyTorch)
- Transfer learning (pretrained ResNet50 fine-tuned on custom data)
The goal is to understand both the theoretical foundations of deep convolutional networks and the practical advantages of pretrained models.
-
~1400 images of dinosaur fossils
-
Manually collected and organized into class folders
-
Categories include examples such as:
- Sauropod
- Theropod
- Ornithiscia
- Marine(Ammonites, Plesiosaurs, Mosasaurs, Trilobites)
- Unknown (Eggs, Footprints, Leaves, etc.)
Note: The dataset is relatively small, which significantly impacts model performance when training from scratch.
- Implemented manually in PyTorch
- Includes residual blocks and skip connections
- Trained entirely on the custom dataset
Result:
- Accuracy: 61%
Challenges:
- Limited dataset size
- Slower convergence
- Overfitting and generalization issues
- Pretrained on ImageNet
- Fine-tuned on fossil dataset
- Leveraged learned low-level visual features
Result:
- Accuracy: 85%
Advantages:
- Faster convergence
- Better generalization
- More robust feature extraction
| Model | Accuracy |
|---|---|
| From Scratch | 61% |
| Transfer Learning | 85% |
Transfer learning significantly improves performance when working with limited data by reusing features learned from large-scale datasets.
The project is deployed as an interactive web application:
- Frontend: Gradio
- Backend: FastAPI
- Infrastructure: AWS ECS Fargate
- Upload an image of a fossil
- Run inference on both models simultaneously
- Compare predictions side-by-side
.
├── app/
│ ├── main.py
│ └── example.json
│ └── fun_facts.json
│ └── resnet_finetuned.pth
│ └── resnet_scratch.pth
│ └── torch_utils_finetuned.py
│ └── torch_utils_scratch.py
├── front-end/
│ ├── Dockerfile
│ ├── requirement.txt
│ └── T-Rex-background.jpg
│
├── scratch.ipynb
├── finetuned.ipynb
├── Dockerfile
├── README.md
└── requirements.txt
pip install -r requirements.txtuvicorn app.main:app --reloadpython app/gradio_ui.py- Increase dataset size
- Apply data augmentation techniques
- Experiment with other architectures (EfficientNet, ViT)
- PyTorch
- ImageNet pretrained models
- Open-source fossil image sources
MIT License