MagNet icon indicating copy to clipboard operation
MagNet copied to clipboard

RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)

Open littlezbq opened this issue 2 years ago • 1 comments

i run the scripts offered in the part "To test with a Deepglobe image", using the python demo.py ......, then i got the followling error:
"RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)"
could you please help me with that please?
Here's my running scripts, i add the --sub_batch_size part:
python demo.py
--dataset deepglobe
--image data/639004_sat.jpg
--scales 612-612,1224-1224,2448-2448
--crop_size 612 612
--input_size 508 508
--model fpn
--pretrained checkpoints/deepglobe_fpn.pth
--pretrained_refinement checkpoints/deepglobe_refinement.pth
--num_classes 7
--n_points 0.75
--n_patches -1
--smooth_kernel 11
--save_pred
--save_dir test_results/demo
--sub_batch_size 1

littlezbq avatar Aug 03 '23 02:08 littlezbq

Well i figure it out by modifying the code in demo.py to move the scale_image_patches to gpu.

littlezbq avatar Aug 03 '23 02:08 littlezbq