Skip to content

RuntimeError: boxes should be a 2d tensor, got 1D. #1

@Ljincheng0128

Description

@Ljincheng0128

I tried to upload two pictures, but I got an error. RuntimeError: boxes should be a 2d tensor, got 1D.
Traceback (most recent call last):
File "D:/detection/pcb_defect_analysis-master/model_inference/inference.py", line 135, in
result = model_inference(model, path_1, path_2)
File "D:/detection/pcb_defect_analysis-master/model_inference/inference.py", line 99, in model_inference
r1 = extract_contours_from_image(img1)
File "D:/detection/pcb_defect_analysis-master/model_inference/inference.py", line 55, in extract_contours_from_image
inds = list(nms(boxes=boxes, scores=torch.Tensor([1] * len(regions)), iou_threshold=0.1).numpy())
File "C:\Users\ASUS\Anaconda3\lib\site-packages\torchvision\ops\boxes.py", line 36, in nms
return torch.ops.torchvision.nms(boxes, scores, iou_threshold)
RuntimeError: boxes should be a 2d tensor, got 1D

so, Is the way I execute the code wrong? could you tell me how to run it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions