This is an animal detection project based off of PyTorch Tutorial to Object Detection.
The dataset used for training and validation is accessible on https://lila.science/datasets/snapshot-serengeti. The specific images used are listed in the bbox_images_split.csv file in the snapshot-serengeti folder.
The conda environment used to run the program can be setup using the environment.yaml file, using the command conda env create -f environment.yaml
, and activated with conda activate environment
.
Evaluation of a fully trained model (on a small sample of the validation dataset) can be performed by:
- Activating the conda virtual environment on a machine with CUDA enabled
- Change into the repository source directory
- Run the command
python eval.py
.
To run object detection on a single image:
- Activate the conda virtual environment
- Change into the repository source directory
- Run the command
python detect.py
. - The image will be output to sample.png for inspection.
datasets.py
: contains the class used to retrieve and handle the bounding box dataset
snapshot-serengeti/
: contains dataset metadata and a sample of the images in the dataset
transformations.py
: code with the custom image and bounding box transformations, as well as train/validation sequential transforms
utils.py
: miscelaneous utility functions
eval.py
: functions for evaluating the mAP of various models.
train.py
: the main training code for the model
models/EfficientNetSSD300.py
: the SSD300 model with EfficientNetB2 base feature extractor. This was the final model used for training.
models/EfficientNetSSD300.py
: the backup SSD300 model using MobileNet as the base feature extractor.