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

Commit

Permalink
Merge pull request #317 from gnes-ai/fix-preprocessor-name
Browse files Browse the repository at this point in the history
fix(memory-leak): fix memory leak
  • Loading branch information
mergify[bot] authored Oct 10, 2019
2 parents 1878564 + 3cc4b04 commit 9095bfa
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gnes/preprocessor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
'FFmpegVideoSegmentor': 'video.ffmpeg',
'ShotDetectPreprocessor': 'video.shotdetect',
'VideoEncoderPreprocessor': 'video.video_encoder',
'VideoDecoderPreprocessor': 'video.video_decoder',
'AudioVanilla': 'audio.audio_vanilla',
'BaseAudioPreprocessor': 'base',
'RawChunkPreprocessor': 'base',
'GifChunkPreprocessor': 'video.ffmpeg',
'VggishPreprocessor': 'audio.vggish_example',
'VideoDecodePreprocessor': 'video.video_decode',
'FrameSelectPreprocessor': 'video.frame_select'
}

Expand Down
2 changes: 1 addition & 1 deletion gnes/preprocessor/io_utils/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def compile_args(input_fn: str = 'pipe:',
"""Wrapper for various `FFmpeg <https://www.ffmpeg.org/>`_ related applications (ffmpeg,
ffprobe).
"""
args = ['ffmpeg', '-threads', '0']
args = ['ffmpeg', '-threads', '1']

input_args = []
fmt = input_options.pop('format', None)
Expand Down
4 changes: 2 additions & 2 deletions gnes/preprocessor/io_utils/gif.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def capture_frames(input_fn: str = 'pipe:',
if pix_fmt == 'rgba':
depth = 4

frames = np.frombuffer(out,
np.uint8).reshape([-1, height, width, depth])
frames = np.frombuffer(out, np.uint8).copy()
frames = frames.reshape([-1, height, width, depth])
return frames


Expand Down
4 changes: 2 additions & 2 deletions gnes/preprocessor/io_utils/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ def capture_frames(input_fn: str = 'pipe:',
if pix_fmt == 'rgba':
depth = 4

frames = np.frombuffer(out,
np.uint8).reshape([-1, height, width, depth])
frames = np.frombuffer(out, np.uint8).copy()
frames = frames.reshape([-1, height, width, depth])
return frames


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from ..io_utils import video as video_util


class VideoDecodePreprocessor(BaseVideoPreprocessor):
class VideoDecoderPreprocessor(BaseVideoPreprocessor):
store_args_kwargs = True

def __init__(self,
Expand Down
3 changes: 2 additions & 1 deletion gnes/proto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def blob2array(blob: 'gnes_pb2.NdArray') -> np.ndarray:
"""
Convert a blob proto to an array.
"""
return np.frombuffer(blob.data, dtype=blob.dtype).reshape(blob.shape)
x = np.frombuffer(blob.data, dtype=blob.dtype).copy()
return x.reshape(blob.shape)


def array2blob(x: np.ndarray) -> 'gnes_pb2.NdArray':
Expand Down
2 changes: 1 addition & 1 deletion tests/yaml/preprocessor-video_decode.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!VideoDecodePreprocessor
!VideoDecoderPreprocessor
parameters:
frame_rate: 5
vframes: 1
Expand Down

0 comments on commit 9095bfa

Please sign in to comment.