An implementation of target tracking and distance measurement based on dataset from SAIC.
Before start, CUDA v10.0 and Cudnn v7.4 are required.
Then install other requirements:
pip3 install -r ./docs/requirements.txt
dog/cat dataset provided by SAIC are supposed to be downloaded to ./data/dataset/dogcat/image/
Then produce labels from xml files
python dataprep_xml2txt.py
or you may just use your own dataset with proper label extraction.
download YOLOV3 pre-trained model trained on coco for transfer learning
cd weights
wget https://pjreddie.com/media/files/yolov3.weights
cd ..
python detection_train.py
It's also possible to train from scratch if following configuration is changed in ./core/config.py
__C.TRAIN.TRAINING_FROM_SCRATCH = False
python detection_test.py # Detection images are saved in `./data/detection`
The dog & cat are detected and the distance is shown on the boundingboxes
Then the model can be evaluated with
python mAP/result.py # evaluation results are saved in `./mAP`
For tracking the movement of cat & dog
python tracking.py # Tracking images are saved in `./data/tracking/image`
To tracking cat & dog in video, just do following configuration in ./core/config.py
__C.TRACKING.INPUT_TYPE = "video"
Then the tracking images and video are saved in ./data/tracking/video
This work is builded on many excellence works, which including
- YunYang1994's yolov3 on tensorflow2.0
- mattzheng's keras-yolov3-KF-objectTracking
- Both repositories are referred to darknet either directly or indirectly.