Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
felix committed Oct 11, 2019
1 parent 6adc053 commit 4a5e984
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions gnes/encoder/video/inception.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ def encode(self, data: List['np.ndarray'], *args,
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))]

def _resize(x):
self.logger.info('image shape: %s' % str(x.shape))
return np.array(Image.fromarray(x).resize((self.inception_size_x, self.inception_size_y)), dtype=np.float32) * 2 / 255. - 1.
_resize = lambda x: np.array(Image.fromarray(x).resize((self.inception_size_x, self.inception_size_y)), dtype=np.float32) * 2 / 255. - 1.

images = [_resize(im) for v in data for im in v]

Expand All @@ -81,6 +79,6 @@ def _encode(self, data):
feed_dict={self.inputs: data})
return end_points_[self.select_layer]

encodes = _encode(images).astype(np.float32)
encodes = _encode(self, images).astype(np.float32)

return [encodes[s:e].copy() for s, e in zip(pos_start, pos_end)]

0 comments on commit 4a5e984

Please sign in to comment.