yangbang18 / Non-Autoregressive-Video-Captioning

The PyTorch code of the AAAI2021 paper "Non-Autoregressive Coarse-to-Fine Video Captioning".
58 stars 6 forks source link

Extracting frames跑YouTubeClips视频数据时会报video_id = id2vid[video_id]这行代码的错误 #2

Closed Kohaku233 closed 3 years ago

Kohaku233 commented 3 years ago

具体错误是KeyError: 'YouTubeClips\-4wsuPCjDBc_5_15',查看了VC_data\Youtube2Text后发现可能现在下载的Youtube视频数据集的名称和pkl中映射的名称不相同,请问该如何解决呢?

yangbang18 commented 3 years ago

-4wsuPCjDBc_5_15{Youtube id}_{start_time}_{end_time}的简写。

extracting frames中video_id = id2vid[video_id]video_id对映上面的Youtube id,是一个固定11位的字符串,你可以这么修改:

import os
key = "YouTubeClips\-4wsuPCjDBc_5_15"
video_id = os.path.basename(key)  # “-4wsuPCjDBc_5_15”
video_id = video_id[:11] # “-4wsuPCjDBc”
video_id = id2vid[video_id]