a-PyTorch-Tutorial-to-Object-Detection icon indicating copy to clipboard operation
a-PyTorch-Tutorial-to-Object-Detection copied to clipboard

Expected object of scalar type unsigned char but got scalar type bool for argument 'other'.

Open gonggqing opened this issue 3 years ago • 2 comments

I ran the detect.py file and load the checkpoint but got the error: Expected object of scalar type unsigned char but got scalar type bool for argument 'other'. `Traceback (most recent call last):

File "H:/SSD_object_detection/detect.py", line 103, in detect(original_image, min_score=0.1, max_overlap=0.4, top_k=150).show()

File "H:/SSD_object_detection/detect.py", line 46, in detect max_overlap=max_overlap, top_k=top_k)

File "H:\SSD_object_detection\model.py", line 494, in detect_objects suppress = torch.max(suppress, overlap[box] > max_overlap)

RuntimeError: Expected object of scalar type unsigned char but got scalar type bool for argument 'other'` Could any one help to resolve this error?

gonggqing avatar Aug 27 '20 08:08 gonggqing

                    condition = overlap[box] > max_overlap
                    condition = torch.tensor(condition, dtype=torch.uint8).to(device)
                    suppress = torch.max(suppress, condition)

SonwYang avatar Aug 31 '20 07:08 SonwYang

Hey guys, I have found the answer at the issue #24 and ran sucessfully, so thanks for the answers !

gonggqing avatar Aug 31 '20 12:08 gonggqing