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

Problems running demo.py #29

Closed
Svithjod opened this issue Sep 5, 2022 · 5 comments
Closed

Problems running demo.py #29

Svithjod opened this issue Sep 5, 2022 · 5 comments

Comments

@Svithjod
Copy link

Svithjod commented Sep 5, 2022

Hi, I was running the demo code of seqnet:
python demo.py --cfg ~/checkpoints/seqnet/config.yaml --ckpt ~/checkpoints/seqnet/epoch_17.pth

but I got the following error:

Traceback (most recent call last):
File "demo.py", line 89, in
main(args)
File "demo.py", line 63, in main
query_feat = model(query_img, query_target)[0]
File "/home/mmmm/miniconda3/envs/seqnet/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/home/mmmm/repo/SeqNet/models/seqnet.py", line 134, in forward
return self.inference(images, targets, query_img_as_gallery)
File "/home/mmmm/repo/SeqNet/models/seqnet.py", line 117, in inference
box_features = self.roi_heads.box_roi_pool(features, boxes, images.image_sizes)
File "/home/mmmm/miniconda3/envs/seqnet/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/home/mmmm/miniconda3/envs/seqnet/lib/python3.7/site-packages/torchvision/ops/poolers.py", line 141, in forward
sampling_ratio=self.sampling_ratio
File "/home/mmmm/miniconda3/envs/seqnet/lib/python3.7/site-packages/torchvision/ops/roi_align.py", line 70, in roi_align
return _RoIAlignFunction.apply(input, rois, output_size, spatial_scale, sampling_ratio)
File "/home/mmmm/miniconda3/envs/seqnet/lib/python3.7/site-packages/torchvision/ops/roi_align.py", line 25, in forward
output_size[0], output_size[1], sampling_ratio)
RuntimeError: Expected tensor for argument #1 'input' to have the same type as tensor for argument #2 'rois'; but type Variable[CUDAFloatType] does not equal Variable[CUDALongType] (while checking arguments for ROIAlign_forward_cuda) (checkSameType at /pytorch/aten/src/ATen/TensorUtils.cpp:140)

So far I had no idea what caused this error, could you help me with this problem? Thx a lot.

@serend1p1ty
Copy link
Owner

Try to downgrade your PyTorch/TorchVision. PyTorch 1.3-1.8 should be ok.

@Svithjod
Copy link
Author

Svithjod commented Sep 6, 2022

Hi, thx for your reply, I was using PyTorch 1.2.0 and TorchVision 0.4.0 as in requirements, should I upgrade them to PyTorch 1.3+ and corresponding TorchVision version?

@Svithjod
Copy link
Author

Svithjod commented Sep 6, 2022

Thank you,I got this done by upgrading my PyTorch and TorchVision to proper version.

@serend1p1ty
Copy link
Owner

It's a little strange, because I used PyTorch=1.2.0 & TorchVision=0.4.0 before.

@Svithjod
Copy link
Author

Svithjod commented Sep 6, 2022

Not sure what caused this problem, I’m currently using pytorch==1.5.1+cu101 and torchvision==0.6.1+cu101, it works perfectly smooth.

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

No branches or pull requests

2 participants