Smorodov / Multitarget-tracker

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

Include new object detector for line crossing detection #235

Open GivralNguyen opened 4 years ago

GivralNguyen commented 4 years ago

Hi. As far as i concern, the car counting model only supports YoloV4 Darknet. Is there any plan to support other models( for example, mobilenetV2? ).This is not a bug, only a feature request

Nuzhny007 commented 4 years ago

Hi! It supports not only YoloV4, but the any YOLO with Darknet. And I can add:

  1. YOLO with TensorRT.
  2. Any another network with opencv_dnn or opencv_cuda_dnn backend. It's will be OK for you?
GivralNguyen commented 4 years ago

Can you add support for opencv_dnn and opencv-cuda-dnn based networks? I want to use tensorflow graph with opencv_dnn. Best regards and much appreciation for your work

Vào 17:21, Th 2, 6 thg 7, 2020 Sergey Nuzhny notifications@github.com đã viết:

Hi! It supports not only YoloV4, but the any YOLO with Darknet. And I can add:

  1. YOLO with TensorRT.
  2. Any another network with opencv_dnn or opencv_cuda_dnn backend. It's will be OK for you?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Smorodov/Multitarget-tracker/issues/235#issuecomment-654148113, or unsubscribe https://github.com/notifications/unsubscribe-auth/APMKX2TRQT7UPLUEFTSDIHTR2GQSLANCNFSM4ORGQMEA .

Nuzhny007 commented 4 years ago

OK, I'll do it

GivralNguyen commented 4 years ago

Also , i can use different types of trackers for car counting right ? How can i modify which type of tracker that i use?

Vào 15:34, Th 4, 8 thg 7, 2020 Sergey Nuzhny notifications@github.com đã viết:

OK, I'll do it

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Smorodov/Multitarget-tracker/issues/235#issuecomment-655375400, or unsubscribe https://github.com/notifications/unsubscribe-auth/APMKX2RCTPXUM7AA5J7HEE3R2QVQZANCNFSM4ORGQMEA .

Nuzhny007 commented 4 years ago

Hi! opencv_dnn now works: https://github.com/Smorodov/Multitarget-tracker/pull/236 See you case 8 in wiki: https://github.com/Smorodov/Multitarget-tracker/wiki/Run-examples So you can set -inf=ocvdnn and model.

Another parameters you can set in sources: https://github.com/Smorodov/Multitarget-tracker/blob/master/cars_counting/CarsCounting.cpp#L334 Tracker parameters: https://github.com/Smorodov/Multitarget-tracker/blob/master/cars_counting/CarsCounting.cpp#L391

GivralNguyen commented 4 years ago

Thanks a lot for your work However in this update opencvdnn can only work for YOLO right? What if i want to use Tensorflow Graph (pb and pbtxt file) with OpenCVdnn?

Vào Th 6, 10 thg 7, 2020 vào lúc 12:22 Sergey Nuzhny < notifications@github.com> đã viết:

Hi! opencv_dnn now works: #236 https://github.com/Smorodov/Multitarget-tracker/pull/236 See you case 8 in wiki: https://github.com/Smorodov/Multitarget-tracker/wiki/Run-examples So you can set -inf=ocvdnn and model.

Another parameters you can set in sources: https://github.com/Smorodov/Multitarget-tracker/blob/master/cars_counting/CarsCounting.cpp#L334 Tracker parameters: https://github.com/Smorodov/Multitarget-tracker/blob/master/cars_counting/CarsCounting.cpp#L391

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Smorodov/Multitarget-tracker/issues/235#issuecomment-656489085, or unsubscribe https://github.com/notifications/unsubscribe-auth/APMKX2UW4FQOUCCBD2J32PLR22QPVANCNFSM4ORGQMEA .

Nuzhny007 commented 4 years ago

Not only. I'm testing with caffe network: MobileNetSSD_deploy.caffemodel and MobileNetSSD_deploy.prototxt You can find it here: https://github.com/Smorodov/Multitarget-tracker/tree/master/data

GivralNguyen commented 4 years ago

Is there any plan to add support for tensorflow graph file ?

Vào 15:16, Th 6, 10 thg 7, 2020 Sergey Nuzhny notifications@github.com đã viết:

Not only. I'm testing with caffe network: MobileNetSSD_deploy.caffemodel and MobileNetSSD_deploy.prototxt You can find it here: https://github.com/Smorodov/Multitarget-tracker/tree/master/data

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Smorodov/Multitarget-tracker/issues/235#issuecomment-656549414, or unsubscribe https://github.com/notifications/unsubscribe-auth/APMKX2SWEBQRL5TGQD3A5BTR23E5VANCNFSM4ORGQMEA .

GivralNguyen commented 4 years ago

For example to use opencv dnn to read from tensorflow graph file:

cvNet = cv2.dnn.readNetFromTensorflow('graph.pb', 'graph.pbtxt')

Vào 12:22, Th 6, 10 thg 7, 2020 Sergey Nuzhny notifications@github.com đã viết:

Hi! opencv_dnn now works: #236 https://github.com/Smorodov/Multitarget-tracker/pull/236 See you case 8 in wiki: https://github.com/Smorodov/Multitarget-tracker/wiki/Run-examples So you can set -inf=ocvdnn and model.

Another parameters you can set in sources: https://github.com/Smorodov/Multitarget-tracker/blob/master/cars_counting/CarsCounting.cpp#L334 Tracker parameters: https://github.com/Smorodov/Multitarget-tracker/blob/master/cars_counting/CarsCounting.cpp#L391

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Smorodov/Multitarget-tracker/issues/235#issuecomment-656489085, or unsubscribe https://github.com/notifications/unsubscribe-auth/APMKX2UW4FQOUCCBD2J32PLR22QPVANCNFSM4ORGQMEA .

Nuzhny007 commented 4 years ago

TensorFlow models must work now. Do you try it?

GivralNguyen commented 4 years ago

How can i load tensorflow model ? I can only see parameters for yolo weights and configs

Nuzhny007 commented 4 years ago

Not only YOLO - any model. I'm using the main function for reading net: m_net = cv::dnn::readNet(modelConfiguration->second, modelBinary->second, "");

This function inside calls readNetFromTensorFlow if use set a pb model: https://github.com/opencv/opencv/blob/master/modules/dnn/src/dnn.cpp#L5288

Try example with your model.

GivralNguyen commented 4 years ago

Can you give me a clear car counting run example using tensorflow pb model? Thanks a lot!

GivralNguyen commented 4 years ago

Also another run example using using pytorch .pth models would be appreciated

Nuzhny007 commented 4 years ago

Model MobileNet SSD here: https://github.com/opencv/opencv/wiki/TensorFlow-Object-Detection-API Command line: CarsCounting.exe "london_road.mp4" -c="../../data/ssd_mobilenet_v2_coco_2018_03_29\ssd_mobilenet_v2_coco_2018_03_29.pbtxt" -w="../../data/ssd_mobilenet_v2_coco_2018_03_29\frozen_inference_graph.pb" -n="../../data/coco.names" -inf=ocvdnn

GivralNguyen commented 4 years ago

Thanks a lot for your patience , i finally got it to run. Last question (pardon me If i ask a lot) , can the car couting example load model from pytorch .pth file?( Using readnetfromtorch) , and if so , can you give me a run example? . If cannot , is it possible to add support for it ?

Nuzhny007 commented 4 years ago

Theoretically, pytorch models are supported with OpenCV. And I just call functions from opencv_dnn. So if OpenCV support your model then and CarCounting will works with it. I don't have installed PyTorch and any model for objects detection