macrobomaster / cv-yolov7

Custom yolov7 model with opencv
GNU General Public License v3.0
5 stars 3 forks source link

Investigate Algorithm for movement prediction #7

Closed Bill-Haoyu-Lin closed 1 year ago

Bill-Haoyu-Lin commented 1 year ago

Since we have the model for object detection, but it has some delay due to processing time. We need to find some prediction Algorithm to compromise it.

Allen-ENGI commented 1 year ago

After doing some research, Kalman Filter might be the optimal option for now. There is a paper including Kalman Filter I attached to the post, feel free to read it, and maybe we can find a time to discuss it together. I am still trying to fully understand the basic concepts.

I also find the code of Kalman Filter from pysource.com. It's a common function under the OpenCV library that many people have used so far. I think we can just apply this Kalman function with our Yolo detection to predict the movement. The only problem I feel like is that the Kalman Filter may require some primary coordinates for prediction. There are still adjustments to be done if we require this. The other application is that we may predict the trace of the enemy robot for a small amount of time, this is a function that Kalman filter can accomplish by setting a for loop, not sure if this would be super helpful during the competition though.

Object_tracking_with_movement_prediction_algorithms.pdf

Allen-ENGI commented 1 year ago

kalmanfilter.zip Here is the function code. The input would be the current position (x,y), and the output is the predicted location (x,y)

Bill-Haoyu-Lin commented 1 year ago

Do you have a sample that we can take a look? And can you put code in a Pull request with description, testing, and result under comment please, thanks.

Bill-Haoyu-Lin commented 1 year ago

Related PR : https://github.com/macrobomaster/cv-yolov7/pull/13

nalagind commented 1 year ago

I found this great article a while ago explaining the basic kalman filter theory: https://drive.google.com/file/d/1nVtDUrfcBN9zwKlGuAclK-F8Gnf2M_to/view?usp=sharing

Bill-Haoyu-Lin commented 1 year ago

21

Allen-ENGI commented 1 year ago

The algorithm works well for object prediction.