The goal of this project would be movement classification of people, in other words, walking (normal and fast) and running.
Yolov4 will be used for detection.
You only look once (YOLO) is a state-of-the-art, real-time object detection system.
Currently the most advanced YOLO version is YOLOv4 which provides optimal speed and accuracy for object detection, therefore it will be used.
Before starting, usage of a virtual environment is advised via the venv
module:
$ python3 -m venv envname # to create the virtual env
$ source envname/bin/activate # activate it
$ deactivate # when done
For ease of use, the yolov4
Python module was used, which is a YOLOv4 implementation in TensorFlow 2.
For further documentation refer to the project wiki
To install yolov4
:
Dependencies:
$ python3 -m pip install opencv-python tensorflow
Note: If TensorFlow Lite needs to be used, refer to the project wiki for further instructions.
TensorFlow YOLOv4:
$ python3 -m pip install yolov4
Download the yolov4-tiny
and yolov4
weights to the weights/
directory from the project wiki weights download section.
Test yolov4
with the provided default test image. Change model config, weights based on the one used (default is yolov4-tiny
).
$ python3 test.py
KACAVIS runaway_walk_1.mp4 frame 1471 was used:
YOLOv4 | YOLOv4-tiny |
---|---|
>>> from yolov4.tf import YOLOv4
>>> help(YOLOv4)
SORT is a barebones implementation of a visual multiple object tracking framework based on rudimentary data association and state estimation techniques. It is designed for online tracking applications where only past and current frames are available and the method produces object identities on the fly.
While this minimalistic tracker doesn't handle occlusion or re-entering objects its purpose is to serve as a baseline and testbed for the development of future trackers.
To install SORT
:
Dependencies:
$ python3 -m pip install filterpy scikit-image lap
SORT:
mkdir tracking
cd tracking
$ git clone https://github.com/abewley/sort
from tracking.sort import *
#create instance of SORT
mot_tracker = Sort()
# get detections
...
# update SORT
track_bbs_ids = mot_tracker.update(detections)
# track_bbs_ids is a np array where each row contains a valid bounding box and track_id (last column)
...
Download the dataset:
wget -O dataset/crowd_simulation_dataset.zip http://kacavis.zemris.fer.hr/datasets/Crowd_simulation_dataset_videos.zip
To get the used module versions, in other words $ python3 -m pip freeze
, take a look at:
./pip_freeze.txt
Tested on Archlinux 5.12.x-arch1-1
, python version Python 3.9.5
If working on Arch change python3
to python
everywhere.