Smorodov / Multitarget-tracker

Multiple Object Tracker, Based on Hungarian algorithm + Kalman filter.
Apache License 2.0
2.19k stars 651 forks source link

Yolov5 and YoloX #363

Open tiencong1599 opened 2 years ago

tiencong1599 commented 2 years ago

Hi, prof! I had used Yolov4 for this project in 4 months ago, and so far, there are many kind of released object detection such as YOLOv5 and YOLOX. So i am able to run these detector on this project for now, am i? Thanks for your support!

Nuzhny007 commented 2 years ago

Hi! YOLOv5 you can use with TensorRT backend. But if you have only PyTorch model than it need to convert it to cfg/weight format: https://github.com/enazoe/yolo-tensorrt/blob/TRT8/yolov5_tutorial.md . I'm using this models in one project. About YOLOX I don't know. And probably this models can work with opencv_dnn backend.

ksd777 commented 1 year ago

Hi, When I convert the weights according to instruction: https://github.com/enazoe/yolo-tensorrt/blob/TRT8/yolov5_tutorial.md, and load the generated cfg, and weights file, I do get following error: File does not exist : ../data/yolov5x-kFLOAT-batch1.engine Loading pre-trained weights... Invalid network type MultitargetTracker: /home/user/Documents/Multitarget-tracker/src/Detector/tensorrt_yolo/trt_utils.cpp:447: std::vector<float> LoadWeights(std::string): Assertion0' failed. Aborted (core dumped) `

Do I have to use any specific version of Yolov5? Currently I tried both 6.2 and 7.0. No success in both cases

Nuzhny007 commented 1 year ago

Hi! Show, plz, a command line for you case? May be some incompatible parameters

lalala233337 commented 1 year ago

Hi! Show, plz, a command line for you case? May be some incompatible parameters

