From 38fff78212b3bff88f1c5a3c5423011234e12e64 Mon Sep 17 00:00:00 2001 From: Han Xiao Date: Fri, 12 Jul 2019 14:33:43 +0800 Subject: [PATCH] fix(preprocessor): move cv2 dep to pic_weight --- gnes/preprocessor/video/ffmpeg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnes/preprocessor/video/ffmpeg.py b/gnes/preprocessor/video/ffmpeg.py index 47bdb2d9..33d6c488 100644 --- a/gnes/preprocessor/video/ffmpeg.py +++ b/gnes/preprocessor/video/ffmpeg.py @@ -14,7 +14,6 @@ # limitations under the License. from typing import List -import cv2 import numpy as np from .base import BaseVideoPreprocessor @@ -72,6 +71,7 @@ def apply(self, doc: 'gnes_pb2.Document') -> None: @staticmethod def pic_weight(images: List['np.ndarray']) -> List[float]: + import cv2 weight = np.zeros([len(images)]) # n_channel is usually 3 for RGB images n_channel = images[0].shape[-1]