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

images in kitti dataset cannot match #54

Open
Shelfcol opened this issue May 16, 2020 · 2 comments
Open

images in kitti dataset cannot match #54

Shelfcol opened this issue May 16, 2020 · 2 comments

Comments

@Shelfcol
Copy link

I want to implement the algorithm in kitti dataset. But it shows that the codes cannot match kitti dataset's images' size.

CUDA_VISIBLE_DEVICES=0 python3 demo.py --ckpt res/model_final.pth --img_path ./2.png
Traceback (most recent call last):
File "demo.py", line 39, in
im = to_tensor(Image.open(args.img_path)).unsqueeze(0).cuda()
File "/home/gxf/anaconda3/envs/tf1.4.1/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 61, in call
img = t(img)
File "/home/gxf/anaconda3/envs/tf1.4.1/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 166, in call
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "/home/gxf/anaconda3/envs/tf1.4.1/lib/python3.6/site-packages/torchvision/transforms/functional.py", line 217, in normalize
tensor.sub_(mean[:, None, None]).div_(std[:, None, None])
RuntimeError: output with shape [1, 370, 1226] doesn't match the broadcast shape [3, 370, 1226]

I dont know if you can spare some time to fix this problem. Thank you.

@CoinCheung
Copy link
Owner

The reason is likely to be that your image is an one-channel image, likely to be gray. I have added a bit fix, you can try again.

@Shelfcol
Copy link
Author

It worked.thx
By the way, last question you suggested me to chang the code in demo.py from fp16.model import BiSeNet to from model import BiSeNet. Maybe you can change your code in demo.py in your repo, and prevent others from meeting the same error .

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