BiSeNet icon indicating copy to clipboard operation
BiSeNet copied to clipboard

images in kitti dataset cannot match

Open Shelfcol opened this issue 5 years ago • 2 comments
trafficstars

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.

Shelfcol avatar May 16 '20 02:05 Shelfcol

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.

CoinCheung avatar May 16 '20 02:05 CoinCheung

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 .

Shelfcol avatar May 16 '20 03:05 Shelfcol