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

[Fix] Fix image_demo.py error #1640

Merged
merged 4 commits into from
Jun 9, 2022

Conversation

MengzhangLI
Copy link
Contributor

Fix #1639

It reports error produced by #1630, where command is replaced from

python demo/image_demo.py demo/demo.png configs/pspnet/pspnet_r50-d8_512x1024_40k_cityscapes.py \
    checkpoints/pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth --device cuda:0 --palette cityscapes

to

python demo/image_demo.py demo/demo.jpg pspnet_r50-d8_512x1024_40k_cityscapes.py pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth --device cpu --out-file result.jpg

This new command would raise three bugs.

(1) No demo.jpg in ./demo/ folder, it should be demo.png.

(2) CPU inference would rasie error

  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/container.py", line 141, in forward
    input = module(input)
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/batchnorm.py", line 682, in forward
    raise ValueError("SyncBatchNorm expected input tensor to be on GPU")
ValueError: SyncBatchNorm expected input tensor to be on GPU

It would be better change back to --device cuda:0.

(3) No argument --out-file.
It would be better add this argument to save it.

@codecov
Copy link

codecov bot commented Jun 5, 2022

Codecov Report

Merging #1640 (5af1c05) into master (46326f6) will decrease coverage by 0.02%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #1640      +/-   ##
==========================================
- Coverage   90.25%   90.23%   -0.03%     
==========================================
  Files         142      142              
  Lines        8477     8478       +1     
  Branches     1428     1429       +1     
==========================================
- Hits         7651     7650       -1     
- Misses        586      588       +2     
  Partials      240      240              
Flag Coverage Δ
unittests 90.23% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmseg/apis/inference.py 61.66% <0.00%> (-2.13%) ⬇️
mmseg/models/backbones/vit.py 90.85% <0.00%> (-0.06%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 46326f6...5af1c05. Read the comment docs.

docs/en/get_started.md Outdated Show resolved Hide resolved
mmseg/apis/inference.py Outdated Show resolved Hide resolved
@MeowZheng MeowZheng merged commit 43b4efb into open-mmlab:master Jun 9, 2022
ZhimingNJ pushed a commit to AetrexTechnology/mmsegmentation that referenced this pull request Jun 29, 2022
* [Fix] Fix image_demo.py error

* [Fix] Fix image_demo.py error

* fix

* delete plt.cla()
@MengzhangLI MengzhangLI deleted the fix_image_demo branch July 15, 2022 03:37
aravind-h-v pushed a commit to aravind-h-v/mmsegmentation that referenced this pull request Mar 27, 2023
* do not automatically enable xformers

* uP
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

Successfully merging this pull request may close these issues.

Demo verification not runnable with docker image
2 participants