in utils/data_loader.py [0:0]
def getPair(imroot, hroot, oproot, path, vocab, index):
""" helper method to get the image corresponding to the pair """
if index <= 1:
h = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0] * 15;
else:
file = open(hroot + "/" + path + "/h" + str(index - 2) + ".txt")
h = file.read().split()
h = map(float, h)
with open(oproot + "/" + path + "/imxx" + str(index) + ".txt", 'r') as f:
js = json.loads(f.read())
if ('joints' not in js) or (len(js['joints']) <= 0):
pose2 = [0] * 48
else:
pose2 = js['joints']
upp_cluster = vocab.upp_ids[path][index-1]
low_cluster = vocab.low_ids[path][index-1]
path = path + "/imxx" + str(index) + ".jpg";
image = Image.open(os.path.join(imroot, path)).convert('RGB')
return image, upp_cluster, low_cluster, h, pose2