Skip to content
li-xirong edited this page Aug 3, 2018 · 1 revision

Welcome to the coco-cn wiki!

  • How to load the visual feature for a specific image or for a given set of images by the BigFile class?
import os
from bigfile import BigFile

rootpath = os.path.join(os.environ['HOME'], 'VisualSearch')
feat_dir = os.path.join(rootpath, 'coco-cn', 'FeatureData', 'pyresnext-101_rbps13k,flatten0_output,os')

feat_file = BigFile(feat_dir)

imset = 'COCO_val2014_000000557596 COCO_train2014_000000005994 COCO_train2014_000000028953'.split()
renamed, vecs = feat_file.read(imset)

for _id, _vec in zip(renamed, vecs):
    the_same_vec = feat_file.read_one(_id) 
    diff = sum([abs(x-y) for x,y in zip(_vec, the_same_vec)])
    print (_id, len(_vec), diff)
('COCO_train2014_000000005994', 2048, 0.0)
('COCO_train2014_000000028953', 2048, 0.0)
('COCO_val2014_000000557596', 2048, 0.0)
Clone this wiki locally