Skip to content

bugfix - downloading yolov8 files incorrectly amends data.yaml - #334

Merged
tonylampada merged 4 commits into
mainfrom
fix-yaml-yolo
Oct 15, 2024
Merged

bugfix - downloading yolov8 files incorrectly amends data.yaml#334
tonylampada merged 4 commits into
mainfrom
fix-yaml-yolo

Conversation

@tonylampada

Copy link
Copy Markdown
Collaborator

Description

Our train notebooks like train-yolov8-object-detection-on-custom-dataset.ipynb are having to do weird yaml amending like

CleanShot 2024-10-11 at 14 31 41

When you export a dataset in yolov8 format from the UI, you get a correct yaml that has

train: ../train/images
val: ../valid/images
test: ../test/images

But if download it with roboflow-python you get a modified yaml like

test: ../test/images
train: football-players-detection-12/train/images
val: football-players-detection-12/valid/images

It's not good that the train notebook needs to undo the mistake of roboflow-python

This PR fixes that mistake.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How has this change been tested, please provide a testcase or example of how you tested the change?

Tested locally

@tonylampada tonylampada changed the title Fix yaml yolo bugfix - downloading yolov8 files incorrectly amends data.yaml Oct 11, 2024
Comment thread roboflow/core/version.py
self.__download_zip(link, location, model_format)
self.__extract_zip(location, model_format)
self.__reformat_yaml(location, model_format)
self.__reformat_yaml(location, model_format) # TODO: is roboflow-python a place to be munging yaml files?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I speculate, based on 2 days of experience with this:

In the past - yes. data.yml used to contain path, providing a path to the dataset. This would be based on where the dataset is located on the system. Now, yolov8 and yolo11 do not require that, but I don't know about other models.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not fix the path attribute. It will leave the train/test/val attributes untouched with the original content that was downloaded.
There's this other PR on Annotation.js that will remove that.

Comment thread roboflow/core/version.py
content["train"] = location + content["train"].lstrip(".")
content["val"] = location + content["val"].lstrip(".")
content["test"] = location + content["test"].lstrip(".")
if format in ["yolov5pytorch", "yolov7pytorch", "yolov8", "yolov9"]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should test yolov9 as well. I thiiiiink it was yolov5-based? Could be that it needs special treatment like this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let's release this and we can test that ;-)

Comment thread roboflow/core/version.py
)
# silently fail
pass

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to remove rather than keep, but let me paint an alternative.

This serves 3 purposes:

  • Tell user if the version is too new (e.g. known to not work, but only at this time point)
  • Tell user if they're not using ultralytics that we assume they need it
  • Tell the maintainer that ultralytics is required.

In the ideal world, we'd instead soften the wording, saying something akin to "When working with yolov8, roboflow works best with ultralytics<=8.2.103. You can install it with ..."

This way, the message is not exactly incorrect in the future, but still gives good info to users.

Leaving it to you to decide what we do. Removal is also fine, in my opinion 🙂

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm idk, IMO this is the wrong place to do this.
Theres many reasons a user might want to download a version.
It's too weird to be checking ultralytics version as part of downloading a zip file.

@tonylampada tonylampada self-assigned this Oct 13, 2024
@tonylampada
tonylampada merged commit 7fe28e5 into main Oct 15, 2024
@LinasKo

LinasKo commented Oct 15, 2024

Copy link
Copy Markdown
Contributor

Than you very much @tonylampada!

There's an initiative in making the notebooks more reliable next week - we'll test it then.

@iurisilvio
iurisilvio deleted the fix-yaml-yolo branch August 27, 2025 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants