DanaHan / Yolov5-in-Deepstream-5.0

Describe how to use yolov5 in Deepstream 5.0
209 stars 57 forks source link

Does this repository compatible with yolov5 V3? #9

Open luvwinnie opened 3 years ago

luvwinnie commented 3 years ago

Seems like the yolov5 has released a V3 version, does this repository compatible with it?

zineos commented 3 years ago

I just try, and it work.

luvwinnie commented 3 years ago

@zineos THank you for confirming... Just one thing is that, if I use custom model. the thing we should modified is only the number of class? Because my custom seems like getting a lot of bounding boxes when using with deepstream.

zineos commented 3 years ago

Are you replacing yololayer.cu and hardswish.cu file in tensorrtx/yolov5 ?

luvwinnie commented 3 years ago

@zineos yes I have replace the hardswish.cu and yololayer.cu in tensorrtx/yolov5. I tested my model with the yolov5 detect.py seems like the model perform very well for example detecting person, it didn't show multiple box in same image. However, I got multiple boxes after converting to Deepstream app. The detect.py use the model and half to 16fp model, and my deepstream config also using the FP16 optimization so suppose they have almost same result but it didn't.

luvwinnie commented 3 years ago

If I use a custom model any parameter i should change?

zineos commented 3 years ago

For now, I have no idea

luvwinnie commented 3 years ago

@zineos Thank you for help, I would like to find the problem and report here.

luvwinnie commented 3 years ago

@zineos The tensorrtx seems like remove the hardswish for V3, maybe this is the problem/

a commit in tensorrtx

yolov5 hswish plugin replaced by x*hsigmoid 4980365 wang-xinyu wangxinyu_es@163.com 2020/09/10 20:43

KevinZhanggg commented 3 years ago

@luvwinnie Hi, Have you solved the issue about having a lot of bboxes. I am trying to make it work with yolov5 4.0

luvwinnie commented 3 years ago

@KevinZhanggg This repository i think it need to use yolov5 version 2.0 or version 3.0/3.1 instead of version 4.0. Because it seems like the yolov5 changed some layers in the latest version.

Everytime the yolov5 updated the cuda layer in this repository need to be updated.

Btw, i haven't tested with version4.0 but use the version 3.0 instead.

KevinZhanggg commented 3 years ago

@luvwinnie yeah You are definitely right. It seems like some files have to be changed for yolov5 4.0.

KevinZhanggg commented 3 years ago

@luvwinnie Did you solve multiple bbox issue when you implement yolov5 3.0 ? I have the same error.

wxthss82 commented 3 years ago

@KevinZhanggg This repository i think it need to use yolov5 version 2.0 or version 3.0/3.1 instead of version 4.0. Because it seems like the yolov5 changed some layers in the latest version.

Everytime the yolov5 updated the cuda layer in this repository need to be updated.

Btw, i haven't tested with version4.0 but use the version 3.0 instead.

@luvwinnie Thank you for your information. I have some questions which I want to share with you.

  1. We can use tensorrtx to convert to yolov5 v3 or v4 engine, both can predict correctly. When we execute: export LD_PRELOAD=/root/tensorrtx/yolov5/build_v4/libmyplugins.so ; sudo ./yolov5 -d ../samples. I think yolov5 related layers info exists in libmyplugins.so.
  2. I compare the preprocess func in v3 with v4, it seems the same.
  3. So I think if I use corrensponding v3 or v4 libmyplugins.so, we can use deepstream-app to get the same result, but failed.

Could you give me a hand? Thanks!

luvwinnie commented 3 years ago

@KevinZhanggg I'm not sure what was the problem however i retrained my model then the multiple boxes gone. of course you need to tune the NUM_CLASSES and also the class and nms confidence to make it work with your custom model. The most stable one is the model trained with evolved yaml file.

@wxthss82 What do you mean "So I think if I use corrensponding v3 or v4 libmyplugins.so, we can use deepstream-app to get the same result, but failed." ?

wxthss82 commented 3 years ago

@luvwinnie I mean that if I use yolov5l v3 version of libmyplugins.so, I can use deepstream-app and get the correct result. But when I use yolov5l v4 version of libmyplugins.so, I get many boxes in deepstream-app.

luvwinnie commented 3 years ago

@wxthss82 Yes that is expeceted because the yolov5 v4 seems like changed the layers compare to v3, this repo only compatible until v3 of yolov5. It need to change write the tensorrtx layer to make it compatible with latest yolov5

Take a look with this tensorrtx that what changed in v4 of yolov5

constantinfite commented 3 years ago

Hi, I have the same problem with yolov5-v.3, I run deepstream on 2 camera but I have multiple bounding boxes in the preview window. I didn't change the parse-bbox-func-name. Also I didn't replace the file yololayer.cu and hardswish.cu file in tensorrtx/yolov5 because when I runthe command make in the directory build it causes a error.

Can you tell me how to solve this issue please ? Thanks !