diff --git a/applications/DeOldify/predict.py b/applications/DeOldify/predict.py index 35ca9c9ab5351f840d59f2332cbb0333e992e995..fd94970f38adac3ed494ab0e3208aaa81cd4755f 100644 --- a/applications/DeOldify/predict.py +++ b/applications/DeOldify/predict.py @@ -18,7 +18,6 @@ from paddle.utils.download import get_path_from_url from ppgan.utils.video import frames2video, video2frames from ppgan.models.generators.deoldify import build_model - parser = argparse.ArgumentParser(description='DeOldify') parser.add_argument('--input', type=str, default='none', help='Input video') parser.add_argument('--output', type=str, default='output', help='output dir') @@ -31,7 +30,7 @@ parser.add_argument('--weight_path', default=None, help='Path to the reference image directory') -DeOldify_weight_url = 'https://paddlegan.bj.bcebos.com/applications/DeOldify_stable.pdparams' +DEOLDIFY_WEIGHT_URL = 'https://paddlegan.bj.bcebos.com/applications/DeOldify_stable.pdparams' class DeOldifyPredictor(): @@ -46,7 +45,7 @@ class DeOldifyPredictor(): self.render_factor = render_factor self.model = build_model() if weight_path is None: - weight_path = get_path_from_url(DeOldify_weight_url, cur_path) + weight_path = get_path_from_url(DEOLDIFY_WEIGHT_URL, cur_path) state_dict, _ = paddle.load(weight_path) self.model.load_dict(state_dict) @@ -127,8 +126,7 @@ class DeOldifyPredictor(): vid_out_path = os.path.join(output_path, '{}_deoldify_out.mp4'.format(base_name)) - frames2video(frame_pattern_combined, vid_out_path, - str(int(fps))) + frames2video(frame_pattern_combined, vid_out_path, str(int(fps))) return frame_pattern_combined, vid_out_path diff --git a/applications/DeepRemaster/predict.py b/applications/DeepRemaster/predict.py index 8a4777fbf3ca1baa3c6c1d1b3203357fcd9d97f9..baa8b7fd68d4629d57f8d5e31b405fe45b049dd1 100644 --- a/applications/DeepRemaster/predict.py +++ b/applications/DeepRemaster/predict.py @@ -17,7 +17,7 @@ import utils from ppgan.models.generators.remaster import NetworkR, NetworkC from paddle.utils.download import get_path_from_url -DeepRemaster_weight_url = 'https://paddlegan.bj.bcebos.com/applications/deep_remaster.pdparams' +DEEPREMASTER_WEIGHT_URL = 'https://paddlegan.bj.bcebos.com/applications/deep_remaster.pdparams' parser = argparse.ArgumentParser(description='Remastering') parser.add_argument('--input', type=str, default=None, help='Input video') @@ -51,7 +51,7 @@ class DeepReasterPredictor: self.mindim = mindim if weight_path is None: - weight_path = get_path_from_url(DeepRemaster_weight_url, cur_path) + weight_path = get_path_from_url(DEEPREMASTER_WEIGHT_URL, cur_path) state_dict, _ = paddle.load(weight_path) diff --git a/applications/EDVR/predict.py b/applications/EDVR/predict.py index 8a7f5aa6adc6a584f4df92d47067c78ebb5f7fd8..5f95714cea667555d64ddfea83d75c8191b773b0 100644 --- a/applications/EDVR/predict.py +++ b/applications/EDVR/predict.py @@ -32,7 +32,7 @@ from data import EDVRDataset from paddle.utils.download import get_path_from_url from ppgan.utils.video import frames2video, video2frames -EDVR_weight_url = 'https://paddlegan.bj.bcebos.com/applications/edvr_infer_model.tar' +EDVR_WEIGHT_URL = 'https://paddlegan.bj.bcebos.com/applications/edvr_infer_model.tar' def parse_args(): @@ -82,7 +82,7 @@ class EDVRPredictor: self.exe = fluid.Executor(place) if weight_path is None: - weight_path = get_path_from_url(EDVR_weight_url, cur_path) + weight_path = get_path_from_url(EDVR_WEIGHT_URL, cur_path) model_filename = 'EDVR_model.pdmodel' params_filename = 'EDVR_params.pdparams' @@ -141,8 +141,7 @@ class EDVRPredictor: frame_pattern_combined = os.path.join(pred_frame_path, '%08d.png') vid_out_path = os.path.join(self.output, '{}_edvr_out.mp4'.format(base_name)) - frames2video(frame_pattern_combined, vid_out_path, - str(int(fps))) + frames2video(frame_pattern_combined, vid_out_path, str(int(fps))) return frame_pattern_combined, vid_out_path diff --git a/applications/RealSR/predict.py b/applications/RealSR/predict.py index e74e0ca0b0b161dc80f4e59b9d13cae104ef56a5..d032bc2a78029e174d80d0d124036db75a42d0cb 100644 --- a/applications/RealSR/predict.py +++ b/applications/RealSR/predict.py @@ -26,7 +26,7 @@ parser.add_argument('--weight_path', default=None, help='Path to the reference image directory') -RealSR_weight_url = 'https://paddlegan.bj.bcebos.com/applications/DF2K_JPEG.pdparams' +REALSR_WEIGHT_URL = 'https://paddlegan.bj.bcebos.com/applications/DF2K_JPEG.pdparams' class RealSRPredictor(): @@ -35,7 +35,7 @@ class RealSRPredictor(): self.output = os.path.join(output, 'RealSR') self.model = RRDBNet(3, 3, 64, 23) if weight_path is None: - weight_path = get_path_from_url(RealSR_weight_url, cur_path) + weight_path = get_path_from_url(REALSR_WEIGHT_URL, cur_path) state_dict, _ = paddle.load(weight_path) self.model.load_dict(state_dict) @@ -88,8 +88,7 @@ class RealSRPredictor(): vid_out_path = os.path.join(output_path, '{}_realsr_out.mp4'.format(base_name)) - frames2video(frame_pattern_combined, vid_out_path, - str(int(fps))) + frames2video(frame_pattern_combined, vid_out_path, str(int(fps))) return frame_pattern_combined, vid_out_path