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

error trying the project #1

Open
parniantaghipour opened this issue Apr 1, 2021 · 4 comments
Open

error trying the project #1

parniantaghipour opened this issue Apr 1, 2021 · 4 comments

Comments

@parniantaghipour
Copy link

Hi,
I try to use this project; but when I upload the photo from my PC, I got the below error.
Did I do anything wrong? I am new.

Traceback (most recent call last):
  File "/home/parnian/PycharmProjects/yolo_deploy/venv/lib/python3.6/site-packages/flask/app.py", line 2464, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/parnian/PycharmProjects/yolo_deploy/venv/lib/python3.6/site-packages/flask/app.py", line 2450, in wsgi_app
    response = self.handle_exception(e)
  File "/home/parnian/PycharmProjects/yolo_deploy/venv/lib/python3.6/site-packages/flask/app.py", line 1867, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/parnian/PycharmProjects/yolo_deploy/venv/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/parnian/PycharmProjects/yolo_deploy/venv/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/parnian/PycharmProjects/yolo_deploy/venv/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/parnian/PycharmProjects/yolo_deploy/venv/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/parnian/PycharmProjects/yolo_deploy/venv/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/parnian/PycharmProjects/yolo_deploy/venv/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/parnian/PycharmProjects/yolo_deploy/venv/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/parnian/PycharmProjects/yolo_deploy/yolov5-flask/app.py", line 41, in predict
    results = get_prediction(img_bytes)
  File "/home/parnian/PycharmProjects/yolo_deploy/yolov5-flask/app.py", line 24, in get_prediction
    results = model(imgs, size=640)  # includes NMS
  File "/home/parnian/PycharmProjects/yolo_deploy/venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/parnian/.cache/torch/hub/ultralytics_yolov5_master/models/common.py", line 260, in forward
    files.append(Path(im.filename).with_suffix('.jpg').name if isinstance(im, Image.Image) else f'image{i}.jpg')
  File "/usr/lib/python3.6/pathlib.py", line 837, in with_suffix
    raise ValueError("%r has an empty name" % (self,))
ValueError: PosixPath('.') has an empty name

Thank you very much.

@jzhang533
Copy link
Owner

this is a bug of ultralytics/yolov5, and has been fixed in latest release.
ultralytics/yolov5#2702

@kty-lfc
Copy link

kty-lfc commented Feb 21, 2022

Hi @jzhang533,
I found this error after run your code :
Adding AutoShape...
Traceback (most recent call last):
File "app.py", line 14, in
model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True).autoshape() # for PIL/cv2/np inputs and NMS
File "D:\Users\XXX\anaconda3\lib\site-packages\torch\nn\modules\module.py", line 1177, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'AutoShape' object has no attribute 'autoshape'

@Prakhar0809
Copy link

Hi @jzhang533, I found this error after run your code : Adding AutoShape... Traceback (most recent call last): File "app.py", line 14, in model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True).autoshape() # for PIL/cv2/np inputs and NMS File "D:\Users\XXX\anaconda3\lib\site-packages\torch\nn\modules\module.py", line 1177, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'AutoShape' object has no attribute 'autoshape'

I'm also facing the same issue, did you happen to find a solution?

jzhang533 added a commit that referenced this issue Jul 13, 2022
@jzhang533
Copy link
Owner

ultralytics/yolov5 has evolved a lot.
I've updated this tiny demo script to make it work again.

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

4 participants