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

Commit

Permalink
fix(preprocessor): fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Larryjianfeng committed Aug 12, 2019
1 parent c150ad5 commit 415456d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gnes/preprocessor/video/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ def apply(self, doc: 'gnes_pb2.Document') -> None:
elif self.segment_method == 'cut_by_clustering':
if self.segment_num >= 2:
hash_v = [phash_descriptor(_).hash for _ in frames]
label_v = KMeans(n_clusters=self.segment_num
).fit_predict(np.array(hash_v, dtype=np.int32))
hash_v = np.array(hash_v, dtype=np.int32).reshape([len(hash_v), -1])
label_v = KMeans(n_clusters=self.segment_num).fit_predict(hash_v)
sub_videos = [[frames[i] for i, j in enumerate(label_v) if j == _] for _ in range(self.segment_num)]
else:
sub_videos = [frames]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_video_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def setUp(self):
self.yml_path = os.path.join(self.dirname, 'yaml', 'preprocessor-ffmpeg.yml')
self.yml_path_2 = os.path.join(self.dirname, 'yaml', 'preprocessor-ffmpeg2.yml')
self.yml_path_3 = os.path.join(self.dirname, 'yaml', 'preprocessor-ffmpeg3.yml')
self.yml_path_3 = os.path.join(self.dirname, 'yaml', 'preprocessor-ffmpeg4.yml')
self.yml_path_4 = os.path.join(self.dirname, 'yaml', 'preprocessor-ffmpeg4.yml')
self.video_path = os.path.join(self.dirname, 'videos')
self.video_bytes = [open(os.path.join(self.video_path, _), 'rb').read()
for _ in os.listdir(self.video_path)]
Expand Down

0 comments on commit 415456d

Please sign in to comment.