This is a mouse tracking application that track single or multiple mice in images or videos.
This application use YOLOv5 of Ultralytics and Pytorch to train YOLOv5n with custom mouse dataset. You can see the YOLOv5 Docs for more understandings of YOLOv5. If you want to know how to use this application, you can skip this and see following section.
Install and detect sections are similar to YOLOv5. You may refer to their example.
Install
Clone repo and install requirements.txt in a
Python>=3.6.0 environment, including
PyTorch>=1.7.
*This application is tested in Python==3.7 and PyTorch==1.8.0+cu111.
git clone https://github.com/nicholas1022/mouse_tracking # clone
cd mouse_tracking
pip install -r requirements.txt # install
Inference with detect.py
detect.py
runs inference on a variety of sources and saving results to runs/detect
.
python detect.py --source 0 # webcam
img.jpg # image
vid.mp4 # video
path/ # directory
path/*.jpg # glob
'https://youtu.be/Zgi9g1ksQHc' # YouTube
'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream
detect.py
accepts a series of parameters:
--skip-frame: skip inference of video frames. 10 = infer one-tenth frames, 2 = infer half frames. 1 = no skip
--real-time: real-time playback if --view-img parameter is set
Refer YOLOv5 Doc for other parameters