Ejemplo n.º 1
0
def import_frame_json(f, frame_index, event_id, video_id):
    regions = []
    df = Frame()
    df.video_id = video_id
    df.event_id = event_id
    df.frame_index = frame_index
    df.name = f['path']
    for r in f.get('regions', []):
        regions.append(import_region_json(r, frame_index, video_id, event_id))
    return df, regions
Ejemplo n.º 2
0
 def create_frame(self, f):
     df = Frame()
     df.video_id = self.video.pk
     df.name = f['name']
     df.frame_index = f['frame_index']
     df.h = f.get('h', 0)
     df.w = f.get('w', 0)
     df.t = f.get('t', 0)
     df.event_id = self.event_to_pk[f['event']]
     df.segment_index = f.get('segment_index', 0)
     df.keyframe = f.get('keyframe', False)
     return df
Ejemplo n.º 3
0
def import_frame_json(f, frame_index, event_id, video_id):
    regions = []
    df = Frame()
    df.video_id = video_id
    df.event_id = event_id
    df.frame_index = frame_index
    df.name = f['path']
    for r in f.get('regions', []):
        dr = Region()
        dr.frame_index = frame_index
        dr.video_id = video_id
        dr.event_id = event_id
        dr.object_name = r['object_name']
        dr.region_type = r.get('region_type', Region.ANNOTATION)
        dr.full_frame = r.get('full_frame', False)
        dr.x = r.get('x', 0)
        dr.y = r.get('y', 0)
        dr.w = r.get('w', 0)
        dr.h = r.get('h', 0)
        dr.confidence = r.get('confidence', 0.0)
        dr.text = r.get('text', None)
        dr.metadata = r.get('metadata', None)
        regions.append(dr)
    return df, regions