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: Image filename issue resolved #305

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions voc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def parse_voc_annotation(ann_dir, img_dir, cache_name, labels=[]):

for elem in tree.iter():
if 'filename' in elem.tag:
img['filename'] = img_dir + elem.text
# split will just take image name
# to avoid full path annotation errors
img['filename'] = img_dir + elem.text.split('/')[-1]
if 'width' in elem.tag:
img['width'] = int(elem.text)
if 'height' in elem.tag:
Expand Down Expand Up @@ -64,4 +66,4 @@ def parse_voc_annotation(ann_dir, img_dir, cache_name, labels=[]):
with open(cache_name, 'wb') as handle:
pickle.dump(cache, handle, protocol=pickle.HIGHEST_PROTOCOL)

return all_insts, seen_labels
return all_insts, seen_labels