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

IndexError: index 483 is out of bounds for axis 0 with size 19 #5

Closed
WhXl opened this issue Aug 19, 2021 · 7 comments
Closed

IndexError: index 483 is out of bounds for axis 0 with size 19 #5

WhXl opened this issue Aug 19, 2021 · 7 comments
Labels
bug Something isn't working Stale

Comments

@WhXl
Copy link

WhXl commented Aug 19, 2021

感谢你开源了你的项目,我运行代码遇到了这个问题!

🐛 Bug

File "/home/wx/Projects/multiyolov5/detect.py", line 197, in detect
mask = label2image(seg.max(axis=0)[1].cpu().numpy(), Cityscapes_COLORMAP)[:, :, ::-1]
File "/home/wx/Projects/multiyolov5/detect.py", line 72, in label2image
return colormap[X, :]
IndexError: index 483 is out of bounds for axis 0 with size 19

To Reproduce (REQUIRED)

Input:

def label2image(pred, COLORMAP=Cityscapes_COLORMAP):
    colormap = np.array(COLORMAP, dtype='uint8')
    X = pred.astype('int32')
    return colormap[X, :]

Output:

Traceback (most recent call last):
  File "/home/wx/Projects/multiyolov5/detect.py", line 279, in <module>
    detect()
  File "/home/wx/Projects/multiyolov5/detect.py", line 197, in detect
    mask = label2image(seg.max(axis=0)[1].cpu().numpy(), Cityscapes_COLORMAP)[:, :, ::-1]
  File "/home/wx/Projects/multiyolov5/detect.py", line 72, in label2image
    return colormap[X, :]
IndexError: index 483 is out of bounds for axis 0 with size 19

Expected behavior

A clear and concise description of what you expected to happen.

Environment

If applicable, add screenshots to help explain your problem.

  • OS: ubuntu16.04
  • GPU [e.g. 2070] torch 1.7.1+cu101 CUDA:0 (GeForce RTX 2070, 7979.1875MB)
@WhXl WhXl added the bug Something isn't working label Aug 19, 2021
@Zomcxj
Copy link

Zomcxj commented Aug 21, 2021

同 还没开始就结束了!

@Zomcxj
Copy link

Zomcxj commented Aug 21, 2021

同 还没开始就结束了!

应该是v5的权重不行 要下载作者百度云新的权重才可以

@TomMao23
Copy link
Owner

Do not use yolov5s.pt and yolov5m.pt when inference, use other weight in baiduyun.

@TomMao23
Copy link
Owner

同 还没开始就结束了!

应该是v5的权重不行 要下载作者百度云新的权重才可以

同 还没开始就结束了!

应该是v5的权重不行 要下载作者百度云新的权重才可以

原版的yolov5s.pt和yolov5m.pt我保留在了网盘中,但不可用于推理,仅用作训练时候初始化来迁移学习。推理时使用百度网盘里其他几个预训练权重。

@WhXl
Copy link
Author

WhXl commented Aug 24, 2021

谢谢,这个换做百度网盘中权重后,问题得到了解决

@SYL888
Copy link

SYL888 commented Aug 26, 2021

谢谢,解决了

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

No branches or pull requests

4 participants