Skip to content

RuntimeError: Expected object of scalar type Bool but got scalar type Byte for argument #2 'other' in call to _th_and #1

@pzs7602

Description

@pzs7602

I run the classwise semi-supervision demo guided by the readme, I have only one GPU so run the command as:
python shapeprop/tools/train_net.py --config-file configs/coco_voc_mask_rcnn_r50_fpn_1x.yml
and error occurs when executing:

File "/home/pzs/.pyenv/versions/3.7.8/lib/python3.7/runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "/home/pzs/.pyenv/versions/3.7.8/lib/python3.7/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/home/pzs/.pyenv/versions/3.7.8/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/pzs/pzs/ShapeProp/shapeprop/tools/train_net.py", line 192, in
main()
File "/home/pzs/pzs/ShapeProp/shapeprop/tools/train_net.py", line 185, in main
model = train(cfg, args.local_rank, args.distributed)
File "/home/pzs/pzs/ShapeProp/shapeprop/tools/train_net.py", line 85, in train
arguments,
File "/home/pzs/pzs/ShapeProp/shapeprop/engine/trainer.py", line 69, in do_train
loss_dict = model(images, targets)
File "/home/pzs/.pyenv/versions/3.7.8/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/home/pzs/pzs/ShapeProp/shapeprop/modeling/detector/generalized_rcnn.py", line 56, in forward
x, result, detector_losses = self.roi_heads(features, proposals, targets)
File "/home/pzs/.pyenv/versions/3.7.8/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/home/pzs/pzs/ShapeProp/shapeprop/modeling/roi_heads/roi_heads.py", line 42, in forward
x, detections, loss_mask = self.mask(mask_features, detections, targets)
File "/home/pzs/.pyenv/versions/3.7.8/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/home/pzs/pzs/ShapeProp/shapeprop/modeling/roi_heads/mask_head/mask_head.py", line 77, in forward
loss_mask = self.loss_evaluator(proposals, mask_logits, targets)
File "/home/pzs/pzs/ShapeProp/shapeprop/modeling/roi_heads/mask_head/loss.py", line 119, in call
labels, mask_targets, valid_inds = self.prepare_targets(proposals, targets)
File "/home/pzs/pzs/ShapeProp/shapeprop/modeling/roi_heads/mask_head/loss.py", line 91, in prepare_targets
valid_masks = (labels_per_image > 0) & matched_targets.get_field("valid_masks").to(dtype=torch.uint8)
RuntimeError: Expected object of scalar type Bool but got scalar type Byte for argument #2 'other' in call to _th_and

I think my coco datasets should be configured properly.
Ubuntu 20.04
CUDA 10.0(Nvidia 2080Ti)
PyTorch 1.4.0+cu100
Python 3.7.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions