Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run detect.py #7

Open
tommylatranvu opened this issue Mar 8, 2023 · 2 comments
Open

Cannot run detect.py #7

tommylatranvu opened this issue Mar 8, 2023 · 2 comments

Comments

@tommylatranvu
Copy link

Hello Chen,
I tried your code detect.py, but I always had a problem. Could you check it for me please! Thanks a lot!

(optic_ship) la@erin-tla-30122:~/Desktop/DRENet_ship$ python detect.py --weights "./DRENet.pt" --source "images/" --device cpu
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='cpu', exist_ok=False, img_size=512, iou_thres=0.45, name='exp', project='runs/detect', save_conf=False, save_txt=False, source='images/', update=False, view_img=False, weights=['./DRENet.pt'])
YOLOv5 torch 1.13.1+cu117 CPU

Fusing layers...
Model Summary: 239 layers, 4788248 parameters, 0 gradients
image 1/1 /home/la/Desktop/DRENet_ship/images/GF1_WFV4_E124.3_N33.5_20200926_L1A0005089385_3584_8192.png: Traceback (most recent call last):
File "detect.py", line 175, in
detect()
File "detect.py", line 72, in detect
pred = model(img, augment=opt.augment)[0][0]
File "/opt/anaconda3/envs/optic_ship/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/home/la/Desktop/DRENet_ship/models/yolo.py", line 131, in forward
return self.forward_once(x, profile) # single-scale inference, train
File "/home/la/Desktop/DRENet_ship/models/yolo.py", line 148, in forward_once
x = m(x) # run
File "/opt/anaconda3/envs/optic_ship/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/opt/anaconda3/envs/optic_ship/lib/python3.7/site-packages/torch/nn/modules/upsampling.py", line 157, in forward
recompute_scale_factor=self.recompute_scale_factor)
File "/opt/anaconda3/envs/optic_ship/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1270, in getattr
type(self).name, name))
AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'

@WindVChen
Copy link
Owner

Hi @tommylatranvu,

I think this may help #4 (comment).

@tommylatranvu
Copy link
Author

Hi Chen,
The error was solved. Thanks a lot for your help! You are doing a great work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants