-
-
Notifications
You must be signed in to change notification settings - Fork 16k
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
Image not found yolo v8l #11890
Comments
👋 Hello @puneet2059, 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. RequirementsPython>=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 EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf 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. Introducing YOLOv8 🚀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 |
@puneet2059 make sure to verify that the image paths in your dataset configuration file ( Please double-check the following:
If you have confirmed that the image paths are correct, try printing out some of the image paths during data loading to see if there is anything unusual. You can add a few lines of code to YOLOv5's ...
def load_image(self, index):
image_path = self.image_files[index] # Add this line to print the image path
print(f"Loading image: {image_path}")
im = ...
... Please let me know if you continue to encounter issues or need any further assistance. |
hi I did this to check whether I have all the files or not def check_files_exist(image_folder, label_folder):
Example usage:images_folder = "/content/drive/MyDrive/Colab Notebooks/train/images" missing_images, missing_labels = check_files_exist(images_folder, labels_folder) if len(missing_images) > 0: if len(missing_labels) > 0: |
@puneet2059 it seems that the code you provided is correctly checking for missing image and label files in the specified directories. However, it is strange that the missing files are being reported even though they are present in your drive. To troubleshoot this issue, I recommend the following steps:
If you have completed these steps and are still experiencing the issue, please provide more context or additional code snippets that may help us understand and debug the problem further. |
AssertionError Traceback (most recent call last) 7 frames /usr/local/lib/python3.10/dist-packages/ultralytics/yolo/engine/trainer.py in train(self) /usr/local/lib/python3.10/dist-packages/ultralytics/yolo/engine/trainer.py in _do_train(self, rank, world_size) /usr/local/lib/python3.10/dist-packages/tqdm/std.py in iter(self) /usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py in next(self) /usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py in _next_data(self) /usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py in _process_data(self, data) /usr/local/lib/python3.10/dist-packages/torch/_utils.py in reraise(self) AssertionError: Caught AssertionError in DataLoader worker process 1. |
do you think changing image and label name can help ? |
@puneet2059 changing the image and label names may help resolve the issue you are facing. By simplifying the names and removing special characters, you can eliminate any potential file naming discrepancies that might cause the DataLoader to fail in finding the images. I suggest modifying the names to a simple format, such as 'IMG0193.jpg' for the image and 'IMG0193.txt' for the corresponding label. Ensure that both the image and label files have the same base name and appropriate extensions. After making the changes, update your dataset configuration file ( Once you have made these adjustments, try running the training process again and see if the error persists. Let me know if you have any further questions or encounter any other issues. |
But there is one thing that I have already run this model on the same images but at that time they were unprocessed and then it was working. But now it is very weird that I am getting this error. |
@puneet2059 hi, It's strange that you are encountering this error after running the model on the same images without any issues before. It's possible that some changes or processing done to the images may be causing the problem. To troubleshoot this issue, I recommend the following steps:
By carefully reviewing these factors, you should be able to pinpoint the cause of the error and resolve it. If you have any further questions or need additional assistance, please don't hesitate to ask. Thank you. |
Is it by any chance that since I am using free version of google collab and that's the reason why its showing error after sometime ? |
@puneet2059 hi there, Using the free version of Google Colab should not be the cause of the error you are experiencing while running YOLOv5. The free version of Google Colab provides limited computational resources, such as GPU and storage space, but it should not impact the functionality or stability of the model itself. The error you are facing might be related to other factors, such as incorrect image or label file paths, unsupported image formats, or issues with the data preprocessing steps. I recommend double-checking these aspects to ensure everything is set up correctly. If you are still encountering the error after verifying these factors, please provide more details, such as the specific error message or traceback, any recent changes you made to the code or data, and any other relevant information. This will help us further investigate and assist you in resolving the issue. Let me know if you have any more questions or need additional help. Thank you. |
I tried again with same image name but the only difference was that i used 1300 images and it ran successfully with 50 epochs . |
@puneet2059 hi there, That's great to hear that you were able to run the YOLOv5 model successfully with 1300 images and 50 epochs! It's possible that the previous error you encountered was specific to the image processing or data loading for a particular subset of images. If you encounter any further issues or have any questions, feel free to ask. We're here to assist you. Thank you. |
👋 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 ⭐ |
I did have exactly the same issue "AssertionError: Image Not Found" after a certain number of epochs. With the same dataset in the folder, for most times, it can run successfully for 150 epochs... Not sure why sometimes it stuck after several epochs at a random Image Not Found. I've verified that the image file did exist there. |
I tried this with Google Colab plus it worked fine every time I run. That's the only change I did. |
@yiluzhou1 hi there, Thank you for sharing your experience with running YOLOv5 on Google Colab. It's great to hear that you were able to run it successfully without encountering the "Image Not Found" issue. In some cases, running the code on different platforms or environments can have an impact on the execution and stability of the training process. It's possible that the issue you encountered previously may have been specific to your local setup. If you have any further questions or concerns, feel free to reach out. We're here to assist you. Thank you. |
Thanks for your response! I've tried num_workers=1, the "Image Not Found" issue persists occasionally. Unfortunately, I couldn't use other platforms or Google Colab, as I'm doing training on internal clinical images. Probably I can add "try... except" in dataloaders.py to bypass this error in case of unsuccessful read images. |
@yiluzhou1 thanks for your response! It's unfortunate that the "Image Not Found" issue still persists occasionally even after trying One possible approach to handle the "Image Not Found" issue is to add a Feel free to give this approach a try and let us know if it resolves the issue for you. If you have any further questions or need additional assistance, feel free to ask. We're here to help. Thank you. |
I am training a yolo v8l model with input image 512*512 (3400 images) .
Model will run for 35 epochs and then show
AssertionError Traceback (most recent call last)
in <cell line: 3>()
1 from ultralytics import YOLO
2 model=YOLO("yolov8l.yaml")
----> 3 results=model.train(data="/content/drive/MyDrive/Colab Notebooks/yolo/data.yaml",epochs=50,batch=2)
7 frames
/usr/local/lib/python3.10/dist-packages/torch/_utils.py in reraise(self)
642 # instantiate since we don't know how to
643 raise RuntimeError(msg) from None
--> 644 raise exception
645
646
AssertionError: Caught AssertionError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop
data = fetcher.fetch(index)
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py", line 51, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.10/dist-packages/ultralytics/yolo/data/base.py", line 180, in getitem
return self.transforms(self.get_label_info(index))
File "/usr/local/lib/python3.10/dist-packages/ultralytics/yolo/data/base.py", line 184, in get_label_info
label["img"], label["ori_shape"], label["resized_shape"] = self.load_image(index)
File "/usr/local/lib/python3.10/dist-packages/ultralytics/yolo/data/base.py", line 123, in load_image
assert im is not None, f"Image Not Found {f}"
AssertionError: Image Not Found /content/drive/MyDrive/Colab Notebooks/yolo/train/images/sub_image_1_0_IMG_0393.JPG
This error keeps changing with different image names, but when I check my images and label folder, everything is there. I referred to previously given solutions like removing the cache file if present and checking the presence of image and the right format.
But everything looks pefect.
The text was updated successfully, but these errors were encountered: