Closed BehdadSDP closed 7 months ago
@BehdadSDP hello 👋,
Great question! In YOLOv5, to ensure that two Dataloaders produce batches with the same images but with domain-specific differences (e.g., clear and foggy versions of the same scene), you would likely need to modify the data loading and augmentation pipeline directly. A practical approach would be to customize the LoadImagesAndLabels
class to support paired data loading. This implies that for each batch, your modified loader reads both the original and domain-transformed versions of each image and applies the exact same augmentations to both versions synchronously.
Here's a conceptual outline of what you might consider doing:
This approach requires a good understanding of both the YOLOv5 dataset management code and PyTorch's data handling mechanisms.
For a detailed look at YOLOv5's data loading and processing mechanisms, our documentation is always a helpful resource: https://docs.ultralytics.com/yolov5/.
I hope this sets you on the right path! Let us know how it goes.
@BehdadSDP hello 👋,
Great question! In YOLOv5, to ensure that two Dataloaders produce batches with the same images but with domain-specific differences (e.g., clear and foggy versions of the same scene), you would likely need to modify the data loading and augmentation pipeline directly. A practical approach would be to customize the
LoadImagesAndLabels
class to support paired data loading. This implies that for each batch, your modified loader reads both the original and domain-transformed versions of each image and applies the exact same augmentations to both versions synchronously.Here's a conceptual outline of what you might consider doing:
- Modify the dataset class to accept two directories (one for each domain).
- Ensure that for each batch, the class loads paired images (one from each directory).
- Apply the same augmentations to both images in the pair. This is crucial and can be achieved by ensuring the randomness in augmentations is controlled (e.g., by setting seeds) for each pair.
This approach requires a good understanding of both the YOLOv5 dataset management code and PyTorch's data handling mechanisms.
For a detailed look at YOLOv5's data loading and processing mechanisms, our documentation is always a helpful resource: https://docs.ultralytics.com/yolov5/.
I hope this sets you on the right path! Let us know how it goes.
thank you so much. DONE.
@BehdadSDP You're welcome! 😊 If you have any more questions or need further assistance as you implement this, feel free to reach out. Happy coding and best of luck with your project!
Search before asking
Question
Hello friends,
Imagine I have two datasets with the same images (same scene) but different domains (e.g., clear weather and foggy images). Is it possible in YOLOv5 to create two Dataloaders with similar augmentation methods? I mean, every time the Data Loader returns images based on the number of batches, I want these images to be similar in all aspects just have different domains. I've checked seed=opt.seed in _createdataloader it seems it is for pytorch Dataloader not for LoadImagesAndLabels because augmentaiton methods apply in this class.
thanks
Additional
No response