Code Monkey home page Code Monkey logo

Comments (3)

gau-nernst avatar gau-nernst commented on June 29, 2024 1

Hello,

It seems that you have matched the wrong weight names.

C3 layer in the official repo (link) is the same as CSPDarknetStage layer in my implementation (link). cv3 corresponds to out_conv, not conv1.

The correct mapping would be

  • conv -> separate conv layer
  • conv1 -> cv2
  • conv2 -> cv1
  • blocks -> m
  • out_conv -> cv3

Maybe I can write a script to convert the weights since some people have requested it before. I will update it here.

from vision-toolbox.

gau-nernst avatar gau-nernst commented on June 29, 2024

Hello,

When I implemented YOLOv5, I checked the total number of parameters in my implementation against the official models, and they were the same. So I was quite confident that the implementation is correct.

I think there are two possible scenarios:

  1. YOLOv5 changes its architecture some time after I implemented mine.
  2. You match the wrong weight names from my implementation to the official one. The naming and order of the weights can be very different. I recommend you to use Netron to inspect the model architecture to make sure you map the correct weights. You can also dig into the source code.

I will check on the two possible reasons above when I have some time.

Cheers!

from vision-toolbox.

gau-nernst avatar gau-nernst commented on June 29, 2024

Hello @AlonZolfi,

I have added the script to convert YOLOv5 backbone weights.

python scripts/convert_yolov5_weights.py {weights_from_this_repo.pth} {save_path.pth}

Here are the notes I added to my README

The weights will be renamed to be compatiable with Ultralytics' repo. Note that the converted .pth file only contains the renamed state dict, up to model.8 (the backbone part, without the SPPF layer). You will need to modify their train script to treat the loaded file as a state dict, instead of a dictionary with key model containing the model object.

I haven't tested training a full YOLOv5 object detector with the converted weights, so this function is not guaranteed to work correctly.

I'm not familiar with the YOLOv5 codebase. You can help me test if the converted weights work correctly with the official YOLOv5 repo.

Cheers!

from vision-toolbox.

Related Issues (8)

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.