Code Monkey home page Code Monkey logo

Comments (10)

rayguan97 avatar rayguan97 commented on September 25, 2024

You would encounter this error when the image size from the data loader is not correct. To make sure the assertion go through correctly, you might need to:

  1. modify the network parameters (self.h) and number of down-samplings, so that the size of the middle features would match up. (in which case you can't exactly load the pre-trained model)
  2. Modify the input size (cropped size), in which case you can load the model. No matter the size of you input, as long as the cropped size is (300, 375) for rugd and (375, 600) for rellis, you should be fine.

Based on the information, can you figure out the issue more? What kind of data are you using, and what is the shape of the image from the data-loader?

Can you try using the configs provided under trained_models, instead of the ones under configs?

from ganav-offroad.

ghoshsdeep avatar ghoshsdeep commented on September 25, 2024

Thanks for your reply.I did use the config in trained models along with your downloaded pretrained model from https://drive.google.com/drive/folders/1Un-s7S3WjNTLjkhXPnOAK4RoUjL-pibk
Also I changed the default size from (256,256) to (300,375) in the file pytorch2onnx.py.However while debugging I see that the same error pops up due to self.h = 10 and self.w =12 instead of them being 38 and 47 .
Upon inspection I see it happens from line 88 in segmentors/encoder_decoder.py,coming to line 160 in decode_heads/ours_head_class_attn.py,then to line 106 in the same

Screenshot from 2022-09-20 13-31-53

Screenshot from 2022-09-20 13-33-18

As I see the image size is (300,375).

Screenshot from 2022-09-20 13-34-19

Screenshot from 2022-09-20 13-40-27

from ganav-offroad.

rayguan97 avatar rayguan97 commented on September 25, 2024

Did you change the size or the cropped_size? You should make sure the cropped size is (300,375).

How it works is that in the config, model.decode_head.strides is an array/tuple, and the self.h and self.w is calculated based on that array(https://github.com/rayguan97/GANav-offroad/blob/main/mmseg/models/decode_heads/ours_head_class_attn.py#L82
). This same array also decided based on the structure of the backbone (number of downsampling and strides.) The code needs to be improve when I find some time.

For a quick solution, just hard code the fmap with desired dimension, but this would not load the pre-trained model well. If the cropped size are the same, it should run without problem. Did you have any issue running the original code and data?

from ganav-offroad.

ghoshsdeep avatar ghoshsdeep commented on September 25, 2024

As far as I can see there are parameters for crop_size in **pytorch2onnx.py.**There is an input size which I think needs to be (300,375) in order to run so that self.h = 38 and self.w = 47 at all the instances.However it turns out to be 10 and 12 in one of the instances.Hardcoding is not helping expected coz the training is running fine.
Screenshot from 2022-09-22 15-14-55

As I see the crop_size is set to (300,375) in both configs trained_models/rugd_group6/ganav_rugd6.py and
configs/base/datasets/rugd_group6.py

Screenshot from 2022-09-22 15-15-22

Screenshot from 2022-09-22 15-16-04

The other files train.py and test.py run absolutely fine.
However the pytorch2onnx.py. does not even work when i use
your pretrained model and config under trained models.
Was this file running succesfully for you?

from ganav-offroad.

rayguan97 avatar rayguan97 commented on September 25, 2024

I only used train.py and test.py for the code. I did not use pytorch2onnx.py, so I do not have support or experience for this.

Are you saying that in most instance, it works fine but there is one case you have 10, 12? Are the inputs the same size? Could you check whether you added the padding? (which is specified in the config as well.)

from ganav-offroad.

ghoshsdeep avatar ghoshsdeep commented on September 25, 2024

Yes thats correct, there is only one is instance.How did you convert it to ONNX format?How did you deploy this on the robot?
Can you please provide some info on the same?

from ganav-offroad.

rayguan97 avatar rayguan97 commented on September 25, 2024

from ganav-offroad.

ghoshsdeep avatar ghoshsdeep commented on September 25, 2024

Actually I was planning to deploy it on Jetson Nano.Thats why I needed to export it as ONNX model.Are you also planning to do the same?

from ganav-offroad.

rayguan97 avatar rayguan97 commented on September 25, 2024

We are not currently working on that platform so I'm not very familiar with the conversion.

from ganav-offroad.

ghoshsdeep avatar ghoshsdeep commented on September 25, 2024

Thank you for your kind support.I am closing this issue.If there is any other issues in future ,I would definitely like share with you
Once again Thank you for your help

from ganav-offroad.

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.