This project included myself and Mastoorah Faizi
Programming Language: This project was developed in Python, using the following key libraries:
- torch (PyTorch)
- torchvision
- timm (for loading the pretrained MegaDescriptor model)
- pandas, numpy, matplotlib
- scikit-learn
- wildlife_datasets (custom dataset API)
- kagglehub (for dataset download)
Code Structure: The project consists of a single Jupyter Notebook:
- 4_23_MegaDesc_Animals_Subset.ipynb
This notebook includes:
- Dataset filtering and preprocessing
- Custom TripletDataset class definition
- MegaDescriptor model loading
- Triplet loss training loop
- Evaluation using cosine similarity, balanced accuracy, and confusion matrix
- Visualization of results
Additional files for submission:
- Wildlife CNN Report.pdf (project report)
- demo.mp4 or equivalent (recorded demonstration)
- readme.txt (this file)
How to Run the Code (with detailed steps):
-
Set up a Python environment
-
Install dependencies pip install torch torchvision timm pandas numpy matplotlib scikit-learn pip install git+https://github.com/WildlifeDatasets/wildlife-datasets@develop pip install kagglehub
-
Download and extract the dataset (run code at beginning of notebook)
-
GPU Use (Recommended)
- This notebook is computationally intensive. For training and evaluation to complete in a reasonable time, a CUDA-enabled GPU is highly recommended.
- In Colab, go to Runtime > Change runtime type > GPU before running.
-
Run the rest of the notebook
- Open 4_23_MegaDesc_Animals_Subset.ipynb