def get_batch_with_label(self, N=None): if N is None: N = self.batch_size batch = shuf(self.img_list, random_state=np.random.randint(1, 10000)) X = [] b = [] for i in range(N): X.append(self.LoadImage(osp.join(self.source_folder, batch[i]))) b.append( self.LoadImage(osp.join(self.source_folder, "blur", batch[i]))) X = np.array(X).reshape(N, -1) b = np.array(b).reshape(N, -1) return X, b
def get_batch(self, N=None): if N is None: N = self.batch_size if N > len(self.img_list) or N == -1: N = len(self.img_list) batch = shuf(self.img_list, random_state=np.random.randint(1, 10000)) X = [] for i in range(N): X.append(self.LoadImage(osp.join(self.source_folder, batch[i]))) X = np.array(X).reshape(N, -1) z = np.zeros([N, self.K]) return X, z, z, self.lmbd
def get_batch_with_label(self, N=None, shuffle=True): from keras.utils import np_utils if N is None: N = self.batch_size im = self.im if shuffle == True: batch, label = shuf(im, self.label, random_state=np.random.randint(1, 10000)) else: batch, label = im, self.label X = batch[:N].reshape(N, -1) label = label[:N] label = np_utils.to_categorical(label, 10) return X, label
def get_feature_batch(self,N): from sklearn.utils import shuffle as shuf batch,label = shuf(self.feat,self.label,random_state=np.random.randint(1,10000)) batch = batch[:N].reshape(N,-1) label = label[:N] return batch,label