Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A MegaDetector CLI tool

Get started

To process a folder of cameratrap media with MegaDetector and export result in csv format, you can use the following command:

Windows:

md5rs.exe -f <folder_to_process> -d 0 -i -m models/md_v5a.toml -max-frames 3 -e csv

Linux/MacOS:

md5rs -f <folder_to_process> -d 0 -i -m models/md_v5a.toml -max-frames 3 -e csv

Supported export formats are csv, json.

Run md5rs -h to see all available options.

Default Models

MegaDetector v5a

FP32 model

FP16 model

Converted onnx model from md_v5a.0.0.pt and add dynamic batch and some postprocessing.

MegaDetector v6e(640 & 1280)

640 FP32 model

1280 FP32 model

Converted onnx model from MDV6-yolov9e.pt, MDV6-yolov9-e-1280.pt and add dynamic batch and some postprocessing.

MegaDetector v6b (Beta)

FP32 model

FP16 model

Converted onnx model from MDV6b-yolov9c.pt and add dynamic batch and some postprocessing.

Key features

  • Multiple platform and device support based on ONNX Runtime
  • Support both image and video processing
  • Multithread at each step
  • Dynamic batch inference

Supported devices and platforms

Devices (Execution Providers) Linux Windows Macos
CPU (CoreML fo Apple silicon)
Nvidia GPU (CUDA/TensorRT)
Intel GPU/NPU (OpenVINO)
AMD GPU(DirectML)
Apple silicon GPU/NPU (CoreML)

*Other devices listed in ONNX Runtime execution providers should also be available, but are not built and tested yet.

Prerequisites

FFmpeg (for video processing)

FFmpeg binary should be automatically downloaded. In case of failure, you can download it from here

ONNX Runtime dynamic libraries(for model inference)

The automatically downloaded onnxruntime libs don't deliver OpenVINO support. Prebuilt ort libs can be downloaded from here

Execution provider driver and dynamic libraries

Tested on CUDA 12.6, CUDNN 9.5, TensorRT 10.2, OpenVINO 2024.3

Organize python script

The organize.py script is used to organize the cameratrap media into folders named with class names and blank in sequence. It takes the export result file as input and moves the media to the corresponding folders. The script can be used as follows:

python organize.py --result result.csv --guess

Sequence is determined by shoot time or filename extension pattern if shoot time is not available. Media shot in given time range is considered as a sequence. There is a guess model to determine sequence from filename extension pattern. For example, if filenames in a folder are [IMG_0001.JPG, IMG_0002.JPG, IMG_0003.MOV, IMG_0004.JPG, IMG_0005.JPG, IMG_0006.MOV...], the guessed sequence is [IMG_0001.JPG, IMG_0002.JPG, IMG_0003.MOV], [IMG_0004.JPG, IMG_0005.JPG, IMG_0006.MOV]... The guess model is experimental and may not work in all cases, use it with your own risk. You can always use the --redo option to restore.

Known issues

FP16 model didn't use ANE(Accelerated Neural Engine) on Apple silicon. Use FP32 model instead.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages