Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OFA on customised task e.g. OK-VQA #76

Closed
chenxwh opened this issue Apr 20, 2022 · 6 comments
Closed

OFA on customised task e.g. OK-VQA #76

chenxwh opened this issue Apr 20, 2022 · 6 comments
Assignees

Comments

@chenxwh
Copy link

chenxwh commented Apr 20, 2022

Hi, thanks for the awesome work!

I'd like to fine-tune OFA on OK-VQA, I have been trying to follow the instructions of VQA assuming they are similar, but I have raw image input (and question) , how do I convert to what OFA understands? Do I need to follow the format of the example tsv file? Is trainval_ans2label.pkl required (if so how do I generate it)?
What are the steps to take to extend OFA on OK-VQA?

Thank you in advance for your help!

@yangapku yangapku self-assigned this Apr 21, 2022
@yangapku
Copy link
Member

yangapku commented Apr 21, 2022

For organizing the TSV file, please refer to the reply in this issue #56 (see the 2nd & 3rd paragraphs). For the creation of trainval_ans2label.pkl, it is just a pickled Python-dict which maps the candidate answer-text to label-id (for VQA-V2 it has 3,129 candidate answers, refer to this issue #59 for more information). You can try to replace the data and ans2label_file to your customed files and run the scripts. Other hyper-params like the sequence length and fine-tuning steps may be modified according to your specific task.

@chenxwh
Copy link
Author

chenxwh commented Apr 21, 2022

For organizing the TSV file, please refer to the reply in this issue #56 (see the 2nd & 3rd paragraphs). For the creation of trainval_ans2label.pkl, it is just a pickled Python-dict which maps the candidate answer-text to label-id (for VQA-V2 it has 3,129 candidate answers, refer to this issue #59 for more information). You can try to replace the data and ans2label_file to your customed files and run the scripts. Other hyper-params like the sequence length and fine-tuning steps may be modified according to your specific task.

Hi @yangapku,

Thank you for your reply! Are the answer candidates for trainval_ans2label.pkl gathered from all the possible answers in the Train and Val split from the VQAv2 (regardless of the confidence score)? And the label-ids (0 to number of different answers-1) are randomly assigned to each answer from the candidates?

@yangapku
Copy link
Member

yangapku commented Apr 21, 2022

Hi, in fact the 3,129 answer candidates do not covers all the appeared answers in the original VQAv2 dataset. It's just a common practice in the VQAv2 challenge to limit in these relatively frequent answers. We only keep the training and validation samples containing these answers. The label-ids are assigned randomly without specific rules.

@chenxwh
Copy link
Author

chenxwh commented Apr 21, 2022

Is there a rule to choose the 'frequent answer candidates' for a customised datasets if not all appeared answers are included? Also at testing/inference are the generated answers also restricted to only the answers in the trainval_ans2label.pkl?

@yangapku
Copy link
Member

yangapku commented Apr 21, 2022

Hi, I would recommend to refer to previous works for OK-VQA on how to determine the proper size of the frequent candidate set. In our work, we just exactly followed the practice of previous works on VQAv2. During inference, the generated answers are restricted to only the answers in the trainval_ans2label.pkl. In details, there are two types of inference for VQA as mentioned in readme. For all-candidate evaluation, the generated answers are explicitly enumerated from trainval_ans2label.pkl during inference. For beam-search evaluation, although there are not such a restriction during inference (the trainval_ans2label.pkl are not used), since the model is fine-tuned within the candidate answer set, the model will not likely to generate out-of-set answers either.

@chenxwh
Copy link
Author

chenxwh commented Apr 21, 2022

Thank you for the clarification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants