WongKinYiu / yolor

implementation of paper - You Only Learn One Representation: Unified Network for Multiple Tasks (https://arxiv.org/abs/2105.04206)
GNU General Public License v3.0
1.98k stars 524 forks source link

Inference result blank for both branches #280

Closed veb-101 closed 1 year ago

veb-101 commented 1 year ago

Hello, performing inference using detect.py returns no box result for both branches.

I have downloaded the weights using the get_pretrain.sh file provided in each branch. I have even tried with the weights provided in the releases with the paper branch.

Can you please provide some solution or check internally once?

Paper branch inference test:

python detect.py --weights ..\weights_2\yolor-p6-paper-541.pt --source ..\horses.jpg --img-size 1280 --conf-thres 0.2 --device 0

Namespace(weights=['..\\weights_2\\yolor-p6-paper-541.pt'], source='..\\horses.jpg', img_size=1280, conf_thres=0.2, iou_thres=0.45, device='0', view_img=False, save_txt=False, save_conf=False, classes=None, agnostic_nms=False, augment=False, update=False, project='runs/detect', name='exp', exist_ok=False)
Using torch 1.7.1+cu110 CUDA:0 (NVIDIA GeForce GTX 1660 Ti with Max-Q Design, 6143MB)

Fusing layers...
Model Summary: 519 layers, 37240696 parameters, 0 gradients
image 1/1 ...\horses.jpg: img.size load dataset (896, 1280, 3)
img.shape torch.Size([1, 3, 896, 1280])
pred.shape torch.Size([1, 71400, 85])
output.shape NMS [tensor([], size=(0, 6))]

Results saved to runs\detect\exp2
Done. (1.716s)
veb-101 commented 1 year ago

Got it working.

Update the line where Darknet is being loaded with model = Darknet(cfg, imgsz).to(device)

When using GPU, the model was getting loaded with half precision. Set half=False to get it working.