이현규

Create sample featuremaps

No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -28,6 +28,9 @@ VOCAB_PATH = "./statics/vocabulary.csv" ...@@ -28,6 +28,9 @@ VOCAB_PATH = "./statics/vocabulary.csv"
28 TAG_TOP_K = 5 28 TAG_TOP_K = 5
29 VIDEO_TOP_K = 10 29 VIDEO_TOP_K = 10
30 30
31 +# Target featuremap.
32 +FEATUREMAP_PATH = "./featuremaps/toy-3-features.pb"
33 +
31 def get_segments(batch_video_mtx, batch_num_frames, segment_size): 34 def get_segments(batch_video_mtx, batch_num_frames, segment_size):
32 """Get segment-level inputs from frame-level features.""" 35 """Get segment-level inputs from frame-level features."""
33 video_batch_size = batch_video_mtx.shape[0] 36 video_batch_size = batch_video_mtx.shape[0]
...@@ -229,8 +232,7 @@ def inference_pb(file_path, threshold): ...@@ -229,8 +232,7 @@ def inference_pb(file_path, threshold):
229 232
230 233
231 if __name__ == '__main__': 234 if __name__ == '__main__':
232 - filepath = "./featuremaps/features.pb" 235 + result = inference_pb(FEATUREMAP_PATH, 5)
233 - result = inference_pb(filepath, 5)
234 print("=============== Old Model ===============") 236 print("=============== Old Model ===============")
235 print(result["tag_result"]) 237 print(result["tag_result"])
236 print(json.dumps(result["video_result"], sort_keys=True, indent=2)) 238 print(json.dumps(result["video_result"], sort_keys=True, indent=2))
...@@ -240,6 +242,6 @@ if __name__ == '__main__': ...@@ -240,6 +242,6 @@ if __name__ == '__main__':
240 TAG_VECTOR_MODEL_PATH = "./new_model/tag_vectors.model" 242 TAG_VECTOR_MODEL_PATH = "./new_model/tag_vectors.model"
241 VIDEO_VECTOR_MODEL_PATH = "./new_model/video_vectors.model" 243 VIDEO_VECTOR_MODEL_PATH = "./new_model/video_vectors.model"
242 VIDEO_TAGS_PATH = "./statics/new_kaggle_solution_40k.csv" 244 VIDEO_TAGS_PATH = "./statics/new_kaggle_solution_40k.csv"
243 - result = inference_pb(filepath, 5) 245 + result = inference_pb(FEATUREMAP_PATH, 5)
244 print("=============== New Model ===============") 246 print("=============== New Model ===============")
245 print(json.dumps(result, sort_keys=True, indent=2)) 247 print(json.dumps(result, sort_keys=True, indent=2))
......