Why to combine YOLO and Optical Flow?
- To compute only the optical flow of objects we look for.
- Reduce computational cost.
- Object detection in the actual frame using YOLO.
- Initialize a zero matrix with the same height and width as the frame.
- For each object that has been detected:
- Extract a patch corresponding to the object's bounding box in the frame.
- Compute optical flow between that patch and its corresponding one in the previous frame.
- Insert the computed optical flow in the matrix.
- Show the matrix that has been created.
- Python 3.6.
- YOLO [1] and Farneback [2] implementations in OpenCV 3.4.0.
- Numpy and imutils.
- Weights of YOLO Lite [3].
All the requirements are in the requirements.txt file.
pip install -r requirements.txt
pip install opencv-python
[1] You only look once: Unified, real-time object detection. J. Redmon, S. Divvala, R. Girshick, and A. Farhadi.
[2] Two-frame motion estimation based on polynomial expansion. G. Farnebäck.
[3] Yolo-lite: A real-time object detection algorithm optimized for non-gpu computers. R. Huang, J. Pedoeem, and C. Chen.
Great help from this Github repository: https://github.com/iArunava/YOLOv3-Object-Detection-with-OpenCV