def run_eval_mend(): img = cv2.imread('road-car.png')[np.newaxis, :, :, :] img = np.pad(img, ((0, 0), (32, 32), (32, 32), (0, 0)), 'reflect') # mask = cv2.imread('road-label.png')[np.newaxis, :, :, :] mask = cv2.imread('road-cloud0.png')[np.newaxis, :, :, :] mask = np.pad(mask, ((0, 0), (32, 32), (32, 32), (0, 0)), 'reflect')[:, :, :, 0:1] threshold = 244 mask[mask < threshold] = 0 mask[mask >= threshold] = 255 # cv2.imshow('', mask[0]) # cv2.waitKey(5432) eval_list = [img, mask, img, mask] from mod_mend_dila import init_train C = Config('mod_mend_dila') from mod_mend_nres import init_train C = Config('mod_mend_nres') inp_ground, inp_mask01, inp_grdbuf, inp_mskbuf, fetch, eval_fetch = init_train() C.size = img.shape[1] sess = mod_util.get_sess(C) mod_util.get_saver_logger(C, sess) print("||Training Check") eval_feed_dict = {inp_ground: eval_list[0], inp_mask01: eval_list[1], inp_grdbuf: eval_list[2], inp_mskbuf: eval_list[3], } img_util.get_eval_img(mat_list=sess.run(eval_fetch, eval_feed_dict), channel=3, img_path="%s/eval-%08d.jpg" % ('temp', 0))
def run_eval_haze(): img = cv2.imread('road-thin.png')[np.newaxis, :, :, :] img = np.pad(img, ((0, 0), (32, 32), (32, 32), (0, 0)), 'reflect') eval_list = [img, np.zeros_like(img[:, :, :, 0:1])] from mod_haze_unet import init_train inp_ground, inp_mask01, train_fetch, eval_fetch = init_train() C = Config('mod_haze_unet') C.size = img.shape[1] sess = mod_util.get_sess(C) mod_util.get_saver_logger(C, sess) print("||Training Check") eval_feed_dict = {inp_ground: eval_list[0], inp_mask01: eval_list[1], } img_util.get_eval_img(mat_list=sess.run(eval_fetch, eval_feed_dict), channel=3, img_path="%s/eval-%08d.jpg" % ('temp', 0))