def loadpng1(cfg, full): path = cfg images, labels = [], [] for parent, subdir, files in os.walk(path): for file in files: image = scipy.misc.imread(os.path.join(parent,file)) image = ku.formatImage(image,full) images.append(np.array(image)) label = file if label[1] == '.': label = label[2:] elif label[2] == '.': label = label[3:] label = str(label) meta = label.split('_') label = {'labels':meta[0]} #print label #label['malignancy'] = meta[1].split('-') #label['vars'] = meta[2].split('-') #meta = meta[2].split('-') #print meta #meta = meta[7].split('.') #label['count'] = meta[3] #label['slice'] = meta[4] labels.append(label) return images, labels
def loadpng2(cfg, full): path = cfg images, labels = [], [] for parent, subdir, files in os.walk(path): #print files #print "FILES" for file in files: image = scipy.misc.imread(os.path.join(parent, file)) image = ku.formatImage(image, full) images.append(np.array(image)) label = file label = label.split('_') label = label[0] label = label.split('/') label = label[-1] if label == 't': label = {'labels': 't'} elif label == 'f': label = {'labels': 'f'} labels.append(label) return images, labels
def loadImage(path, full=True): images, labels = [], [] image = scipy.misc.imread(path) #print image image = ku.formatImage(image, full) images.append(np.array(image)) path = path.split('/') fname = path[-1] fname = fname[:-4] label = fname label = label.split('_') label = label[0] #print label #print label #label = label.split('/') #label = label[-1] if label == 't': label = {'labels': 't'} elif label == 'f': label = {'labels': 'f'} labels.append(label) #images.append(image) #print images return images, labels