Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inference issue #4

Closed
fatandfat opened this issue Dec 28, 2021 · 2 comments
Closed

inference issue #4

fatandfat opened this issue Dec 28, 2021 · 2 comments

Comments

@fatandfat
Copy link

Hi I'm trying to inference on some of my images and it runs successfully with images with 4:3 ratio, but when I tried on images with size 720*480 there shows some error

  • (planerecnet) kb249@kb249:/media/kb249/K/liuxiaohan/PlaneRecNet$ python simple_inference.py --config=PlaneRecNet_101_config --trained_model=weights/PlaneRecNet_101_9_125000.pth --image=test_images/00000206_10002.jpg
    Inference image: test_images/00000206_10002.jpg
    /home/kb249/anaconda3/envs/planerecnet/lib/python3.6/site-packages/torch/functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2157.)
    return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
    Traceback (most recent call last):
    File "simple_inference.py", line 357, in
    inference_image(net, args.image, depth_mode=args.depth_mode)
    File "simple_inference.py", line 152, in inference_image
    results = net(batch)
    File "/home/kb249/anaconda3/envs/planerecnet/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
    File "/media/kb249/K/liuxiaohan/PlaneRecNet/planerecnet.py", line 93, in forward
    mask_pred = self.mask_head(mask_features)
    File "/home/kb249/anaconda3/envs/planerecnet/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
    File "/media/kb249/K/liuxiaohan/PlaneRecNet/planerecnet.py", line 492, in forward
    feature_add_all_level += self.convs_all_levelsi
    RuntimeError: The size of tensor a (107) must match the size of tensor b (108) at non-singleton dimension 2

And this is my test image
00000206_10002

@EryiXie
Copy link
Owner

EryiXie commented Jan 3, 2022

Hi, that's because the image width and height should be divisible by 32. You can write a small function to pad zeros to the resized image so that H and W are divisible by 32. I will also do the same in the next update.

@fatandfat
Copy link
Author

Hi, that's because the image width and height should be divisible by 32. You can write a small function to pad zeros to the resized image so that H and W are divisible by 32. I will also do the same in the next update.

ok thanks for your reply and great work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants