sgrvinod / a-PyTorch-Tutorial-to-Object-Detection

SSD: Single Shot MultiBox Detector | a PyTorch Tutorial to Object Detection
MIT License
3.05k stars 719 forks source link

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

Open gonggqing opened 4 years ago

gonggqing commented 4 years ago

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?

SonwYang commented 4 years ago
                    condition = overlap[box] > max_overlap
                    condition = torch.tensor(condition, dtype=torch.uint8).to(device)
                    suppress = torch.max(suppress, condition)
gonggqing commented 4 years ago

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