if self._stop_iteration():
break
if self._should_skip(image_id=line["ImageID"]):
continue
// Filter group annotations (we only want single instances)
if line["IsGroupOf"] == "1":
continue
if line["ImageID"] != current_image_id:
// Yield if image changes and we have current image.
if current_image_id is not None:
if len(partial_record["gt_boxes"]) > 0:
records_queue.put(partial_record)
else:
tf.logging.debug(
"Dropping record {} without gt_boxes.".format(
partial_record))
// Start new record.
current_image_id = line["ImageID"]
partial_record = {
"filename": current_image_id,
"gt_boxes": []
}
// Append annotation to current record.
try:
// LabelName may not exist because not all labels are
// trainable
label = self.trainable_labels.index(line["LabelName"])
except ValueError:
continue
if self._should_skip(label=label):
continue
self._per_class_counter[label] += 1
partial_record["gt_boxes"].append({
"xmin": float(line["XMin"]),
"ymin": float(line["YMin"]),