Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- image-classification
|
| 5 |
+
- pytorch
|
| 6 |
+
- resnet18
|
| 7 |
+
- butterflies
|
| 8 |
---
|
| 9 |
+
|
| 10 |
+
# ButterflyID_5class
|
| 11 |
+
|
| 12 |
+
**ButterflyID_5class** is an image classification model that identifies 5 butterfly species commonly observed in Missouri: Black Swallowtail, Common Buckeye, Eastern Tiger Swallowtail, Red-Spotted Purple, and Small White. Built with PyTorch using transfer learning on a fine-tuned ResNet18 backbone.
|
| 13 |
+
|
| 14 |
+
This is a v1 release — the species list is intentionally limited for now and is planned to expand over time. These species are not exclusive to Missouri; the dataset was simply built around locally available observations.
|
| 15 |
+
|
| 16 |
+
## Performance
|
| 17 |
+
|
| 18 |
+
Dataset split: 177 train / 35 val / 44 test images across 5 classes.
|
| 19 |
+
|
| 20 |
+
- **Best validation accuracy:** 94.29%
|
| 21 |
+
- **Final test accuracy:** 90.91%
|
| 22 |
+
|
| 23 |
+
**Per-class test accuracy:**
|
| 24 |
+
|
| 25 |
+
| Species | Accuracy |
|
| 26 |
+
|---|---|
|
| 27 |
+
| Common Buckeye | 100.00% (9/9) |
|
| 28 |
+
| Red-Spotted Purple | 100.00% (9/9) |
|
| 29 |
+
| Small White | 100.00% (9/9) |
|
| 30 |
+
| Eastern Tiger Swallowtail | 88.89% (8/9) |
|
| 31 |
+
| Black Swallowtail | 62.50% (5/8) |
|
| 32 |
+
|
| 33 |
+
Black Swallowtail is the model's weakest class, likely due to visual similarity with Eastern Tiger Swallowtail (both swallowtail species with overlapping wing shape/pattern features). Test set sizes are small (8-9 images per class), so individual misclassifications have a large effect on the reported percentage.
|
| 34 |
+
|
| 35 |
+
## Data
|
| 36 |
+
|
| 37 |
+
Training images were sourced from [iNaturalist](https://www.inaturalist.org/). Full data attribution and licensing details are available in ATTRIBUTIONS.md in the project repo.
|
| 38 |
+
|
| 39 |
+
## Usage
|
| 40 |
+
|
| 41 |
+
This checkpoint bundles both the trained model weights and the class name list together:
|
| 42 |
+
|
| 43 |
+
```python
|
| 44 |
+
import torch
|
| 45 |
+
from torchvision import models
|
| 46 |
+
import torch.nn as nn
|
| 47 |
+
|
| 48 |
+
checkpoint = torch.load("butterfly_model.pt", map_location="cpu")
|
| 49 |
+
class_names = checkpoint["class_names"]
|
| 50 |
+
|
| 51 |
+
model = models.resnet18(weights=None)
|
| 52 |
+
model.fc = nn.Linear(model.fc.in_features, len(class_names))
|
| 53 |
+
model.load_state_dict(checkpoint["model_state_dict"])
|
| 54 |
+
model.eval()
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## Project
|
| 58 |
+
|
| 59 |
+
Part of the full-stack [ButterflyID project](https://github.com/devbyjen388/ButterflyID) (FastAPI backend + web frontend).
|