Giter Club home page Giter Club logo

Comments (10)

ashwin-999 avatar ashwin-999 commented on June 19, 2024 1

I passed 'strict=False'

model = load_state_dict(path, strict=False)

from clrnet-onnxruntime-and-tensorrt-demo.

xuanandsix avatar xuanandsix commented on June 19, 2024

You did not successfully replace the clr_head.py file.
cp clr_head.py in this code to CLRNet/clrnet/models/heads/ in official code.

from clrnet-onnxruntime-and-tensorrt-demo.

sahamitul avatar sahamitul commented on June 19, 2024

Thanks @xuanandsix.

It seems to be the clr_head.py from this repo is being indeed loaded.
I am trying to debug now - then why I still get this crash, as you say I should not.
Meanwhile if you have more thoughts, let us know here.

from clrnet-onnxruntime-and-tensorrt-demo.

xuanandsix avatar xuanandsix commented on June 19, 2024

1、By 'pip list' check if the path to the 'clrnet' package is correct.
2、Or choose to replace the clr_head.py file first before running package install (i.e. 'python setup.py build develop').
If you need training source code, it is recommended to maintain training and deployment with two environments.

A log has been upload here https://github.com/xuanandsix/CLRNet-onnxruntime-and-tensorrt-demo/blob/main/my_log/test_onnx.log
My deployment process from scratch. You can view each step by search: ***@ai02

from clrnet-onnxruntime-and-tensorrt-demo.

sahamitul avatar sahamitul commented on June 19, 2024

Hi @xuanandsix, I notice:

In your example "python torch2onnx.py configs/clrnet/clr_resnet18_tusimple.py --load_from tusimple_r18.pth",
when I print the keys in "state_dict" from "https://github.com/xuanandsix/CLRNet-onnxruntime-and-tensorrt-demo/blob/main/torch2onnx.py#L22",
I do not see these:-
module.heads.sample_x_indexs
module.heads.prior_feat_ys
module.heads.prior_ys
module.heads.criterion.weight

But I have these when I load my trained model.

So maybe this is why you are not getting my crash that I list in this issue. What do you think?

from clrnet-onnxruntime-and-tensorrt-demo.

Yutong-gannis avatar Yutong-gannis commented on June 19, 2024

@sahamitul Have you solved this problem?

from clrnet-onnxruntime-and-tensorrt-demo.

mengxia1994 avatar mengxia1994 commented on June 19, 2024

same issues,any advices?

from clrnet-onnxruntime-and-tensorrt-demo.

Yutong-gannis avatar Yutong-gannis commented on June 19, 2024

@mengxia1994 maybe you can try other backbone. I met this problem when use resnet-18, but it worked when I use dla 34.

from clrnet-onnxruntime-and-tensorrt-demo.

LukeAI avatar LukeAI commented on June 19, 2024

I found that exporting seems to work ok if I use the pretraining weights provided by https://github.com/Turoad/clrnet but if I train my own network, I get this error, with both dla34-culane and resnet18-tusimple. Not sure what's different

from clrnet-onnxruntime-and-tensorrt-demo.

LukeAI avatar LukeAI commented on June 19, 2024

OK I got this working literally just by deleting the offending dict keys:

      del new_state_dict["heads.sample_x_indexs"]                                  
      del new_state_dict["heads.prior_feat_ys"]                                    
      del new_state_dict["heads.prior_ys"]                                         
      del new_state_dict["heads.criterion.weight

inserted just before

net.load_state_dict(new_state_dict)

Edit. probably better to do as @AshwinAKannan suggests with strict=False

    net.load_state_dict(new_state_dict, strict=False)

from clrnet-onnxruntime-and-tensorrt-demo.

Related Issues (13)

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.