Hi! When I use my own trained yolov5s result and convert them into .weights and .cfg, I truly get my .weights and .cfg with no errors. But when I use them into this project, I get the following errors. And I try to use the official yolov5s weight, convert them into .weights and use in this project, I get the same error. I don't know if it's error from how I convert the yolov5s or I have to do some changes in files of this project. In the convert file, I set high and width with both 320(which my video also is), and set classes with zero and 21(I do have 21 classes in my yolov5,because I'm not sure the meaning of this variable, I tried them both). And I have tried change coco.names with my own classifies, but got the same error. Did I use the convert file in a wrong way or I have to do some more changes in files of this project? Thanks for your help!

lalala233337 commented 1 year ago

Examples of the Multitarget tracking algorithm Usage: ./MultitargetTracker [--example]=<number of example 0..7> [--start_frame]= [--end_frame]= [--end_delay]= [--out]= [--show_logs]= [--async]= [--res]= [--settings]= [--batch_size=]

Press: 'm' key for change mode: play|pause. When video is paused you can press any key for get next frame.

Press Esc to exit from video

Usage: MultitargetTracker [params] 1

-a, --async (value:1)
    Use 2 theads for processing pipeline
--batch_size, --bs (value:1)
    Batch size - frames count for processing
-c, --config (value:../data/yolov5s.cfg)
    For CarsCounting: Config file of neural network: yolov4.cfg
--cvat_res
    Path to the xml file in cvat format with tracking result
-e, --example (value:7)
    number of example 0 - MouseTracking, 1 - MotionDetector, 2 - FaceDetector, 3 - PedestrianDetector, 4 - OpenCV dnn objects detector, 5 - YOLO Darknet detector, 6 - YOLO TensorRT Detector, 7 - Cars counting
--ed, --end_delay (value:0)
    Delay in milliseconds after video ending
--ef, --end_frame (value:0)
    Play a video to this position (if 0 then played to the end of file)
-g, --gpu (value:0)
    Use OpenCL acceleration
--gb, --geo_bind (value:geo_bind.ini)
    For CarsCounting: ini file with geographical binding
--heat_map, --hm (value:0)
    For CarsCounting: Draw heat map
--inf, --inference (value:darknet)
    For CarsCounting: Type of inference framework: darknet, ocvdnn
--log_res, -r
    Path to the csv file with tracking result
-n, --names (value:../data/coco.names)
    For CarsCounting: File with classes names: coco.names
-o, --out (value:cars_count_speed.mp4)
    Name of result video file
-s, --settings
    Path to the ini file with tracking settings
--sf, --start_frame (value:0)
    Start a video from this position
--show_logs, --sl (value:1)
    Show Trackers logs
-w, --weights (value:../data/best.weights)
    For CarsCounting: Weights of neural network: yolov4.weights
--wf, --write_n_frame (value:1)
    Write logs on each N frame: 1 for writing each frame

1 (value:../data/highway_adjust.mp4)
    movie file

OpenCL not used ParseTrackerSettings: ... ParseTrackerSettings: 0 Inference framework set darknet used 10, weights: ../data/best.weights, config: ../data/yolov5s.cfg, names: ../data/coco.names Video ../data/highway_adjust.mp4 was started from 0 frame with 41 fps, frame size [320 x 320] and length 24544 Used GPU 0 max_batches: Using default '0' learning_rate: Using default '0.001000' momentum: Using default '0.900000' decay: Using default '0.000100' subdivisions: Using default '1' policy: Using default 'constant' 0 : compute_capability = 750, cudnn_half = 0, GPU: NVIDIA GeForce GTX 1650 net.optimized_memory = 0 mini_batch = 1, batch = 1, time_steps = 1, train = 0 layer filters size/strd(dil) input output 0 Type not recognized: [Conv] Unused field: 'from = -1' Unused field: 'number = 1' Unused field: 'args = 64,6,2,2' 1 Type not recognized: [Conv] Unused field: 'from = -1' Unused field: 'number = 1' Unused field: 'args = 128,3,2' 2 Type not recognized: [C3] Unused field: 'from = -1' Unused field: 'number = 3' Unused field: 'args = 128' 3 Type not recognized: [Conv] Unused field: 'from = -1' Unused field: 'number = 1' Unused field: 'args = 256,3,2' 4 Type not recognized: [C3] Unused field: 'from = -1' Unused field: 'number = 6' Unused field: 'args = 256' 5 Type not recognized: [Conv] Unused field: 'from = -1' Unused field: 'number = 1' Unused field: 'args = 512,3,2' 6 Type not recognized: [C3] Unused field: 'from = -1' Unused field: 'number = 9' Unused field: 'args = 512' 7 Type not recognized: [Conv] Unused field: 'from = -1' Unused field: 'number = 1' Unused field: 'args = 1024,3,2' 8 Type not recognized: [C3] Unused field: 'from = -1' Unused field: 'number = 3' Unused field: 'args = 1024' 9 Type not recognized: [SPPF] Unused field: 'from = -1' Unused field: 'number = 1' Unused field: 'args = 1024,5' 10 Type not recognized: [Conv] Unused field: 'from = -1' Unused field: 'number = 1' Unused field: 'args = 512,1,1' 11 Type not recognized: [nn.Upsample] Unused field: 'from = -1' Unused field: 'number = 1' Unused field: 'args = 'None',2,'nearest'' 12 Type not recognized: [Concat] Unused field: 'from = -1,6' Unused field: 'number = 1' Unused field: 'args = 1' 13 Type not recognized: [C3] Unused field: 'from = -1' Unused field: 'number = 3' Unused field: 'args = 512,False' 14 Type not recognized: [Conv] Unused field: 'from = -1' Unused field: 'number = 1' Unused field: 'args = 256,1,1' 15 Type not recognized: [nn.Upsample] Unused field: 'from = -1' Unused field: 'number = 1' Unused field: 'args = 'None',2,'nearest'' 16 Type not recognized: [Concat] Unused field: 'from = -1,4' Unused field: 'number = 1' Unused field: 'args = 1' 17 Type not recognized: [C3] Unused field: 'from = -1' Unused field: 'number = 3' Unused field: 'args = 256,False' 18 Type not recognized: [Conv] Unused field: 'from = -1' Unused field: 'number = 1' Unused field: 'args = 256,3,2' 19 Type not recognized: [Concat] Unused field: 'from = -1,14' Unused field: 'number = 1' Unused field: 'args = 1' 20 Type not recognized: [C3] Unused field: 'from = -1' Unused field: 'number = 3' Unused field: 'args = 512,False' 21 Type not recognized: [Conv] Unused field: 'from = -1' Unused field: 'number = 1' Unused field: 'args = 512,3,2' 22 Type not recognized: [Concat] Unused field: 'from = -1,10' Unused field: 'number = 1' Unused field: 'args = 1' 23 Type not recognized: [C3] Unused field: 'from = -1' Unused field: 'number = 3' Unused field: 'args = 1024,False' 24 Type not recognized: [Detect] Unused field: 'from = 17,20,23' Unused field: 'number = 1' Unused field: 'args = 'nc','anchors'' Create CUDA-stream - 0 浮点数例外 (核心已转储)