From dfb54b62c523ff78187708ad10999ebb90102c1d Mon Sep 17 00:00:00 2001 From: raccoonliukai <903896015@qq.com> Date: Thu, 22 Aug 2019 00:33:22 +0800 Subject: [PATCH] fix(video preprocessor): Remove incorrect comments --- gnes/preprocessor/helper.py | 1 - gnes/preprocessor/video/shotdetect.py | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gnes/preprocessor/helper.py b/gnes/preprocessor/helper.py index 25d58d49..4620e0cd 100644 --- a/gnes/preprocessor/helper.py +++ b/gnes/preprocessor/helper.py @@ -404,7 +404,6 @@ def thre_algo(distances: List[float], **kwargs) -> List[int]: def motion_algo(distances: List[float], **kwargs) -> List[int]: import peakutils - """ Returns the list of peaks in the ECR serie""" arg_dict = { 'threshold': 0.6, 'min_dist': 10, diff --git a/gnes/preprocessor/video/shotdetect.py b/gnes/preprocessor/video/shotdetect.py index 5fbe56bb..aee0cdca 100644 --- a/gnes/preprocessor/video/shotdetect.py +++ b/gnes/preprocessor/video/shotdetect.py @@ -78,12 +78,12 @@ def apply(self, doc: 'gnes_pb2.Document') -> None: if doc.raw_bytes: shot_frames, num_frames = self.detect_from_bytes(doc.raw_bytes) - for ci in range(0, len(shot_frames)): + for ci, value in enumerate(shot_frames): c = doc.chunks.add() c.doc_id = doc.doc_id - chunk = np.array(shot_frames[ci]).astype('uint8') + chunk = np.array(value).astype('uint8') c.blob.CopyFrom(array2blob(chunk)) c.offset_1d = ci - c.weight = len(shot_frames[ci]) / num_frames + c.weight = len(value) / num_frames else: self.logger.error('bad document: "raw_bytes" is empty!')