コード例 #1
0
ファイル: celebaHR.py プロジェクト: colehurwitz/dsvae
 def _load_batch_data(self, indices):
     filenames = [
         os.path.join(self.celeba_path, f'{ind+1:06}.jpg')
         for ind in indices
     ]
     images = [
         utils.get_image(name,
                         input_height=178,
                         input_width=218,
                         resize_height=self.res,
                         resize_width=self.res,
                         is_crop=True) / 255. for name in filenames
     ]
     images = np.asarray(images)
     return images
コード例 #2
0
 def _load_data(self):
     TRAIN_STOP = 100000
     data = json.load(open('/hdd_c/data/MITFaces/img_store'))[:TRAIN_STOP]
     images = [
         get_image('/hdd_c/data/MITFaces/notebooks/' + name,
                   input_height=178,
                   input_width=218,
                   resize_height=64,
                   resize_width=64,
                   is_crop=False) / 255. for name in data
     ]
     print('finish reading face images')
     images = np.asarray(images)
     print('finish converting face images to numpy array')
     factors = np.load('../../MITFaces/z_store_full')[:TRAIN_STOP]
     print('finish reading factors')
     return images, factors
コード例 #3
0
ファイル: celeba.py プロジェクト: colehurwitz/dsvae
 def _load_data(self):
     TRAIN_STOP = self.num_samples
     self._TRAIN_STOP = TRAIN_STOP
     print(TRAIN_STOP)
     celebA = [
         os.path.join(root, filename)
         for root, dirnames, filenames in os.walk(self.celeba_path)
         for filename in filenames if filename.endswith('.jpg')
     ]
     celebA = celebA[:TRAIN_STOP]
     images = [
         utils.get_image(name,
                         input_height=178,
                         input_width=218,
                         resize_height=64,
                         resize_width=64,
                         is_crop=True) / 255. for name in celebA
     ]
     print('finish reading face images')
     images = np.float32(np.asarray(images))
     print(images.shape)
     return images