Closed yasirgultak closed 11 months ago
👋 Hello @yasirgultak, thank you for your interest in YOLOv8 🚀! We recommend a visit to the YOLOv8 Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered.
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.
Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.
Pip install the ultralytics
package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.
pip install ultralytics
YOLOv8 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 Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.
I solved it :) I had to install albumentations
@yasirgultak great to hear that you've solved your issue! Yes, the Albumentations library is integral for augmentations functions when the augment = True
is set. Make sure to keep your Albumentations library updated for the best results with YOLOv8. If you encounter further challenges or have any additional questions don't hesitate to ask. Happy coding!
@glenn-jocher if i set augment = false
, The Albumentations library still works. What is the difference ? Also i have questions.
1- Does data augmentation with the Albumentations or a cfg file apply all images in train dataset ?
2- Suppose I have 1000 images. After data augmentation, Do we reproduce the images ? or still 1000 images ?
3- There isn't a way to apply custom albumentations without modifying the augment.py file. I tried everything that you said in other issues. I added custom albumentations in my data.yaml
file and i setted augment = True
.
Sorry for my English :)
Thanks..
Hello @yasirgultak,
Congrats on diving deeper into data augmentation with YOLOv8. Now, to answer your queries:
Yes, when you enable data augmentation in either the cfg
configuration file or by using the Albumentations library, the augmentation is applied to all the images in the training dataset.
Data augmentation does apply various modification operations on your images such as rotation, flipping, scaling, but it doesn't increase the number of images in your dataset. The augmentations are applied on-the-fly during training. So, if you start with 1000 images, you will technically still have 1000 images, but they will look different in each epoch due to the applied augmentations.
Custom augmentations can be incorporated by modifying the augment.py file. As it currently stands, the YOLOv8 implementation doesn't support defining custom Albumentation transformations directly in the data.yaml
file. We're constantly working on improving the flexibility of the YOLOv8 system and your suggestion will certainly be considered.
Your English is excellent, by the way, and please don't hesitate to ask if you have more questions. Happy training!
@glenn-jocher Thanks for your answers. I have another questions. I have multiple digit images. Their height 28 and their width 140. 1- if i set image size 640 for training , does yolo resize images to 640x 640 without losses ? I know that it resizes bigger size. What about smaller ? 2- what should i set image size ? 28x140 or 140x140 or 640x640.It will predict just digits. Image s will be taken by iPhone. Is 640 the best for yolo ? 3- if i set image size 140 for training , what should i set image size for prediction ? I'm confused . 140 is easy for yolo but im afraid of that it can not predict iPhone's photos. Thanks.
Hello @yasirgultak,
Sure, let me clarify your doubts one by one.
YOLOv8
does resize images to the specified image size set for training. The resizing is done in such a way that the original aspect ratio of the images is maintained and any leftover space is padded. So, in your case, if you set the image size to 640, your images which are of size 28x140 will be resized such that the longer edge (i.e., width=140) is matched with 640 and the other dimension is scaled accordingly.
While deciding on the image size you should mostly consider your target prediction environment i.e., in your case, images being taken using an iPhone. Hence, a larger image size such as 640x640 would probably suit your need better because high-resolution images captured by the iPhone will contain more information for your model to learn from.
For prediction, you ideally should use the same image size as was used during training so the model can best understand the input. However, you may adjust according to your requirements realizing that truncating or downscaling can make it harder for the model to detect small objects.
Remember, these are guidelines and the optimal setup may require some experimentation based on your specific task and data.
Hope this helps, and I'd be happy to explain further if you need!
@glenn-jocher I'm sorry to bother you. I promise it will be my last question.
1-Does the original image join the training after applying Albumentations? I need original images
2-I added 10 augmentations. After augmentations, does yolo select 1 image ? 3-The P value makes me crayz.. i set all of them to 0.5.If i want to apply 1 augment to 1 image, what should i do ? Also i want to use all augments. For example, First augment to a.jpg Second augment to b.jpg . .
Hello @yasirgultak,
Yes, when Albumentations are applied, the original images are also included in the training. The augmented versions of the images are created on-the-fly during each epoch, while the original images are kept intact.
YOLO doesn't select any specific image after augmentation. Rather, the augmentations are applied at every batch during the training. So, in each batch, different augmentations can be applied to each image, including the possibility of an image remaining uneffected i.e., in its original form.
The 'P' value in Albumentations refers to the probability of the augmentation being applied to a given image. If you set 'P' to 0.5, there is a 50% chance each image will undergo that specific augmentation. To apply each augmentation to each image exactly once, it's a bit tricky as the augmentations occur randomly and are not applied to specific images in sequence. Rather, they're applied on-the-fly and independently to each image during training.
We understand that you wish to apply each augmentation to a different image, but currently, the system applies augmentations randomly across all images, and controlling the order and assignment of augmentations isn't directly supported.
Hope this clears things up. Feel free to ask any other questions you might have. We're here to help. Happy coding!
@glenn-jocher Hello sir, i hope that everything is okay. I have questions.
@yasirgultak hello,
For mobile use, it's generally recommended to use smaller and more computationally efficient models due to the limited resources available on such devices. In the case of YOLOv8, you might want to consider using the 's' variant or 'm' variant of the model for better performance. The 'x' variant, while providing the best accuracy, is also quite resource-intensive and could run slowly or not at all on some mobile devices.
As for instructions on deploying YOLOv8 on Android, there isn't a direct guide available currently in this repo. However, you would typically convert your trained YOLOv8 model into a format compatible with a mobile inference engine, such as TensorFlow Lite or ONNX runtime. You would then integrate this converted model into your Android app and use the mobile inference engine's API to run the model.
The specifics of this process can vary depending on the exact inference engine and deployment scenario. I recommend researching or seeking out sources that delve into the details of deploying these types of models on Android devices.
I hope this answers your questions and wish you the best in creating your app!
@glenn-jocher I appreciate your patience and your answers.
How should I evaluate the success of the model ? Although I have tried different optimizers, the losses do not decrease further and remain constant. I have read on several platforms that the losses should drop to 0.0x levels. Is that true? Also why mAP50-95 value is over .99 ? Wouldn't it be expected to increase slowly under normal conditions?
44.000 images in dataset
Hello @yasirgultak,
Evaluating the success of models largely depends on the problem at hand and the nature of the images in your dataset. Loss decreasing to 0.0x levels is an indicator of a very good performing model but they don't necessarily have to reach that level.
There are a few different metrics for evaluating the performance of your object detection model. You're correct that loss is one indicator, and generally a falling loss during training is a good sign that the model is improving. However, if you notice your loss becoming constant, there may have been overfitting or your model might have already reached its best possible performance on this specific dataset with the current configuration.
Seeing mAP50-95 at over .99 can indeed be a good sign that your model is very performant. That said, it's unusual if this happens very early during the training process. If you see a very high mAP very early, it's worth checking your evaluation dataset to make sure it is representative of the problem space and doesn't overlap with your training data.
44,000 images should be sufficient for good training in most cases. If your performance plateaus, it might be worth considering changes to your model architecture, your data augmentation strategies, or check if your learning rate might be too high.
I hope these tips help you improve your model. Please let us know if you have any further questions!
@glenn-jocher does ALbumentations already work with instance segmentation?
@sarmientoj24 hello,
While Albumentations library is a powerful tool for image augmentations, the integration of instance segmentation with Albumentations depends on the specific implementation in the YOLOv8 framework.
The main role of Albumentations is to provide a variety of ways to augment your images, and yes, it can indeed handle augmentations of instance segmentation maps alongside corresponding images.
However, you should note that a successful operation also depends on whether the YOLOv8 implementation you're using is designed to handle this specific kind of data and whether it's appropriately configured for such tasks.
If you intend to use instance segmentation with YOLOv8, make sure the version of the framework you're using supports this task, as modifications might be necessary for this type of input.
Thank you for your question, and I hope this clears up your doubt. Please don't hesitate to reach out if you have any further queries.
@glenn-jocher Thanks for the heads up. I was referring to the spatial/geometric transforms like Crops.
@sarmientoj24 hello,
Yes, Albumentations provides support for spatial/geometric transforms such as cropping, rotating, and scaling, amongst others. When these transformations are applied as part of Albumentations, they're performed on both the image and its corresponding annotations (bounding box and masks).
It ensures that the transformations are consistent between the image and its annotations so that the relationship between the two is maintained. For example, when cropping an image, the coordinates of the bounding boxes will be adjusted accordingly, so they still correctly denote the position of the object in the transformed image.
However, you need to make sure that your YOLOv8 implementation has been set up to correctly handle these transformations. It's important to consider the impact of these geometric transformations on your model's performance as well.
Let me know if you have more questions. I'll be glad to assist further.
👋 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 ⭐
Search before asking
Question
Hi, Albumation is not done even though I set augment = true. Using Python What should i do ? Thanks
Additional
No response