discussion / AI for Conservation  / 21 February 2024

Pytorch-Wildlife: A Collaborative Deep Learning Framework for Conservation (v1.0)

Welcome to Pytorch-Wildlife v1.0

At the core of our mission is the desire to create a harmonious space where conservation scientists from all over the globe can unite, share, and grow. We are expanding the Microsoft CameraTraps repo (previously the repo for MegaDetector) to introduce Pytorch-Wildlife, a Collaborative Deep Learning Framework for Conservation, where researchers can come together to share and use datasets and deep learning architectures for wildlife conservation.

We've been inspired by the potential and capabilities of Megadetector, and we deeply value its contributions to the community. As we forge ahead with Pytorch-Wildlife, under which Megadetector now resides, please know that we remain committed to supporting, maintaining, and developing Megadetector, ensuring its continued relevance, expansion, and utility.

The Pytorch-Wildlife library is a new AI Conservation platform that allows users to directly load the MegaDetector v5 model weights for animal detection. We've fully refactored our codebase, prioritizing ease of use in model deployment and expansion. In addition to MegaDetector v5, Pytorch-Wildlife also accommodates a range of classification weights, such as those derived from an Amazon Rainforest camera trap dataset and an Opossum classification dataset (more details of these datasets will be published soon).

 

Unlike previous implementations where the MegaDetector v5 model weights need to be manually downloaded, Pytorch-Wildlife automatically downloads all the model weights (including MegaDetector v5 and other classification model weights) the first time the models are loaded. This implementation uses an approach similar to the default Pytorch model loading method.

To use the newest version of MegaDetector with all the existing functionalities, you can simply load the model with Pytorch-Wildlife and the weights will be automatically downloaded:

from PytorchWildlife.models import detection as pw_detection
detection_model = pw_detection.MegaDetectorV5()

Please also explore the codebase and functionalities of Pytorch-Wildlife through our interactive Gradio interface and detailed Jupyter notebooks, designed to showcase the practical applications of our enhancements.

 

Pytorch-Wildlife can be installed through:

pip install PytorchWildlife

More information can be found in our Installation guide and detailed library documentation.

Here is a brief example on how to perform detection and classification on a single image using PyTorch-wildlife:

import torch
from PytorchWildlife.models import detection as pw_detection
from PytorchWildlife.models import classification as pw_classification
img = torch.randn((3, 1280, 1280))
# Detection
detection_model = pw_detection.MegaDetectorV5()
detection_result = detection_model.single_image_detection(img)
#Classification
classification_model = pw_classification.AI4GAmazonRainforest()
classification_results = classification_model.single_image_classification(img)

If you have any questions regarding MegaDetector and Pytorch-Wildlife, please email us at [email protected]!

 

 




This is really interesting. I’ll probably pm you to see if we can have a video call as I’d like to align on some of my goals with respect to object detection and conservation so I have an idea as to what’s possible. My head has been going in many directions with respect to your mega detector platform.

Also to discuss about those models and the NVidia Jetson Platform.

Is there any plan for upcoming workshop or training for PyTorch-Wildlife for non coder? I was trying to use MDv5 via PyTorch Wildlife but stop after stuck with the unfamiliarity of interface. Thanks!