Objects detection in the first frame and Tracking special object by SiamRPN.
This repo illustrates a automatic detection and tracking of single object. In the process, It first detects all the objects in the first frame of input videos. Next, we should input a examplar image and it can determine the initial position of the target that is most similar to the examplar image. Finally the tracker could finish the single object tracking.
- demo.py -- implements the detection, identify and tracking pipeline.
detection folder
-- Faster RCNN detectionidentify folder
-- phash to identify tracking objectvideos folder
-- videos needed to handle- examplar.png -- a snapshot of object to track
It use Faster RCNN to finish object detection. This code was based on longcw's repo longcw/faster_rcnn_pytorch. It will be improved according to the latest papers.
It use phash to identify a special object.I will add Siamese Net and traditional Digital image processing to do it in the future.
It use SiamRPN to finish object tracking. The codes was based on huanglianghua/siamrpn-pytorch. It will be improved according to the latest papers(DSiamRPN).
- Python 3.6
- PyTorch 0.4.0 or higher
- CUDA 8.0 or higher
In Detection stage. It will detects all cars in the first frame as shown below.
In Identify stage. We want to track the car as shown below. It could determine the initial position of the target based on Detection stage.
In Tracking stage. It will track the car.
- Clone the code:
git clone https://github.com/mj000001/Object-Detection-And-Tracking.git
- Create a folder:
cd Object-Detection-And-Tracking && mkdir pretrained
- Pretrained Model:
In the root directory of Object-Detection-And-Tracking
:Download the pretrained model.pth
and VGGnet_fast_rcnn_iter_70000
from Baidu Yun with extraction code gm4f and put the files under pretrained/
.
- Compilation:
Install python package
pip install -r requirements.txt
Build the Cython modules for nms and the roi_pooling layer
cd detection/faster_rcnn
./make.sh
- Run Demo:
python demo.py