"magic_pdf/git@developer.sourcefind.cn:wangsen/mineru.git" did not exist on "0e2d0b8b4fcc720140589e2ba3817e50393e77b5"
Commit 9da43afc authored by Kaushik Shivakumar's avatar Kaushik Shivakumar
Browse files

changes

parent af7044ae
...@@ -213,10 +213,7 @@ class Ava(object): ...@@ -213,10 +213,7 @@ class Ava(object):
0 if seconds_per_sequence % 2 == 0 else 1) 0 if seconds_per_sequence % 2 == 0 else 1)
end_time = middle_frame_time + (seconds_per_sequence // 2) end_time = middle_frame_time + (seconds_per_sequence // 2)
total_xmins = [] total_boxes = []
total_xmaxs = []
total_ymins = []
total_ymaxs = []
total_labels = [] total_labels = []
total_label_strings = [] total_label_strings = []
total_images = [] total_images = []
...@@ -243,38 +240,31 @@ class Ava(object): ...@@ -243,38 +240,31 @@ class Ava(object):
total_source_ids.append(source_id) total_source_ids.append(source_id)
total_is_annotated.append(1) total_is_annotated.append(1)
xmins = [] boxes = []
xmaxs = []
ymins = []
ymaxs = []
labels = [] labels = []
label_strings = [] label_strings = []
confidences = [] confidences = []
for row in frame_annotations[(media_id, windowed_timestamp)]: for row in frame_annotations[(media_id, windowed_timestamp)]:
if len(row) > 2 and int(row["action_label"]) in label_map: if len(row) > 2 and int(row["action_label"]) in label_map:
xmins.append(float(row["xmin"])) boxes.append([float(row["ymin"]), float(row["xmin"]),
xmaxs.append(float(row["xmax"])) float(row["ymax"]), float(row["xmax"])])
ymins.append(float(row["ymin"]))
ymaxs.append(float(row["ymax"]))
labels.append(int(row["action_label"])) labels.append(int(row["action_label"]))
label_strings.append(label_map[int(row["action_label"])]) label_strings.append(label_map[int(row["action_label"])])
confidences.append(1) confidences.append(1)
else: else:
logging.warning("Unknown label: %s", row["action_label"]) logging.warning("Unknown label: %s", row["action_label"])
total_xmins.append(xmins) total_boxes.append(boxes)
total_xmaxs.append(xmaxs)
total_ymins.append(ymins)
total_ymaxs.append(ymaxs)
total_labels.append(labels) total_labels.append(labels)
total_label_strings.append(label_strings) total_label_strings.append(label_strings)
total_confidences.append(confidences) total_confidences.append(confidences)
windowed_timestamp += 1 windowed_timestamp += 1
if len(total_xmins) > 0: if len(total_boxes) > 0:
print(total_boxes)
yield seq_example_util.make_sequence_example("AVA", media_id, total_images, yield seq_example_util.make_sequence_example("AVA", media_id, total_images,
int(height), int(width), 'jpeg', total_source_ids, None, total_is_annotated, int(height), int(width), 'jpeg', total_source_ids, None, total_is_annotated,
[list(z) for z in zip(ymins, xmins, ymaxs, xmaxs)], total_label_strings) total_boxes, total_label_strings)
#Move middle_time_frame, skipping excluded frames #Move middle_time_frame, skipping excluded frames
frames_mv = 0 frames_mv = 0
......
...@@ -138,7 +138,7 @@ def boxes_to_box_components(bboxes): ...@@ -138,7 +138,7 @@ def boxes_to_box_components(bboxes):
xmax_list = [] xmax_list = []
for bbox in bboxes: for bbox in bboxes:
bbox = np.array(bbox).astype(np.float32) bbox = np.array(bbox).astype(np.float32)
ymin, xmin, ymax, xmax = np.split(bbox, 4, axis=0) ymin, xmin, ymax, xmax = np.split(bbox, 4, axis=1)
ymin_list.append(np.reshape(ymin, [-1])) ymin_list.append(np.reshape(ymin, [-1]))
xmin_list.append(np.reshape(xmin, [-1])) xmin_list.append(np.reshape(xmin, [-1]))
ymax_list.append(np.reshape(ymax, [-1])) ymax_list.append(np.reshape(ymax, [-1]))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment