diff --git a/applications/first_order_model/configs/vox-256.yaml b/applications/first_order_model/configs/vox-256.yaml index abfe9a23949aea62f9b4b7772d3e987f253ecd62..1f38c49af91374323beeed7b027d1fb324e371fb 100644 --- a/applications/first_order_model/configs/vox-256.yaml +++ b/applications/first_order_model/configs/vox-256.yaml @@ -1,19 +1,3 @@ -dataset_params: - root_dir: data/vox-png - frame_shape: [256, 256, 3] - id_sampling: True - pairs_list: data/vox256.csv - augmentation_params: - flip_param: - horizontal_flip: True - time_flip: True - jitter_param: - brightness: 0.1 - contrast: 0.1 - saturation: 0.1 - hue: 0.1 - - model_params: common_params: num_kp: 10 @@ -42,42 +26,3 @@ model_params: max_features: 512 num_blocks: 4 sn: True - -train_params: - num_epochs: 100 - num_repeats: 75 - epoch_milestones: [60, 90] - lr_generator: 2.0e-4 - lr_discriminator: 2.0e-4 - lr_kp_detector: 2.0e-4 - batch_size: 40 - scales: [1, 0.5, 0.25, 0.125] - checkpoint_freq: 50 - transform_params: - sigma_affine: 0.05 - sigma_tps: 0.005 - points_tps: 5 - loss_weights: - generator_gan: 0 - discriminator_gan: 1 - feature_matching: [10, 10, 10, 10] - perceptual: [10, 10, 10, 10, 10] - equivariance_value: 10 - equivariance_jacobian: 10 - -reconstruction_params: - num_videos: 1000 - format: '.mp4' - -animate_params: - num_pairs: 50 - format: '.mp4' - normalization_params: - adapt_movement_scale: False - use_relative_movement: True - use_relative_jacobian: True - -visualizer_params: - kp_size: 5 - draw_border: True - colormap: 'gist_rainbow' diff --git a/applications/tools/first-order-demo.py b/applications/tools/first-order-demo.py index 40e6c1a35549aaeaf1181d23c47c3f968fe94f21..5605bf54078b992499afb341cfd5173bb778db74 100644 --- a/applications/tools/first-order-demo.py +++ b/applications/tools/first-order-demo.py @@ -1,3 +1,17 @@ +# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import matplotlib matplotlib.use('Agg') import os @@ -5,20 +19,20 @@ import sys import yaml import pickle -from argparse import ArgumentParser -from tqdm import tqdm - import imageio import numpy as np -from skimage.transform import resize + +from tqdm import tqdm from skimage import img_as_ubyte -import paddle +from argparse import ArgumentParser +from skimage.transform import resize +from scipy.spatial import ConvexHull from ppgan.models.generators.occlusion_aware import OcclusionAwareGenerator from ppgan.modules.keypoint_detector import KPDetector from ppgan.utils.animate import normalize_kp -from scipy.spatial import ConvexHull +import paddle paddle.disable_static() if sys.version_info[0] < 3: @@ -60,8 +74,7 @@ def make_animation(source_image, predictions = [] source = paddle.to_tensor(source_image[np.newaxis].astype( np.float32)).transpose([0, 3, 1, 2]) - # if not cpu: - # source = source.cuda() + driving = paddle.to_tensor( np.array(driving_video)[np.newaxis].astype(np.float32)).transpose( [0, 4, 1, 2, 3]) diff --git a/applications/tools/video-enhance.py b/applications/tools/video-enhance.py index 04ece7689d33f37c111e5f5acf2c20969f83c2bd..5fb8dbecce128a0cc5447a3e708bf3bfce57768e 100644 --- a/applications/tools/video-enhance.py +++ b/applications/tools/video-enhance.py @@ -1,3 +1,17 @@ +# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import sys sys.path.append('.') diff --git a/ppgan/utils/animate.py b/ppgan/utils/animate.py index 3ac08d9c33c5045f1b1cf725abc3a8e5ef9bff4a..df3a0e71caab05f86cd6a6fa113c43f9b3308a34 100644 --- a/ppgan/utils/animate.py +++ b/ppgan/utils/animate.py @@ -1,12 +1,8 @@ -import os -from tqdm import tqdm +import numpy as np +from scipy.spatial import ConvexHull import paddle -import imageio -from scipy.spatial import ConvexHull -import numpy as np - def normalize_kp(kp_source, kp_driving,