ultralytics / ultralytics

Ultralytics YOLO11 🚀
https://docs.ultralytics.com
GNU Affero General Public License v3.0
31.4k stars 6.04k forks source link

How to print image load order in ultralytics #16863

Open slwgsc opened 1 week ago

slwgsc commented 1 week ago

Search before asking

Question

How to print out the order in which the model loads the images of the dataset to verify that the model is trained and reasoned in the order given in the dataset, and can you give the specific modification code for this?

Additional

No response

UltralyticsAssistant commented 1 week ago

👋 Hello @slwgsc, thank you for your interest in Ultralytics 🚀! We recommend checking the Docs for guidance, where you can find useful examples and methods related to data handling.

If this involves a specific 🐛 Bug Report, please provide a minimum reproducible example to assist us in debugging.

If this is a ❓ Question about custom training or image processing, we suggest sharing more details about your setup or what you aim to achieve. This could include data samples or configurations related to image loading.

Feel free to join our community for discussions! Engage in real-time on Discord 🎧, have in-depth chats on Discourse, or connect with others on our Subreddit.

Upgrade

Ensure that you are using the latest ultralytics package with all requirements met in a Python>=3.8 environment with PyTorch>=1.8:

pip install -U ultralytics

Environments

You can also explore YOLO on various verified environments with preinstalled dependencies:

Status

Ultralytics CI

If the CI badge is green, all Ultralytics CI tests are passing, ensuring functionality across platforms.

This is an automated response; an Ultralytics engineer will further assist you soon. 😊

Y-T-G commented 1 week ago

The training dataset is shuffled each epoch. So there's no particular order.

After you finish training, you can access the train dataloader at model.trainer.train_loader

>>> for i in model.trainer.train_loader:
...     print(i["im_file"])
...     break                                                     ...
['/datasets/coco128/images/train2017/000000000536.jpg', '/datasets/coco128/images/train2017/000000000542.jpg', '/datasets/coco128/images/train2017/000000000071.jpg', '/datasets/coco128/images/train2017/000000000562.jpg']

It's going to be different each time.