From 46b5c94eea4973e3f1b2dcb05e85981f316a4ca3 Mon Sep 17 00:00:00 2001 From: Larry Yan Date: Thu, 1 Aug 2019 14:52:31 +0800 Subject: [PATCH] fix(encoder): fix name for video encoder --- gnes/encoder/base.py | 2 +- gnes/encoder/video/incep_mixture.py | 6 +++--- gnes/helper.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gnes/encoder/base.py b/gnes/encoder/base.py index 6fb45b7c..d21ad3aa 100644 --- a/gnes/encoder/base.py +++ b/gnes/encoder/base.py @@ -40,7 +40,7 @@ def encode(self, img: List['np.ndarray'], *args, **kwargs) -> np.ndarray: class BaseVideoEncoder(BaseEncoder): - def encode(self, videos: List['np.ndarray'], *args, **kwargs) -> np.ndarray: + def encode(self, data: List['np.ndarray'], *args, **kwargs) -> np.ndarray: pass diff --git a/gnes/encoder/video/incep_mixture.py b/gnes/encoder/video/incep_mixture.py index 60a7710d..2c5a8a3f 100644 --- a/gnes/encoder/video/incep_mixture.py +++ b/gnes/encoder/video/incep_mixture.py @@ -103,14 +103,14 @@ def post_init(self): saver.restore(self.sess2, self.model_dir_mixture) @batching - def encode(self, videos: List['np.ndarray'], *args, **kwargs) -> np.ndarray: + def encode(self, data: List['np.ndarray'], *args, **kwargs) -> np.ndarray: ret = [] - v_len = [len(v) for v in videos] + v_len = [len(v) for v in data] pos_start = [0] + [sum(v_len[:i+1]) for i in range(len(v_len)-1)] pos_end = [sum(v_len[:i+1]) for i in range(len(v_len))] max_len = min(max(v_len), self.max_frames) - img = [im for v in videos for im in v] + img = [im for v in data for im in v] img = [(np.array(Image.fromarray(im).resize((self.inception_size_x, self.inception_size_y)), dtype=np.float32) * 2 / 255. - 1.) for im in img] diff --git a/gnes/helper.py b/gnes/helper.py index 9758aa02..7e69b0bf 100644 --- a/gnes/helper.py +++ b/gnes/helper.py @@ -48,8 +48,8 @@ def get_first_available_gpu(): try: import GPUtil r = GPUtil.getAvailable(order='random', - maxMemory=0.1, - maxLoad=0.1, + maxMemory=0.5, + maxLoad=0.5, limit=1) if r: return r[0]