Ejemplo n.º 1
0
trainRef = mpii.annot['img_train'][0][0][0]
allIdxs = np.arange(0,trainRef.shape[0])
with h5py.File('../../data/mpii/annot/multi-idxs.h5','r') as f:
    mTrain = f['train'][:] - 1
    mTest = f['test'][:] - 1
    multiRef[allIdxs[trainRef == 1][mTrain]] = 1
    multiRef[allIdxs[trainRef == 0][mTest]] = 1

# Get image filenames
imgnameRef = mpii.annot['annolist'][0][0][0]['image'][:]

for idx in xrange(mpii.nimages):
    print "\r",idx,
    sys.stdout.flush()

    for person in xrange(mpii.numpeople(idx)):
        c,s = mpii.location(idx,person)
        if not c[0] == -1:
            # Add info to annotation list
            annot['index'] += [idx]
            annot['person'] += [person]
            imgname = np.zeros(16)
            refname = str(imgnameRef[idx][0][0][0][0])
            for i in range(len(refname)): imgname[i] = ord(refname[i])
            annot['imgname'] += [imgname]
            annot['center'] += [c]
            annot['scale'] += [s]
            annot['multi'] += [multiRef[idx]]

            if mpii.istrain(idx) == True:
                # Part annotations and visibility
Ejemplo n.º 2
0
trainRef = mpii.annot['img_train'][0][0][0]
allIdxs = np.arange(0,trainRef.shape[0])
with h5py.File('../../data/mpii/annot/multi-idxs.h5','r') as f:
    mTrain = f['train'][:] - 1
    mTest = f['test'][:] - 1
    multiRef[allIdxs[trainRef == 1][mTrain]] = 1
    multiRef[allIdxs[trainRef == 0][mTest]] = 1

# Get image filenames
imgnameRef = mpii.annot['annolist'][0][0][0]['image'][:]

for idx in xrange(mpii.nimages):
    print("\r",idx, end=' ')
    sys.stdout.flush()

    for person in xrange(mpii.numpeople(idx)):
        c,s = mpii.location(idx,person)
        if not c[0] == -1:
            # Add info to annotation list
            annot['index'] += [idx]
            annot['person'] += [person]
            imgname = np.zeros(16)
            refname = str(imgnameRef[idx][0][0][0][0])
            for i in range(len(refname)): imgname[i] = ord(refname[i])
            annot['imgname'] += [imgname]
            annot['center'] += [c]
            annot['scale'] += [s]
            annot['multi'] += [multiRef[idx]]

            if mpii.istrain(idx) == True:
                # Part annotations and visibility