t5 = t5.reshape(10) return t5 def save_img(img, save_path): image_numpy = util.tensor2im(img) util.save_image(image_numpy, save_path, create_dir=True) return image_numpy if __name__ == '__main__': opt = TestOptions().parse() data_info = data.dataset_info() datanum = data_info.get_dataset(opt)[0] folderlevel = data_info.folder_level[datanum] dataloaders = data.create_dataloader_test(opt) visualizer = Visualizer(opt) iter_counter = IterationCounter(opt, len(dataloaders[0]) * opt.render_thread) # create a webpage that summarizes the all results testing_queue = Queue(10) ngpus = opt.device_count render_gpu_ids = list(range(ngpus - opt.render_thread, ngpus)) render_layer_list = []
import os import math import numpy as np from PIL import Image import skimage.transform as trans import cv2 import torch from data import dataset_info from data.base_dataset import BaseDataset import util.util as util dataset_info = dataset_info() class AllFaceDataset(BaseDataset): @staticmethod def modify_commandline_options(parser, is_train): parser.add_argument('--no_pairing_check', action='store_true', help='If specified, skip sanity check of correct label-image file pairing') return parser def cv2_loader(self, img_str): img_array = np.frombuffer(img_str, dtype=np.uint8) return cv2.imdecode(img_array, cv2.IMREAD_COLOR) def fill_list(self, tmp_list): length = len(tmp_list) if length % self.opt.batchSize != 0: end = math.ceil(length / self.opt.batchSize) * self.opt.batchSize tmp_list = tmp_list + tmp_list[-1 * (end - length) :] return tmp_list