This project was initiated to support wildlife conservation efforts in snake-rich ecosystems. By accurately distinguishing between snake images and background images, we aim to assist researchers and field workers in cataloging snake populations and understanding their habitats. This tool could potentially be integrated into mobile applications for quick snake identification, enhancing both research capabilities and safety measures for people working in or visiting snake-inhabited areas.
This project implements a binary classifier to distinguish between snake images and background images using a VGG16 model with a modified head. The classifier is built using PyTorch and is designed to be a learning exercise for participants interested in deep learning and computer vision.
The dataset consists of images divided into two classes:
- Snake images
- Background images (non-snake images)
The main components of the project are:
- Data preparation and loading
- Model architecture (VGG16 with custom classifier)
- Training and validation loops
- Evaluation metrics and visualization
The project requires the following main libraries:
- PyTorch
- torchvision
- matplotlib
- numpy
- scikit-learn
- seaborn
- pandas Additional dependencies are listed in the import statements at the beginning of the script.
The model is trained for 15 epochs using SGD optimizer and CrossEntropyLoss. The training process includes both training and validation steps, with results logged for each epoch.
The model's performance is evaluated on a separate test set. Evaluation metrics include:
- Accuracy
- Precision
- Recall
- F1 Score Additionally, a confusion matrix and classification report are generated and visualized.
The project includes functions to visualize:
- Sample images from the dataset
- Training and validation loss/accuracy curves
- Predictions on individual images
- Confusion matrix and classification report
An option for loading Pre-trained weights is available and can be loaded using the load_with_pretrained_weights
function.
This project contains several issues that participants are challenged to identify and fix. These issues range from data preprocessing to model architecture and training process. Participants should carefully review the code, run it, and improve its performance. By working on these challenges, you'll also enhance your deep learning skills on the way.😄
NOTE: This repository is supposed to be run on colab using the github integration of colab (use this as a reference and use File -> Save a copy in github
to push your code). If you think your laptop has enough GPU power (i.e., >=Tesla T4 GPU), you are free to use your laptop (compare using this).
Good luck, and happy coding! 🚀🐍