diff --git a/advanced/databases/replay/4.py b/advanced/databases/replay/4.py index ee591275adba789b1200d2cdffc1c908d21b3d2a..2b96eceba90e79f96003223e8b0629d7df0aef1e 100644 --- a/advanced/databases/replay/4.py +++ b/advanced/databases/replay/4.py @@ -151,13 +151,13 @@ class All(View): elif output == 'annotations': annotations_list = [] - for i in range(obj.annotations.shape[0]): + for annotation in obj.annotations: annotations_list.append({ - 'frame_id': np.uint64(obj.annotations[i][0]), - 'top-left-x': np.int32(obj.annotations[i][1]), - 'top-left-y': np.int32(obj.annotations[i][2]), - 'width': np.int32(obj.annotations[i][3]), - 'height': np.int32(obj.annotations[i][4]) + 'frame_id': np.uint64(annotation[0]), + 'top-left-x': np.int32(annotation[1]), + 'top-left-y': np.int32(annotation[2]), + 'width': np.int32(annotation[3]), + 'height': np.int32(annotation[4]) }) return { @@ -244,13 +244,13 @@ class Templates(View): elif output == 'annotations': annotations_list = [] - for i in range(obj.annotations.shape[0]): + for annotation in obj.annotations: annotations_list.append({ - 'frame_id': np.uint64(obj.annotations[i][0]), - 'top-left-x': np.int32(obj.annotations[i][1]), - 'top-left-y': np.int32(obj.annotations[i][2]), - 'width': np.int32(obj.annotations[i][3]), - 'height': np.int32(obj.annotations[i][4]) + 'frame_id': np.uint64(annotation[0]), + 'top-left-x': np.int32(annotation[1]), + 'top-left-y': np.int32(annotation[2]), + 'width': np.int32(annotation[3]), + 'height': np.int32(annotation[4]) }) return { @@ -348,13 +348,13 @@ class ProbesReal(View): elif output == 'annotations': annotations_list = [] - for i in range(obj.annotations.shape[0]): + for annotation in obj.annotations: annotations_list.append({ - 'frame_id': np.uint64(obj.annotations[i][0]), - 'top-left-x': np.int32(obj.annotations[i][1]), - 'top-left-y': np.int32(obj.annotations[i][2]), - 'width': np.int32(obj.annotations[i][3]), - 'height': np.int32(obj.annotations[i][4]) + 'frame_id': np.uint64(annotation[0]), + 'top-left-x': np.int32(annotation[1]), + 'top-left-y': np.int32(annotation[2]), + 'width': np.int32(annotation[3]), + 'height': np.int32(annotation[4]) }) return { @@ -470,13 +470,13 @@ class ProbesAttack(View): elif output == 'annotations': annotations_list = [] - for i in range(obj.annotations.shape[0]): + for annotation in obj.annotations: annotations_list.append({ - 'frame_id': np.uint64(obj.annotations[i][0]), - 'top-left-x': np.int32(obj.annotations[i][1]), - 'top-left-y': np.int32(obj.annotations[i][2]), - 'width': np.int32(obj.annotations[i][3]), - 'height': np.int32(obj.annotations[i][4]) + 'frame_id': np.uint64(annotation[0]), + 'top-left-x': np.int32(annotation[1]), + 'top-left-y': np.int32(annotation[2]), + 'width': np.int32(annotation[3]), + 'height': np.int32(annotation[4]) }) return {