Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run ByteTrack with yolov5 instead of yolox #99

Closed
tungdop2 opened this issue Dec 4, 2021 · 41 comments
Closed

run ByteTrack with yolov5 instead of yolox #99

tungdop2 opened this issue Dec 4, 2021 · 41 comments

Comments

@tungdop2
Copy link

tungdop2 commented Dec 4, 2021

how I can run train.py with yolov5 pretrained weights from its model zoo instead of yolox?

@tungdop2 tungdop2 changed the title run with yolov5 instead of yolox run ByteTrack with yolov5 instead of yolox Dec 4, 2021
@gmt710
Copy link

gmt710 commented Dec 6, 2021

Hi, any process?

@tungdop2 tungdop2 closed this as completed Dec 6, 2021
@tungdop2
Copy link
Author

tungdop2 commented Dec 6, 2021

Yes, I load yolo5s from torch hub and put its detection to ByteTrack update function, seems it works.

@tungdop2 tungdop2 reopened this Dec 6, 2021
@gmt710
Copy link

gmt710 commented Dec 6, 2021

@tungdop2 , I submitted a PR. #101

@tungdop2
Copy link
Author

tungdop2 commented Dec 6, 2021

@gmt710 thank you so much.
But how to pt yolov5s into a folder and load it, instead of attemp_load in your init

    def init_det(weights):  
    # Load model  

    model = attempt_load(weights, map_location=device)  # load FP32 model  

    # model = torch.load(weights, map_location=device)[ 'model'].float()  # load to FP32  

    model.to(device).eval()  

    return mode

@gmt710
Copy link

gmt710 commented Dec 6, 2021

this can load the weight from the folder.

@tungdop2
Copy link
Author

tungdop2 commented Dec 6, 2021

@gmt710 oh sorry, you pass attemp_download

@gmt710
Copy link

gmt710 commented Dec 6, 2021

okay, you can comment it -- attemp_download.

@tungdop2
Copy link
Author

tungdop2 commented Dec 6, 2021

@gmt710 why i get this error
AttributeError: Can't get attribute 'SPPF' on <module 'models.common' from '/content/ByteTrack_clone/tools_yolov5/models/common.py'>
I download yolov5s from v6 and v4 to tools_yolov5 folder, both return this error

@gmt710
Copy link

gmt710 commented Dec 7, 2021

What command ? My yolov5s' project is v4.

@gmt710
Copy link

gmt710 commented Dec 7, 2021

ultralytics/yolov5#5175, you can refer this, okay?

@tungdop2
Copy link
Author

tungdop2 commented Dec 7, 2021

@gmt710 yeah I fix it by using the latest yolov5 version, but now I get new problems:

  1. I try 2 versions, 1 is your way
    model = attempt_load(weights, map_location=device)
    and 1 is use torch.hub
    model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True)
    The second way run much faster, why?
  2. I run code in MOT17 datasets, the result is always bad in the first folder (MOT17-02-FRCNN), but it becomes better from the following folders.

I'm not sure about these 2 problems, can you explain why? You can check my clone here, which I modify your code a little bit.

@gmt710
Copy link

gmt710 commented Dec 7, 2021

Haha, I don't clearly know about this.
Can my pr code work fine ?
If I am free, I'll check, ok?

@tungdop2
Copy link
Author

tungdop2 commented Dec 7, 2021

Thank you, your code work, help me a lot, and I change it to version 6. The problem is, I think the model needs to warm up. Do you know how to do this?

@gmt710
Copy link

gmt710 commented Dec 8, 2021

you can search the difference between torch.load and torch.hub.load ?

@tungdop2
Copy link
Author

tungdop2 commented Dec 9, 2021

@gmt710 got a minute? I try at MOT17 with these weights, but the result is so bad? I really don't know why, because the detections seem to work well.

@gmt710
Copy link

gmt710 commented Dec 10, 2021

@tungdop2
Can you show your detect result and track result?

@tungdop2
Copy link
Author

@gmt710 you can check it here. My clone here, as I say, the detections seem to work well, but the result is so bad.

@gmt710
Copy link

gmt710 commented Dec 13, 2021

@tungdop2 , Okay, Next I will check this. Thanks.

@gmt710
Copy link

gmt710 commented Dec 14, 2021

@tungdop2 I‘ve checked, I think maybe you need check my code, ok? your setting and inference code is not the same as me.
My result can track normally, but not good as the author's result. The authot train the model on MOT pedes datasets, but I use the pretrained model on voc datasets.

@nguyencongphuchust
Copy link

Hi all, I completed run byte track with yolov5 in python. I want to deploy (byte track + yolov5) in tensorrt. I convert yolov5 to tensorrt from guide of repo yolov5 to get file .engine. After that, I update shape input in bytetrack.cpp same with input my model (640, 640). And I build and run follow guide, replace path yolox.engine file to my yolov5s.engine file. But I get error "[pluginV2Runner.cpp::load::290] Error Code 1: Serialization (Serialization assertion creator failed.Cannot deserialize plugin since corresponding IPluginCreator not found in Plugin Registry)"
I also do follow your guide, used torch2trt to convert my weight yolov5s to tensorrt, by I also get error: assert dtype == t.dtype # , 'Tensor data types must match'). Inspite I set shape inout model correct with my model.
I really don't know why. Do you know how to fix this? Thanks you!

Error when I deploy with my file engine yolov5 (I convert follow guide repo yolov5):
image

Error when I conver yolov5 by torch2trt:
image

@nemonameless
Copy link

nemonameless commented Jan 9, 2022

@gmt710
@tungdop2
Any results about yolov5-bytetracker MOTA of MOT17 dataset?

@gmt710
Copy link

gmt710 commented Jan 10, 2022

you need train a model for pedetrian detection.

@gmt710
Copy link

gmt710 commented Jan 12, 2022

This conclusion is too easy to give .you need train pedetrian datasets.

@nemonameless
Copy link

nemonameless commented Jan 12, 2022

@nemonameless yeah, you can check it here https://github.com/tungdop2/ByteTrack_clone. The result with these weights https://drive.google.com/file/d/1gglIwqxaH2iTvy6lZlXuAcMpd_U0GCUb/view is worse than yolox. Demo MOT17 here https://drive.google.com/drive/folders/15zMB-ouIQwI3hYKIm-co-uqgmAYFQEjh?usp=sharing

so where is your MOTA results of yolov5-bytetracker ???

@tungdop2
Copy link
Author

@nemonameless here https://drive.google.com/drive/u/1/folders/1kYx9ZoCTTPuthYKoy1ZT-INPowpldOiX

@NguyenCongPhucBKHN
Copy link

NguyenCongPhucBKHN commented Jan 13, 2022

Have any one deploy bytetrack with yolov5 in tensorrt ? Can you help me? Thanks you

@hyeonmin11
Copy link

ultralytics/yolov5#5175, you can refer this, okay?

Hi I have question about your yolov5-bytetracker code.
To train custom data with your yolov5-bytetracker code, What my dataset format should be? Yolo or CoCo format?
Thanks.

@hyeonmin11
Copy link

@gmt710
Hi I have question about your yolov5-bytetracker code.
To train custom data with your yolov5-bytetracker code, What my dataset format should be? Yolo or CoCo format?
Thanks.

@gmt710
Copy link

gmt710 commented Jan 24, 2022

@hyeonmin11
Copy link

@gmt710
Glad to see your blog.. but I can't read chinese. Are there major changes from original ByteTrack(yolox bytetrack)? e.g hyp..
#5
In this issue, Tetsujinfr tuned low boundary confidence score to fit other detector, and also did sth many as you can see in last comment.
Did you also do those kinds of editing process to run ByteTrack with yolov5?

@gmt710
Copy link

gmt710 commented Feb 14, 2022

@hyeonmin11 , If you want to train yolov5-bytetrack, you only need to train yolov5 on your own datasets. The blog include the steps. if you can find any other blog for yolov5 training, it is suitable for you.

I revised a few places that are difficult to explain in a few sentences.

@NeoYY
Copy link

NeoYY commented Mar 10, 2022

@gmt710

I have a couple of questions after I read your code... If you can help me to figure these out that will be nice.
Is it true that the training for the original repo and your repo is actually training the YOLO detection model instead of the detector + tracker?
So you haven't really changed anything for the training process because you are assuming the yolov5 weights are pretrained based on the MOT dataset?
In such a circumstance can we draw a conclusion that we don't need to train the tracker at all?

Thanks!

@gmt710
Copy link

gmt710 commented Mar 10, 2022

yes, you only need train yolov5 on your detection datasets.

@Camilochiang
Copy link

Hei @gmt710 . Which Speed did you reach using YOLOv5 and your implementation? Also, in which hardware?

@gmt710
Copy link

gmt710 commented Mar 25, 2022

I haven't tested the speed . you can test it yourself.

@moonsh
Copy link

moonsh commented Apr 6, 2022

@gmt710 Just wonder any reason for training Yolov5 instead YoloX ?

@NeoYY
Copy link

NeoYY commented Apr 6, 2022

@gmt710 Just wonder any reason for training Yolov5 instead YoloX ?

Yolov5s can provide a faster runtime speed.

@moonsh
Copy link

moonsh commented Apr 6, 2022

@NeoYY I see. But Yolox provides higher accuracy than Yolov5 ?

@NeoYY
Copy link

NeoYY commented Apr 6, 2022

@NeoYY I see. But Yolox provides higher accuracy than Yolov5 ?

That's right, since the performance of tracker heavily relying on detector. And as we know YoloX is much better than yolo5.

@harryc7
Copy link

harryc7 commented Jun 30, 2022

how can i solve this error?
AttributeError: 'collections.OrderedDict' object has no attribute 'float'

@mikel-brostrom
Copy link

mikel-brostrom commented Oct 28, 2022

Here you have a Yolov5+ByteTrack implementation:

https://github.com/mikel-brostrom/Yolov5_StrongSORT_OSNet

Switch tracking method by:

python track.py --tracking-method bytetrack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests