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

AttributeError: 'openvino.pyopenvino.Model' object has no attribute 'batch_size' #8509

Closed
1 of 2 tasks
VYRION-Ai opened this issue Jul 7, 2022 · 3 comments · Fixed by #8510
Closed
1 of 2 tasks

AttributeError: 'openvino.pyopenvino.Model' object has no attribute 'batch_size' #8509

VYRION-Ai opened this issue Jul 7, 2022 · 3 comments · Fixed by #8510
Labels
bug Something isn't working

Comments

@VYRION-Ai
Copy link

VYRION-Ai commented Jul 7, 2022

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

No response

Bug

i run code using openvino but i got this error

`E:\Python\openvino\yolov5>python detect.py --weights nano/best.xml --source 0
detect: weights=['nano/best.xml'], source=0, data=data\coco128.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs\detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False
YOLOv5  v6.1-280-g27d831b Python-3.8.7 torch-1.9.0+cpu CPU

Loading nano\best.xml for OpenVINO inference...
Traceback (most recent call last):
  File "detect.py", line 256, in <module>
    main(opt)
  File "detect.py", line 251, in main
    run(**vars(opt))
  File "C:\Users\H\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\autograd\grad_mode.py", line 28, in decorate_context
    return func(*args, **kwargs)
  File "detect.py", line 92, in run
    model = DetectMultiBackend(weights, device=device, dnn=dnn, data=data, fp16=half)
  File "E:\Python\openvino\yolov5\models\common.py", line 369, in __init__
    batch_size = network.batch_size
AttributeError: 'openvino.pyopenvino.Model' object has no attribute 'batch_size'`

Environment

No response

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@VYRION-Ai VYRION-Ai added the bug Something isn't working label Jul 7, 2022
@glenn-jocher
Copy link
Member

glenn-jocher commented Jul 7, 2022

@totoadel thanks for the bug report! I'm able to reproduce this with:

!python export.py --include openvino
!python detect.py --weights yolov5s_openvino_model/

Will debug.

@VYRION-Ai
Copy link
Author

@glenn-jocher sorry i don't get what you saying, what do you mean?

@glenn-jocher
Copy link
Member

@totoadel good news 😃! Your original issue may now be fixed ✅ in PR #8510. To receive this update:

  • Gitgit pull from within your yolov5/ directory or git clone https://github.com/ultralytics/yolov5 again
  • PyTorch Hub – Force-reload model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
  • Notebooks – View updated notebooks Open In Colab Open In Kaggle
  • Dockersudo docker pull ultralytics/yolov5:latest to update your image Docker Pulls

Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants