Fix importing VOC dataset with incorrect filename properties. Fix copying images after export. #122
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Greetings,
When working with this package, I had two issues in importing a VOC dataset and exporting it to YoloV5 with images.
When importing a VOC dataset in pylabel, the filename property of each .xml annotation file is used to determine the name of the image name. That name is then used when exporting the dataset to other formats.
In case the name is incorrect or is empty, this process fails and when exporting we do not get the correct number of annotations back. For example, if all .xml files had the same 'filename' property, we only get one file after export.
I fixed it by looking through the images directory and looking for an image with the same name as the annotations file.
Another issue this fixes in exporter.py is when copying images if exporting to YoloV5. In the code, the annotation path is merged with the images path, which generates an incorrect path for the images. I fixed it by commenting the annotation path in the Path concatenation code.
I hope my changes will not break any functionality. Please let me know if there is a better way to solve my issue.
Thank you for making this package public.
Kind regards,
Yaser.