Closed Russell565 closed 3 years ago
You can use the detector API from FastMOT to do so. https://github.com/GeekAlexis/FastMOT/blob/c1cd264d94e19a69d70716122b40be383871026c/fastmot/detector.py#L22-L42
A simple example:
import fastmot
config = {
"model": "YOLOv4",
"class_ids": [1],
"conf_thresh": 0.25,
"max_area": 800000,
"nms_thresh": 0.5
}
detector = fastmot.detector.YOLODetector((1280, 720), config)
img = cv2.imread(...)
detections = detector(img)
@GeekAlexis thank you for your help!
I also want to know about std_factor_acc
、 std_offset_acc
、max_age
and iou_thresh
in multi_tracker
of mot.json.Please help me to explain these args.
Recently, I have two problems
Sometimes, the same person has two detection boxes. The original detection frame appears at the position of the previous frame, and the new detection frame appears at the present position
Sometimes there's a "blink" in the picture, and then the detectionbox and Reid were changed
It bothers me. Do you have any idea?
You can see these mp4. https://drive.google.com/drive/folders/1dlFEnnNVgQ5MQ3VVb3U5_rxW30_pZfgY?usp=sharing
1、In the begining, the track id of box is 1. Sometime, when the person walking, the box stop at the previous position.But the person has moved to next position. And it will creat a new box on the person, and then these boxes will disappear
2、I think,the blink is because the light changes.But when it happened,i lost the track id .Maybe i should increase the max_age
?
You may also want to lower iou_thresh
such that the next detection can be associated with the track more easily:
https://github.com/GeekAlexis/FastMOT/blob/2851316a2d8c87923bd9a2e58c55e24676558288/cfg/mot.json#L46
inlier_thresh
so motion estimation is less likely to fail:
https://github.com/GeekAlexis/FastMOT/blob/faf36a8e51d36ebee9817ed1006c3f6881bcbde6/cfg/mot.json#L72
If it doesn't work, you can delete the following lines:
https://github.com/GeekAlexis/FastMOT/blob/faf36a8e51d36ebee9817ed1006c3f6881bcbde6/fastmot/tracker.py#L102-L104Hope it helps.
I try to increase the std_factor_acc
and std_offset_acc
, now i got two questions:
And i also changed the inlier_thresh, but the "blink" is not appear for now.
Keep in mind that the Kaman filter acceleration std (uncertainty) is determined by the following:
https://github.com/GeekAlexis/FastMOT/blob/faf36a8e51d36ebee9817ed1006c3f6881bcbde6/fastmot/kalman_filter.py#L250-L251
There is no limit but generally, I probably won't increase the slope std_factor_acc
to 200. Maybe 10x more is enough. The offset can be arbitrary. All units are in pixels.
To help me better understand the issue, can you turn on verbose drawing -v
option when running app.py
and show me the results again? This will show optical flow matches.
https://drive.google.com/drive/folders/1Lgmq_VTdk4GyqVXbLPfJR8TB6r-x7_uc?usp=sharing
In the indoor environment, I simulated the situation by jumping 、moving and turning. You can view it frame by frame through VLC. The red boxes is created by yolo, i change the color. I will learn about the Kaman filter and keep on change parameters.
How did you set detector_frame_skip
? YOLO seems to detect at every frame. Can you briefly tell me what other changes you made.
If you are tracking objects really up close, you definitely need to change std_factor_acc
and std_offset_acc
to large values. The default config is not designed for that. Also make sure you set camera frame rate correctly in the config. You can lower these parameters a bit too:
https://github.com/GeekAlexis/FastMOT/blob/faf36a8e51d36ebee9817ed1006c3f6881bcbde6/cfg/mot.json#L54-L55
https://drive.google.com/drive/folders/1Lgmq_VTdk4GyqVXbLPfJR8TB6r-x7_uc?usp=sharing This URL contains my latest mot.json.
The overall process of code has not changed, but it only changes some other things, such as the content displayed in the screen.
detector_frame_skip
is 5;
In yolo, conf_thresh
is 0.12 and nms_thresh
is 0.44;
In multi_tracker, max_age
is 9 and iou_thresh
is 0.1;
The distance between the camera and the person is about 1-3 meters. In kalman_filter, std_factor_acc
is 105.25 and std_offset_acc
is 208.5. is it enough?;
In flow, inlier_thresh
is 3.
If detector_frame_skip
is 5, why does the red bounding box appear at every frame and it's not associated to any track?
Oh! My fault, forgot to delete my test code. I will delete it and try again
It seems better now. Today is raining, i will find another day to do more test in outdoor enviroment, and i will tell you the result.
Thanks for your help
I think i can close this issue now. Thanks a lot !
I want to detect only one picture and return the coordinates of the detection frame. How can I achieve it?