Code Monkey home page Code Monkey logo

Comments (5)

flmello avatar flmello commented on May 24, 2024 2

Now I understand what is happening, and this comment is just to register the solution (thanks to @marcoslucianops).

In your config_infer_primary_yolo.txt, the model-engine-file always prevails over onnx-file. And in fact, despite my previous ignorance, it makes sense. The .engine file set by model-engine-file is built from the onnx-file, and the former is the one ran by Deepstream. Therefore, if .engine file exists, its is reasonable to Deepstream that it doesn't have to build it at all, just need to run it. I makes model loading pretty much faster and onnx-file is ignored.

from deepstream-yolo.

marcoslucianops avatar marcoslucianops commented on May 24, 2024

You need to remove the engine file and generate the new one for the custom model.

from deepstream-yolo.

flmello avatar flmello commented on May 24, 2024

OK, just in case I removed all engine files and generated a new one, but the problem persists.

Take a look at this extract from label files of yolov5s.pt and my custom model epi.pt

yolov5s.pt labels   epi.pt labels
person                    person
bicycle                   helmet
car                       suit
motorcycle                boot
airplane                  gloves
bus                       mask
train                     glasses
truck                     earplug
boat
.....

And this is what I obtain when exporting epi.pt to epi.onnx. The DeepStream-Yolo folder now contains just the epi.onnx and label.txt. This is what I get:

Screenshot from 2023-11-08 12-15-40
Clearly, it is using the original weights, the ones from yolov5s. For instance, it detects an object whose class are bicycles ("1") and by label file says it is helmet, or an object belonging to trucks ("7") and my label file says it is an earplug. It look like it is ignoring my training and using just the original weights from yolov5s.

When I trained my custom model (epi.pt) I made a transfer learning from yolov5s. This is what I did for training my custom model (epi.pt): python3 train.py --img 640 --batch 16 --epochs 1000 --data epi.yaml --weights yolov5s.pt --cache --save-period 10

And this is what my custom model epi.pt returns when I run: python3 ~/yolov5/detect.py --weights epi.pt --source tegra.mp4.

vlcsnap-2023-11-08-13h46m56s815

What's going wrong? Is the export script creating an incomplete onnx file?

from deepstream-yolo.

marcoslucianops avatar marcoslucianops commented on May 24, 2024

It's a very strange case, if you are using the correct onnx model and changing the labels.txt file, it should work without any issues.

from deepstream-yolo.

marcoslucianops avatar marcoslucianops commented on May 24, 2024

As I said, you need to take care about the engine file, because it could run the old file if you don't delete it, even changing the onnx model in the config_infer file.

from deepstream-yolo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.