Downloads · 30 days
0
Rishi2207/crocodile-reid
crocodile-reid is a machine learning model from Rishi2207. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
AI-powered crocodile individual identification using deep metric learning.
Downloads · 30 days
0
Access
Public
Updated Mar 28, 2026
Repo size
1.6 GB
Likes
0
Public
Click a slice to open those files.
.pth1.6 GB · 100%
From the Hugging Face model README
AI-powered crocodile individual identification using deep metric learning.
croc_reid/
├── requirements.txt ← Python packages to install
├── setup_project.py ← Run this FIRST (creates folders, checks GPU)
├── model.py ← Re-ID neural network (ResNet50 + Triplet Loss)
├── dataset.py ← Image loading + augmentation + triplet sampling
├── train.py ← Training loop with TensorBoard logging
├── inference.py ← Identify crocs from new images
├── configs/
│ └── config.yaml ← All settings (epochs, batch size, LR, etc.)
├── dataset/
│ ├── train/
│ │ ├── croc_001/ ← One folder per individual crocodile
│ │ │ ├── img1.jpg
│ │ │ └── img2.jpg
│ │ └── croc_002/
│ ├── val/
│ └── test/
├── models/
│ ├── checkpoints/ ← Saved during training
│ └── best/ ← Best model saved here
└── outputs/ ← Inference result images saved here
Download Python 3.10 from https://python.org
During install: ✅ check "Add Python to PATH"
Go to: https://pytorch.org/get-started/locally/
Select: Windows | Pip | Python | CUDA 11.8
Copy and run the install command (looks like):
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu118
Open Command Prompt in the project folder and run:
pip install -r requirements.txt
python setup_project.py
You should see: ✅ GPU found: NVIDIA ...
dataset/train/croc_001/img1.jpg
dataset/train/croc_001/img2.jpg
dataset/train/croc_002/img1.jpg
...
dataset/val/croc_001/img1.jpg ← Use 20% of images for validation
python train.py
Monitor training in real time:
tensorboard --logdir runs/tensorboard
Then open: http://localhost:6006
What to expect:
python inference.py --mode build --data_dir dataset/val
python inference.py --mode identify --image path/to/new_croc.jpg
python inference.py --mode add --image path/to/croc.jpg --id croc_042
| Setting | Default | When to change |
|---|---|---|
epochs | 50 | Increase to 100 if accuracy is still improving |
batch_size | 32 | Reduce to 16 if you get "out of memory" errors |
learning_rate | 0.0003 | Reduce to 0.0001 if loss is unstable |
margin | 0.3 | Increase to 0.5 if same-individual embeddings are too far |
num_workers | 4 | Set to 0 on Windows if you get DataLoader errors |
"CUDA out of memory"
→ Reduce batch_size to 16 or 8 in config.yaml
"DataLoader worker error"
→ Set num_workers: 0 in config.yaml
"No such file: model_best.pth"
→ Train the model first: python train.py
Low Rank-1 accuracy
→ Add more images per individual
→ Make sure your crops focus on scale patterns
→ Train for more epochs