In [1]:
import random
import os
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from vqatools.visual7w import Visual7wPoint,Visual7wTell
In [2]:
v7wpoint = Visual7wPoint('visual7w/dataset_v7w_pointing.json')
v7wpoint.info()
In [5]:
outqids = v7wpoint.imgidtoqid[2359297]
In [7]:
for qid in outqids:
qa = v7wpoint.qidtoqa[qid]
answer_boxid = qa.get('answer')
box = v7wpoint.boxidtobox[answer_boxid]
print (box.get('x'),box.get('y'),box.get('height'),box.get('width'))
# print (qa)
# print ()
In [4]:
v7wpoint.boxidtobox[794494]
Out[4]:
In [5]:
v7wpoint.showQA(265555)
In [8]:
v7wpoint.boxidtobox[794494]
Out[8]:
In [9]:
v7wpoint.boxidtobox[794491]
Out[9]:
In [6]:
v7wpoint.qidtoqa[265555]
Out[6]:
In [11]:
v7wtell = Visual7wTell('visual7w/dataset_v7w_telling.json')
v7wtell.info()
In [7]:
# howques = getQuesIds(quesType='how')
countques = v7wtell.getCountquesids()
print ("ther are %d count questions" %(len(countques)))
v7wtell.showQA(random.choice(countques))