Fix object detector pascal voc dataloader issue

PiperOrigin-RevId: 520160549
This commit is contained in:
MediaPipe Team 2023-03-28 16:03:56 -07:00 committed by Copybara-Service
parent 1e77725a15
commit 9ee02481b1

View File

@ -444,8 +444,8 @@ class PascalVocCacheFilesWriter(CacheFilesWriter):
images_dir = os.path.join(data_dir, 'images') images_dir = os.path.join(data_dir, 'images')
all_annotation_paths = tf.io.gfile.glob(annotations_dir + r'/*.xml') all_annotation_paths = tf.io.gfile.glob(annotations_dir + r'/*.xml')
data = collections.defaultdict(list)
for ind, ann_file in enumerate(all_annotation_paths): for ind, ann_file in enumerate(all_annotation_paths):
data = collections.defaultdict(list)
tree = ET.parse(ann_file) tree = ET.parse(ann_file)
root = tree.getroot() root = tree.getroot()
img_filename = _xml_get(root, 'filename').text img_filename = _xml_get(root, 'filename').text