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

fix(video-decoder): minor revision video-decoder chunk spliter #303

Merged
merged 6 commits into from
Sep 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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