%reload_ext autoreload
%autoreload 2
%matplotlib inline
from salicon.salicon import SALICON
import numpy as np
import skimage.io as io
import matplotlib.pyplot as plt
dataDir='..'
dataType='val2014'
annFile='%s/annotations/fixations_%s_examples.json'%(dataDir,dataType)
# initialize COCO api for instance annotations
salicon=SALICON(annFile)
# get all images
imgIds = salicon.getImgIds();
img = salicon.loadImgs(imgIds[np.random.randint(0,len(imgIds))])[0]
# load and display image
I = io.imread('%s/images/examples/%s'%(dataDir,img['file_name']))
plt.figure()
plt.imshow(I)
plt.show()
# load and display instance annotations
#plt.imshow(I)
annIds = salicon.getAnnIds(imgIds=img['id'])
anns = salicon.loadAnns(annIds)
salicon.showAnns(anns)
plt.show()