Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with incorrect image filename generated in annotations #296

Merged
merged 1 commit into from
Aug 15, 2019

Conversation

cfezequiel
Copy link
Contributor

This fixes a bug in annotation.read_from_pascal where the image filename is ignored, resulting one of the callers, dataset.gen_csv_from_annotations using the annotation filename instead in the output CSV.

This also adds os.path.expanduser calls whenever a file or directory is read to support home-relative directory paths.

Eng. Council bug ID: b/137942099

@googlebot googlebot added the cla: yes All committers have signed a CLA label Aug 9, 2019
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines. label Aug 9, 2019
"""

with gfile.GFile(filename) as f:
tree = ET.parse(f)

root = tree.getroot()
image_filename = root.find('filename').text

Choose a reason for hiding this comment

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

can we be guaranteed this will be found?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Image labeling tools that support the PASCAL VOC format should include the source image 'filename' in the output annotation XML file. If the 'filename' element is not found then this function will throw an exception.

@EricBeach EricBeach merged commit a593a32 into GoogleCloudPlatform:master Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes All committers have signed a CLA size/M Denotes a PR that changes 30-99 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants