This repository contains the source code of the paper "Distance Estimation and Animal Tracking for Wildlife Camera Trapping", Peter Johanns, Timm Haucke, Volker Steinhage [arXiv
] [Ecological Informatics
]
In wildlife density estimation the analysis of camera trap videos is essential for many procedures and often involves labourious, manual analysis.
Most density estimation models require the recognition of an animal in a captured video and its distance in meters to the camera. Some even require an approximation of its movement speed. In practice, combinations of pre-recorded reference videos, additional sensors and manual annotation are used to retrieve this information.
We propose a fully automatic approach that only requires the camera trap video and the width of the Field Of View (FOV) in degrees of the used device. Our approach recognizes animals, calculates their distance to the camera and tracks animals across the complete video, completely automatic.
For an input video our pipeline outputs per frame the position of all visible animals in the current img, their distances to the camera in meters and the 3D position relative to the camera (x, y, z) with the camera at the center of the coordinate system. The output is saved into a csv file like this one and can be used for further processing with tabulary tools like Microsoft Excel or LibreOffice Calc, if desired.
We provide the possibility to try out the pipeline by yourself on an examplary input video (S01) seen below. The input image is split into single frames and stored here
You can use this Colab notebook
-
Click all the "Play" buttons at the upper left corner of each cell from top to bottom.
- Colab will now install all required libraries and apply the pipeline to the input video
- This process will take some time (~20 min) due to the installation
- Colab will notify you, if the process is completed
-
You can find the output .csv file at the left file explorer menu under the folder inference_test/output.csv or if you can't wait that long, here.
You can also upload your own files and try out the model. You can either upload single images or a complete video.
-
Single images:
- Create directory at left file explorer menu (see 3., instructions) under Images/<YOUR_DIRECTORY> and upload your files by right-clicking on the folder.
- Change
single_imgs = False
tosingle_imgs = True
- Change
input_frames_dir = "Images/S01_color"
toinput_frames_dir = "Images/<YOUR_DIRECTORY>"
- Change
input_fov_deg = 89.89943662633006"
toinput_fov_deg = <THE FOV in degrees of the used camera>"
-
Videos:
- Create directory at left file explorer menu (see 3., instructions) under Images/<YOUR_DIRECTORY> and upload your files by right-clicking on the folder.
NOTE: You have to split up the video into single .png images before uploading them to the directory!
Remaining steps identical to step iii. and iv. above
Pipeline output, visualized by projecting the tracks back to 3D.
S01_tracked_3D_animation.mp4
This version uses an updated MegaDetector version. If you wish to reproduce the results of the original publication, please use tag v1.0, which uses MegaDetector v4.1.