Verg-Avesta / CounTR

CounTR: Transformer-based Generalised Visual Counting
https://verg-avesta.github.io/CounTR_Webpage/
MIT License
92 stars 9 forks source link

shape mismatch while running demo.py #5

Closed NateshReddy closed 1 year ago

NateshReddy commented 1 year ago

Traceback (most recent call last): File "demo.py", line 198, in result = run_one_image(samples, boxes, pos, model) File "demo.py", line 126, in run_one_image with torch.no_grad(): File "/home/pdguest/environments/mmdet_new/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "/home/pdguest/natesh/experiment/CounTR/models_mae_cross.py", line 199, in forward pred = self.forward_decoder(latent, boxes, shot_num) # [N, 384, 384] File "/home/pdguest/natesh/experiment/CounTR/models_mae_cross.py", line 169, in forward_decoder y = torch.cat(y1,dim=0).reshape(shot_num,N,C).to(x.device) RuntimeError: shape '[3, 1, 512]' is invalid for input of size 1024

I've changed the path for my image and box coordinates with respect to that. I'm not sure what exactly is the cause of error, can you please look into this? thanks

Verg-Avesta commented 1 year ago

I think it is the problem of the shot number. The demo.py uses 3 shots and you used 2 shots. You can change the 3 to the actual shot number (2 in your case) in here and here. You can try and find whether it is the problem.