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 #303 from gnes-ai/fix-chunk-spliter
Browse files Browse the repository at this point in the history
fix(video-decoder): minor revision video-decoder chunk spliter
  • Loading branch information
mergify[bot] authored Sep 29, 2019
2 parents 0bb0082 + e180a9f commit 4dcf6d0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions gnes/preprocessor/video/video_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ def apply(self, doc: 'gnes_pb2.Document') -> None:
else:
self.logger.error('the document "raw_bytes" is empty!')

if self.chunk_spliter == 'frame_split':
if self.chunk_spliter == 'base':
for i, frame in enumerate(video_frames):
c = doc.chunks.add()
c.doc_id = doc.doc_id
c.blob.CopyFrom(array2blob(frame))
c.offset = i
c.weight = 1.0
elif self.chunk_spliter == 'none':
elif self.chunk_spliter == 'shot':
raise NotImplementedError
else:
chunk = doc.chunks.add()
chunk.doc_id = doc.doc_id
chunk.blob.CopyFrom(array2blob(video_frames))
Expand Down
2 changes: 1 addition & 1 deletion tests/test_video_decode_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ def test_video_decode_preprocessor(self):
self.assertGreater(len(d.chunks), 0)
for _ in range(len(d.chunks)):
shape = blob2array(d.chunks[_].blob).shape
self.assertEqual(shape[1:], (299, 299, 3))
self.assertEqual(shape, (299, 299, 3))
2 changes: 1 addition & 1 deletion tests/yaml/preprocessor-video_decode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ parameters:
frame_rate: 5
vframes: 1
frame_size: '299:299'
chunk_spliter: 'none'
chunk_spliter: 'base'
gnes_config:
is_trained: true

0 comments on commit 4dcf6d0

Please sign in to comment.