Closed PoivronMax closed 1 year ago
👋 Hello @PoivronMax, 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 a minimum reproducible example to help us debug it.
If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.
Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:
git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit.
We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 🚀!
Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects.
Check out our YOLOv8 Docs for details and get started with:
pip install ultralytics
@PoivronMax hi there! It looks like you're experiencing an error while running YOLOv5's detect.py
script. The error message indicates a "ValueError: cannot convert float NaN to integer."
This error typically occurs when there is an issue with the bounding box coordinates for object detection. NaN (Not a Number) represents missing or undefined values, and in this case, it suggests that there may be a problem with the bounding box coordinates of the detected objects in your images.
To fix this issue, I would recommend the following:
Check your dataset: Ensure that your dataset has accurate bounding box annotations for the objects you are trying to detect. Any missing or incorrectly defined bounding box coordinates could result in NaN values.
Verify the integrity of your data: Double-check that your images and annotations are correctly formatted and there are no empty or corrupted files.
Update YOLOv5: Make sure you have the latest version of YOLOv5 installed. You can update to the latest version by running git pull
in the yolov5 repository directory.
If you're still encountering issues after attempting these steps, it would be helpful if you could provide more information about your dataset, such as a sample image and its corresponding annotation file. Additionally, any specific steps or modifications you made to the code would assist in identifying the cause of the issue.
Please feel free to ask further questions or provide more details. The YOLO community and the Ultralytics team are here to help you out!
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.
For additional resources and information, please see the links below:
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 YOLO 🚀 and Vision AI ⭐
Hello, did you fix this issue, I also had the same problem
@rt0821 hi there! If you're encountering the same "ValueError: cannot convert float NaN to integer" issue, it's likely due to a similar cause as mentioned previously. Here are a few steps you can take to troubleshoot the problem:
Check Annotations: Ensure that your annotations are correct and that no bounding box coordinates are missing or improperly formatted.
Data Integrity: Verify that your images and corresponding annotation files are not corrupted and are accessible by the script.
Update YOLOv5: Make sure you're using the latest version of YOLOv5 by updating your local repository.
Debugging: Add print statements before the error line to print out the values of box
and label
. This can help you identify if and where NaN values are coming from.
Review Changes: If you've made any changes to the code, review those changes to ensure they're not causing the issue.
If you've tried these steps and the issue persists, please provide additional details such as the exact command you're running, a snippet of the annotation file for one of the images that's causing the error, and any modifications you've made to the code. This information will be crucial in diagnosing the problem more effectively.
Remember, the more specific you can be about your setup and the issue, the easier it will be to provide assistance. 👍
I had the same issue. Resolved by matching image size (--img-size
) of the input and model (the --img-size
passed to train.py
).
@tosfaq Great to hear you resolved the issue! 🎉 Matching the --img-size
parameter between training and detection is indeed crucial for maintaining consistency in how the model processes images. Thanks for sharing your solution with the community! If anyone else encounters similar issues, ensuring that the image sizes align during both training and detection can be a helpful check. Happy detecting!
Search before asking
Question
After I have completed all the required configurations of yolov5 in Ubuntu20.04, I run the "ppython detect.py --source data/images/ --weights yolov5s.pt" code, it occurs:
python detect.py --source data/images/ --weights yolov5s.pt detect: weights=['yolov5s.pt'], source=data/images/, data=data/coco128.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=True, 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, vid_stride=1 YOLOv5 🚀 v7.0-187-g0004c74 Python-3.7.0 torch-1.8.0 CUDA:0 (NVIDIA GeForce RTX 3060 Laptop GPU, 5947MiB)
Fusing layers... YOLOv5s summary: 213 layers, 7225885 parameters, 0 gradients, 16.4 GFLOPs Traceback (most recent call last): File "detect.py", line 261, in
main(opt)
File "detect.py", line 256, in main
run(*vars(opt))
File "/home/max/anaconda3/envs/new_env/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(args, **kwargs)
File "detect.py", line 173, in run
annotator.box_label(xyxy, label, color=colors(c, True))
File "/home/maxime/vision/yolov5/utils/plots.py", line 103, in box_label
p1, p2 = (int(box[0]), int(box[1])), (int(box[2]), int(box[3]))
ValueError: cannot convert float NaN to integer
i want to know how to fix this issue.The images are example images(bus)
Additional
No response