xmodaler icon indicating copy to clipboard operation
xmodaler copied to clipboard

怎么在我自己的数据集上推理?

Open DestoryVIP opened this issue 4 years ago • 3 comments

首先感谢您们的工作,我在尝试使用MSVD的预训练模型权重在我自己准备的数据集上进行视频摘要推理。

我首先使用resnet152提取我自己的数据集的高维特征,然后组装成npy。 image 之后按照msvd数据集中的caption_test.json,填入我自己数据集中相应的id和file_name,(因为我只要进行推理任务,而且不需要评估,所以annotation为空)。 image

之后将正确的路径填写到config/video_caption/msvd/base_caption.yaml,但是现在它运行报错,没有1297.npy这个文件。 所以我想提问,为什么我修改了caption_test.json,它还是不读取我的caption_test.json里的数据?

DestoryVIP avatar Nov 24 '21 05:11 DestoryVIP

我想请问一下,你们的pkl文件中代表的内容是什么?video_id,tokens_ids,target_ids是什么意思?

DestoryVIP avatar Nov 24 '21 05:11 DestoryVIP

但是现在它运行报错,没有1297.npy这个文件

You can check line 80 in xmodaler/datasets/videos/msvd.py, and replace it with feat_path = os.path.join(self.feats_folder, 'video' + video_id + '.npy').

Part of code as follows:

······
    def __call__(self, dataset_dict):
        dataset_dict = copy.deepcopy(dataset_dict)
        video_id = dataset_dict['video_id']

        feat_path  = os.path.join(self.feats_folder, video_id + '.npy')
        content = read_np(feat_path)
······

HanielF avatar Jan 31 '22 15:01 HanielF

我想请问一下,你们的pkl文件中代表的内容是什么?video_id,tokens_ids,target_ids是什么意思?

If you want to do the inference with your own data, you should preprocess your *.json files with the provided script https://github.com/YehLi/xmodaler/blob/master/tools/msvd_preprocess.py to generate the *.pkl files according to your *.json files since the class MSVDDataset only read *.pkl files https://github.com/YehLi/xmodaler/blob/ffec226d0da16243ee5d9bc45ec5d2c5df20dd3e/xmodaler/datasets/videos/msvd.py#L57

video_id is a pre-defined unique id for each video (you can customize this for your own data), token_ids is the vocabulary index sequence of the previous n-1 input words (assuming that the total number of words in the sentence is n) based on the vocabulary, and the target_ids is the the vocabulary index sequence of the last n-1 input words as the ground-truth predictions for training, such that we can train the model to predict the i-th word given the previous i-1 words.

winnechan avatar Sep 26 '22 10:09 winnechan