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 to run the code. #2

Open
arthurwolf opened this issue Dec 2, 2023 · 2 comments
Open

Error trying to run the code. #2

arthurwolf opened this issue Dec 2, 2023 · 2 comments

Comments

@arthurwolf
Copy link
Contributor

Following the exact instructions, here is what I get:

╭─arthur at aquarelle in ~/dev/ai/yolov5_anime on master✘✘✘ 23-12-02 - 2:56:53
╰─⠠⠵ python detect.py --weights weights/yolov5x_anime.pt --source ../manga/data/source/alita/Battle\ Angel\ Alita\ v02/Volume\ 2\ -\ Tears\ Of\ An\ Angel  --output /ram/test 
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.4, device='', img_size=640, iou_thres=0.5, output='/ram/test', save_txt=False, source='../manga/data/source/alita/Battle Angel Alita v02/Volume 2 - Tears Of An Angel', update=False, view_img=False, weights=['weights/yolov5x_anime.pt'])
/home/arthur/.pyenv/versions/3.7.17/lib/python3.7/site-packages/torch/cuda/__init__.py:88: UserWarning: CUDA initialization: Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 804: forward compatibility was attempted on non supported HW (Triggered internally at ../c10/cuda/CUDAFunctions.cpp:109.)
  return torch._C._cuda_getDeviceCount() > 0
Using CPU

Fusing layers... Model Summary: 284 layers, 8.83906e+07 parameters, 8.45317e+07 gradients
image 1/612 /home/arthur/dev/ai/manga/data/source/alita/Battle Angel Alita v02/Volume 2 - Tears Of An Angel/BA-02-007-rotated.jpg: Traceback (most recent call last):
  File "detect.py", line 171, in <module>
    detect()
  File "detect.py", line 72, in detect
    pred = model(img, augment=opt.augment)[0]
  File "/home/arthur/.pyenv/versions/3.7.17/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/arthur/dev/ai/yolov5_anime/models/yolo.py", line 109, in forward
    return self.forward_once(x, profile)  # single-scale inference, train
  File "/home/arthur/dev/ai/yolov5_anime/models/yolo.py", line 129, in forward_once
    x = m(x)  # run
  File "/home/arthur/.pyenv/versions/3.7.17/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/arthur/.pyenv/versions/3.7.17/lib/python3.7/site-packages/torch/nn/modules/upsampling.py", line 157, in forward
    recompute_scale_factor=self.recompute_scale_factor)
  File "/home/arthur/.pyenv/versions/3.7.17/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'
╭─arthur at aquarelle in ~/dev/ai/yolov5_anime on master✘✘✘ 23-12-02 - 2:57:35
╰─⠠⠵     

Am I doing something wrong? What should I do to fix this?

Thanks!

@zymk9
Copy link
Owner

zymk9 commented Dec 4, 2023

Hi Arthur. This seems like a compatability issue with newer versions of PyTorch. You may check ultralytics/yolov5#6948 for the versions to use. Switching to PyTorch 1.9 or 1.10 might work.

Hope it helps!

@arthurwolf
Copy link
Contributor Author

arthurwolf commented Dec 9, 2023

Thanks for the help, moving to python3.7 (using pyenv) and torch 1.9 worked.

Deleted the previous comment as I figured out what was going on: the model/weights file was 0 bytes. This actually comes from the download failing, which seems to come from the google drive link being broken: clicking "download" gives me either a download error or an empty file.

Screenshot from 2023-12-09 02-12-18

Would you mind checking on the file and/or uploading it somewhere else?

(also, what does the output in the --save-txt files mean/how to interpret it exactly? edit: figured some of it out from the source code, it's xywh, I'm going to presume using 0-1 positions. I'll try to see if interpreting it that way works)

Thanks!

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