Traceback (most recent call last):
File "webcam.py", line 83, in
main()
File "webcam.py", line 73, in main
composite = coco_demo.run_on_opencv_image(img)
File "/home/yuanyuan/maskrcnn-benchmark/demo/predictor.py", line 211, in run_on_opencv_image
predictions = self.compute_prediction(image)
File "/home/yuanyuan/maskrcnn-benchmark/demo/predictor.py", line 261, in compute_prediction
masks = self.masker([masks], [prediction])[0]
File "/home/yuanyuan/maskrcnn-benchmark/maskrcnn-benchmark/maskrcnn_benchmark/modeling/roi_heads/mask_head/inference.py", line 199, in __call__
result = self.forward_single_image(mask, box)
File "/home/yuanyuan/maskrcnn-benchmark/maskrcnn-benchmark/maskrcnn_benchmark/modeling/roi_heads/mask_head/inference.py", line 182, in forward_single_image
res = torch.stack(res, dim=0)[:, None]
RuntimeError: _th_cat is not implemented for type CPUBoolType
However after I delete the line
masks = self.masker([masks], [prediction])[0] in predictor.py under demo, it works pretty well and I got the predicted results out.
Steps to reproduce the behavior:
Please copy and paste the output from the
environment collection script from PyTorch
(or fill out the checklist below manually).
You can get the script and run it with:
wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py
Collecting environment information...
PyTorch version: 1.0.0.dev20190328
Is debug build: No
CUDA used to build PyTorch: 10.0.130
OS: Ubuntu 18.04.2 LTS
GCC version: (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0
CMake version: version 3.10.2
Python version: 3.7
Is CUDA available: Yes
CUDA runtime version: 10.0.130
GPU models and configuration:
GPU: Tesla M40 24GB
Nvidia driver version: 418.67
cuDNN version: /usr/lib/x86_64-linux-gnu/libcudnn.so.7.6.0
Versions of relevant libraries:
[pip3] numpy==1.17.2
[pip3] torch==1.2.0
[pip3] torchvision==0.4.0
[conda] blas 1.0 mkl
[conda] mkl 2019.4 243
[conda] mkl-service 2.3.0 py37he904b0f_0
[conda] mkl_fft 1.0.14 py37ha843d7b_0
[conda] mkl_random 1.1.0 py37hd6b4f25_0
[conda] pytorch 1.3.0 py3.7_cuda10.0.130_cudnn7.6.3_0 pytorch
[conda] pytorch-nightly 1.0.0.dev20190328 py3.7_cuda10.0.130_cudnn7.4.2_0 pytorch
[conda] torchvision 0.4.1 py37_cu100 pytorch
I meet the same problem. In inference.py-->forward_single_image(), the res contains bool type, but the torch.stack seems not to support the bool input, so I change the type of res before the operation of stack, that is 'res = [o.int() for o in res]', it can work well.
Problem solved by updating pytorch to v1.3.0 with no code changes! The whole process of training and testing can be finished without problems after updating.
Most helpful comment
I meet the same problem. In inference.py-->forward_single_image(), the res contains bool type, but the torch.stack seems not to support the bool input, so I change the type of res before the operation of stack, that is 'res = [o.int() for o in res]', it can work well.