def test_count(self): with deepstar_path(): VideoModel().insert('test1', 'test2') FrameSetModel().insert(1) frame_model = FrameModel() frame_model.insert(1, 0) frame_model.insert(1, 0) frame_model.insert(1, 0) self.assertEqual(frame_model.count(1), 3)
def test_count_rejected_false(self): with deepstar_path(): VideoModel().insert('test1', 'test2') FrameSetModel().insert(1) frame_model = FrameModel() frame_model.insert(1, 0) frame_model.insert(1, 1) frame_model.insert(1, 0) self.assertEqual(frame_model.count(1, rejected=False), 2)
def list(self, frame_set_id): """ This method lists frames in the frame collection for a frame set. :param int frame_set_id: The frame set ID. :raises: CommandLineRouteHandlerError :rtype: None """ result = FrameSetModel().select(frame_set_id) if result is None: raise CommandLineRouteHandlerError( f'Frame set with ID {frame_set_id:08d} not found') frame_model = FrameModel() count = frame_model.count(frame_set_id) debug(f'{count} results', 3) debug('id | fk_frame_sets | rejected | (width | height)', 3) debug('------------------------------------------------', 3) if count == 0: return length = int(os.environ.get('MODEL_LIST_LENGTH', '100')) offset = 0 p1 = FrameSetSubDir.path(frame_set_id) while True: frames = frame_model.list(frame_set_id, length=length, offset=offset) if not frames: break for frame in frames: p2 = FrameFile.path(p1, frame[0], 'jpg') height, width, _ = cv2.imread(p2).shape debug( f'{frame[0]} | {frame[1]} | {frame[2]} | ({width} | ' f'{height})', 3) offset += length
def test_count(self): with deepstar_path(): FrameSetModel().insert(None) frame_model = FrameModel() frame_model.insert(1, 0) frame_model.insert(1, 0) frame_model.insert(1, 0) TransformSetModel().insert('test', 1) transform_model = TransformModel() transform_model.insert(1, 1, '{}', 0) transform_model.insert(1, 2, '{}', 0) transform_model.insert(1, 3, '{}', 0) self.assertEqual(frame_model.count(1), 3)