添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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 When I use train.py to train my data,always report this error. mlc = int(np.concatenate(dataset.labels, 0)[:, 0].max()) # max label class return umr_maximum(a, axis, None, out, keepdims, initial, where) ValueError: zero-size array to reduction operation maximum which has no identity #5167 When I use train.py to train my data,always report this error. mlc = int(np.concatenate(dataset.labels, 0)[:, 0].max()) # max label class return umr_maximum(a, axis, None, out, keepdims, initial, where) ValueError: zero-size array to reduction operation maximum which has no identity #5167 lizhiying-2019 opened this issue Oct 13, 2021 · 3 comments

Before submitting a bug report, please be aware that your issue must be reproducible with all of the following,
otherwise it is non-actionable, and we can not help you:

  • Current repo : run git fetch && git status -uno to check and git pull to update repo
  • Common dataset : coco.yaml or coco128.yaml
  • Common environment : Colab, Google Cloud, or Docker image. See https://github.com/ultralytics/yolov5#environments
  • If this is a custom dataset/training question you must include your train*.jpg , val*.jpg and results.png
    figures, or we can not help you. You can generate these with utils.plot_results() .

    🐛 Bug

    A clear and concise description of what the bug is.

    To Reproduce (REQUIRED)

    Input:

    import torch
    a = torch.tensor([5])
    c = a / 0
    

    Output:

    Traceback (most recent call last):
      File "/Users/glennjocher/opt/anaconda3/envs/env1/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
        exec(code_obj, self.user_global_ns, self.user_ns)
      File "<ipython-input-5-be04c762b799>", line 5, in <module>
        c = a / 0
    RuntimeError: ZeroDivisionError
    

    Expected behavior

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

    Environment

    If applicable, add screenshots to help explain your problem.

  • OS: [e.g. Ubuntu]
  • GPU [e.g. 2080 Ti]
  • Additional context

    Add any other context about the problem here.

    👋 Hello @lizhiying-2019, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

    If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

    If this is a custom training Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.

    For business inquiries or professional support requests please visit https://ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com.

    Requirements

    Python>=3.6.0 with all requirements.txt installed including PyTorch>=1.7. To get started:

    $ git clone https://github.com/ultralytics/yolov5
    $ cd yolov5
    $ pip install -r requirements.txt

    Environments

    YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

  • Google Colab and Kaggle notebooks with free GPU: Open In Colab Open In Kaggle
  • Google Cloud Deep Learning VM. See GCP Quickstart Guide
  • Amazon Deep Learning AMI. See AWS Quickstart Guide
  • Docker Image. See Docker Quickstart Guide Docker Pulls
  • Status

    If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

    changed the title When I use train.py to train my data,always report this error.Traceback (most recent call last): File "/home/lzy/.pycharm_helpers/pydev/pydevd.py", line 1483, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/home/lzy/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/lzy/exper/yolo/train.py", line 621, in <module> main(opt) File "/home/lzy/exper/yolo/train.py", line 518, in main train(opt.hyp, opt, device, callbacks) File "/home/lzy/exper/yolo/train.py", line 215, in train mlc = int(np.concatenate(dataset.labels, 0)[:, 0].max()) # max label class File "/home/lzy/anaconda3/envs/yolo/lib/python3.7/site-packages/numpy/core/_methods.py", line 40, in _amax return umr_maximum(a, axis, None, out, keepdims, initial, where) ValueError: zero-size array to reduction operation maximum which has no identity When I use train.py to train my data,always report this error. File "/home/lzy/.pycharm_helpers/pydev/pydevd.py", line 1483, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/home/lzy/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/lzy/exper/yolo/train.py", line 621, in <module> main(opt) File "/home/lzy/exper/yolo/train.py", line 518, in main train(opt.hyp, opt, device, callbacks) File "/home/lzy/exper/yolo/train.py", line 215, in train mlc = int(np.concatenate(dataset.labels, 0)[:, 0].max()) # max label class File "/home/lzy/anaconda3/envs/yolo/lib/python3.7/site-packages/numpy/core/_methods.py", line 40, in _amax return umr_maximum(a, axis, None, out, keepdims, initial, where) ValueError: zero-size array to reduction operation maximum which has no identity Oct 13, 2021 changed the title When I use train.py to train my data,always report this error. File "/home/lzy/.pycharm_helpers/pydev/pydevd.py", line 1483, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/home/lzy/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/lzy/exper/yolo/train.py", line 621, in <module> main(opt) File "/home/lzy/exper/yolo/train.py", line 518, in main train(opt.hyp, opt, device, callbacks) File "/home/lzy/exper/yolo/train.py", line 215, in train mlc = int(np.concatenate(dataset.labels, 0)[:, 0].max()) # max label class File "/home/lzy/anaconda3/envs/yolo/lib/python3.7/site-packages/numpy/core/_methods.py", line 40, in _amax return umr_maximum(a, axis, None, out, keepdims, initial, where) ValueError: zero-size array to reduction operation maximum which has no identity When I use train.py to train my data,always report this error. Oct 13, 2021 When I use train.py to train my data,always report this error. When I use train.py to train my data,always report this error. mlc = int(np.concatenate(dataset.labels, 0)[:, 0].max()) # max label class return umr_maximum(a, axis, None, out, keepdims, initial, where) ValueError: zero-size array to reduction operation maximum which has no identity Oct 13, 2021

    @lizhiying-2019 👋 hi, thanks for letting us know about this possible problem with YOLOv5 🚀. We've created a few short guidelines below to help users provide what we need in order to get started investigating a possible problem.

    How to create a Minimal, Reproducible Example

    When asking a question, people will be better able to provide help if you provide code that they can easily understand and use to reproduce the problem. This is referred to by community members as creating a minimum reproducible example. Your code that reproduces the problem should be:

  • Minimal – Use as little code as possible that still produces the same problem
  • Complete – Provide all parts someone else needs to reproduce your problem in the question itself
  • Reproducible – Test the code you're about to provide to make sure it reproduces the problem
  • In addition to the above requirements, for Ultralytics to provide assistance your code should be:

  • Current – Verify that your code is up-to-date with current GitHub master, and if necessary git pull or git clone a new copy to ensure your problem has not already been resolved by previous commits.
  • Unmodified – Your problem must be reproducible without any modifications to the codebase in this repository. Ultralytics does not provide support for custom code ⚠️.
  • If you believe your problem meets all of the above criteria, please close this issue and raise a new one using the 🐛 Bug Report template and providing a minimum reproducible example to help us better understand and diagnose your problem.

    Thank you! 😃

    👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.

    Access additional YOLOv5 🚀 resources:

  • Wikihttps://github.com/ultralytics/yolov5/wiki
  • Tutorialshttps://docs.ultralytics.com/yolov5
  • Docshttps://docs.ultralytics.com
  • Access additional Ultralytics resources:

  • Ultralytics HUBhttps://ultralytics.com/hub
  • Vision APIhttps://ultralytics.com/yolov5
  • About Ushttps://ultralytics.com/about
  • Join Our Teamhttps://ultralytics.com/work
  • Contact Ushttps://ultralytics.com/contact
  • Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

    Thank you for your contributions to YOLOv5 🚀 and Vision AI !