PaddlePaddle GAN library, including lots of interesting applications like First-Order motion transfer, wav2lip, picture repair, image editing, photo2cartoon, image style transfer, and so on.

Overview

English | 简体中文

PaddleGAN

PaddleGAN provides developers with high-performance implementation of classic and SOTA Generative Adversarial Networks, and supports developers to quickly build, train and deploy GANs for academic, entertainment and industrial usage.

GAN-Generative Adversarial Network, was praised by "the Father of Convolutional Networks" Yann LeCun (Yang Likun) as [One of the most interesting ideas in the field of computer science in the past decade]. It's the one research area in deep learning that AI researchers are most concerned about.

Licensepython version

🎪 Hot Activities

  • 🔥 2021.7.9-2021.9 🔥

    💙 AI Creation Camp 💙

    You can implement any abilities in PaddleGAN with Wechaty to create your own chat robot 🤖 !

    A plenty of gifts 🎁 waiting for you!

    💰 First Prize: 30,000RMB

    🎮 Second Prize: PS5

    🕶 Third Prize: VR Glass

    🏵 Most Popular Prize: 3D Printer

    Still hezitating? Click here and sign up! https://aistudio.baidu.com/aistudio/competition/detail/98

  • 2021.4.15~4.22

    GAN 7 Days Course Camp: Baidu Senior Research Developers help you learn the basic and advanced GAN knowledge in 7 days!

    Courses videos and related materials: https://aistudio.baidu.com/aistudio/course/introduce/16651

🚀 Recent Updates

Document Tutorial

Installation

Starter Tutorial

Model Tutorial

Composite Application

Online Tutorial

You can run those projects in the AI Studio to learn how to use the models above:

Online Tutorial link
Motion Driving-multi-personal "Mai-ha-hi" Click and Try
Restore the video of Beijing hundreds years ago Click and Try
Motion Driving-When "Su Daqiang" sings "unravel" Click and Try

Examples

Face Morphing

Image Translation

Old video restore

Motion driving

Super resolution

Makeup shifter

Face cartoonization

Realistic face cartoonization

Photo animation

Lip-syncing

Changelog

  • v0.1.0 (2020.11.02)
    • Release first version, supported models include Pixel2Pixel, CycleGAN, PSGAN. Supported applications include video frame interpolation, super resolution, colorize images and videos, image animation.
    • Modular design and friendly interface.

Community

Scan OR Code below to join [PaddleGAN QQ Group:1058398620], you can get offical technical support here and communicate with other developers/friends. Look forward to your participation!

PaddleGAN Special Interest Group(SIG)

It was first proposed and used by ACM(Association for Computing Machinery) in 1961. Top International open source organizations including Kubernates all adopt the form of SIGs, so that members with the same specific interests can share, learn knowledge and develop projects. These members do not need to be in the same country/region or the same organization, as long as they are like-minded, they can all study, work, and play together with the same goals~

PaddleGAN SIG is such a developer organization that brings together people who interested in GAN. There are frontline developers of PaddlePaddle, senior engineers from the world's top 500, and students from top universities at home and abroad.

We are continuing to recruit developers interested and capable to join us building this project and explore more useful and interesting applications together.

SIG contributions:

  • zhen8838: contributed to AnimeGANv2.
  • Jay9z: contributed to DCGAN and updated install docs, etc.
  • HighCWu: contributed to c-DCGAN and WGAN. Support to use paddle.vision.datasets.
  • hao-qiang & minivision-ai : contributed to the photo2cartoon project.

Contributing

Contributions and suggestions are highly welcomed. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring. When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA. Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. For more, please reference contribution guidelines.

License

PaddleGAN is released under the Apache 2.0 license.

Comments
  • Add StarGAN-v2 style FID calculation

    Add StarGAN-v2 style FID calculation

    Add stargan-v2 style FID calculation. For stargan-v2 FID calculation, we will use an Inception-V3 model weight converted from official torchvision implementation (I have uploaded it to AIStudio: https://aistudio.baidu.com/aistudio/datasetdetail/51890). Note that the original Inception model weights is converted from an unofficial tensorflow model, and generate different result compared to the torchvision one.

    add --style command line option to let user choose stargan or gan-compression style (by default gan-compression style will be used).

    move with fluid.dygraph.guard() call into fid module for two reason: 1. this inference model didn't work in dygraph mode because it's not dynamic graph model and thus it's faster, so we dynamically choose whether to use dygraph mode after style is determined. (for gan-compression style, the original dygraph version model is used. And for stargan style, this new inference model will be used) 2. easier to use for end user (no need to call fluid.dygraph.guard() explicitly)

    opened by gbstack 9
  • Integrate with visualdl

    Integrate with visualdl

    整合visualdl

    1. 修改了trianer.py,添加了global stepvdl logger对象进行写入。修改visual函数,添加了is_save_image参数控制是否直接写入文件夹,参考min_max添加了image_num控制每次写入的图像数量。
    2. 修改了visual.pytensor2img函数,支持3\4维的图像转换。
    3. main.py中添加了异常捕获,ctrl+c时可以自动保存当前数据。 Screenshot from 2020-12-09 20-59-43
    opened by zhen8838 6
  • 请问下这个项目可以在macOS下运行吗

    请问下这个项目可以在macOS下运行吗

    尝试了在AIStudio中运行,遇到了人机验证错误,堆栈溢出的错误,所以想尝试本地运行,但是发现必要的环境是无法安装,如下所示:

    ➜  PaddleGAN git:(develop) pip install paddlepaddle-gpu==2.1.0.post101 -f https://mirror.baidu.com/pypi/simple
    Looking in links: https://mirror.baidu.com/pypi/simple
    ERROR: Could not find a version that satisfies the requirement paddlepaddle-gpu==2.1.0.post101
    ERROR: No matching distribution found for paddlepaddle-gpu==2.1.0.post101
    WARNING: You are using pip version 20.3.1; however, version 21.2.4 is available.
    You should consider upgrading via the '/usr/local/opt/[email protected]/bin/python3.9 -m pip install --upgrade pip' command.
    

    所以是我的操作问题吗?我的设备环境如下:

    image

    opened by tianjyan 5
  • Photo2cartoon 应用中,dlib 19.21.1 版本,多张人脸报错

    Photo2cartoon 应用中,dlib 19.21.1 版本,多张人脸报错

    AttributeError: '_dlib_pybind11.rectangle' object has no attribute 'rect'

    得到的结果是这样的

    rectangles[[(26, 73) (167, 214)], [(229, 73) (370, 214)]]

    应该是版本的问题

    opened by guchengxi1994 5
  • first-order-demo运行遇到的问题

    first-order-demo运行遇到的问题

    运行环境:

    Ai Studio高级版

    前置操作:

    1. ! python3 -m pip install paddlepaddle-gpu==2.0.0b0 -i https://mirror.baidu.com/pypi/simple
    2. ! git clone https://hub.fastgit.org/PaddlePaddle/PaddleGAN.git
    3. cd PaddleGAN && python -u applications/tools/first-order-demo.py --driving_video datasets/unravel.flv --source_image datasets/ssc.jpg --relative --adapt_scale

    报错信息

    Traceback (most recent call last):
      File "applications/tools/first-order-demo.py", line 18, in <module>
        from ppgan.apps.first_order_predictor import FirstOrderPredictor
      File "/home/aistudio/PaddleGAN/ppgan/apps/__init__.py", line 2, in <module>
        from .deepremaster_predictor import DeepRemasterPredictor
      File "/home/aistudio/PaddleGAN/ppgan/apps/deepremaster_predictor.py", line 24, in <module>
        from ppgan.models.generators.remaster import NetworkR, NetworkC
      File "/home/aistudio/PaddleGAN/ppgan/models/__init__.py", line 20, in <module>
        from .makeup_model import MakeupModel
      File "/home/aistudio/PaddleGAN/ppgan/models/makeup_model.py", line 30, in <module>
        from ..datasets.makeup_dataset import MakeupDataset
      File "/home/aistudio/PaddleGAN/ppgan/datasets/__init__.py", line 15, in <module>
        from .unpaired_dataset import UnpairedDataset
      File "/home/aistudio/PaddleGAN/ppgan/datasets/unpaired_dataset.py", line 4, in <module>
        from .base_dataset import BaseDataset, get_transform
      File "/home/aistudio/PaddleGAN/ppgan/datasets/base_dataset.py", line 10, in <module>
        from .transforms import transforms as T
      File "/home/aistudio/PaddleGAN/ppgan/datasets/transforms/__init__.py", line 1, in <module>
        from .transforms import PairedRandomCrop, PairedRandomHorizontalFlip
      File "/home/aistudio/PaddleGAN/ppgan/datasets/transforms/transforms.py", line 23, in <module>
        TRANSFORMS.register(T.Transpose)
    AttributeError: module 'paddle.vision.transforms' has no attribute 'Transpose'
    
    opened by xincan1949 5
  • MPR_Net训练过程中GPU开飞机,显存持续上涨

    MPR_Net训练过程中GPU开飞机,显存持续上涨

    如题,PaddleGAN MPR_Net训练过程中GPU开飞机,显存持续上涨,直到100%。

    运行环境:AI Studio最新版本GPU32G(BML Codelab 2.2.1 Python3) 代码:PaddleGAN最新版本(v2.1.0) 训练命令:

    python -u tools/main.py --config-file configs/mprnet_test.yaml
    

    配置文件(mprnet_test.yaml)

    total_iters: 100000
    output_dir: output/mprnet
    enable_visualdl: True
    
    model:
      name: MPRModel
      generator:
        name: MPRNet
        n_feat: 40
        scale_unetfeats: 20
        scale_orsnetfeats: 16
    
      char_criterion:
        name: CharbonnierLoss
      edge_criterion:
        name: EdgeLoss
    
    dataset:
      train:
        name: MPRTrain
        rgb_dir: data/mydata/train
        num_workers: 0
        batch_size: 1
        img_options:
          patch_size: 16
      test:
        name: MPRTrain
        rgb_dir: data/mydata/val
        num_workers: 0
        batch_size: 1
        img_options:
          patch_size: 16
    
    lr_scheduler:
      name: CosineAnnealingRestartLR
      learning_rate: !!float 2e-4
      periods: [25000, 25000, 25000, 25000]
      restart_weights: [1, 1, 1, 1]
      eta_min: !!float 1e-6
    
    validate:
      interval: 2000
      save_img: false
    
      metrics:
        psnr: # metric name, can be arbitrary
          name: PSNR
          crop_border: 4
          test_y_channel: True
        ssim:
          name: SSIM
          crop_border: 4
          test_y_channel: True
    
    optimizer:
      name: Adam
      # add parameters of net_name to optim
      # name should in self.nets
      net_names:
        - generator
      beta1: 0.9
      beta2: 0.999
      epsilon: 1e-8
    
    log_config:
      interval: 50
      visiual_interval: 200
    
    snapshot_config:
      interval: 2000
    
    

    部分训练日志

    [01/18 14:28:56] ppgan.engine.trainer INFO: Iter: 950/100000 lr: 1.993e-04 loss: 7.585 batch_cost: 0.13380 sec reader_cost: 0.00008 sec ips: 7.47377 images/s eta: 3:40:53
    [01/18 14:29:03] ppgan.engine.trainer INFO: Iter: 1000/100000 lr: 1.992e-04 loss: 10.412 batch_cost: 0.13585 sec reader_cost: 0.00009 sec ips: 7.36111 images/s eta: 3:44:09
    [01/18 14:29:09] ppgan.engine.trainer INFO: Iter: 1050/100000 lr: 1.991e-04 loss: 26.876 batch_cost: 0.12891 sec reader_cost: 0.00008 sec ips: 7.75758 images/s eta: 3:32:35
    [01/18 14:29:16] ppgan.engine.trainer INFO: Iter: 1100/100000 lr: 1.991e-04 loss: 13.800 batch_cost: 0.14733 sec reader_cost: 0.00010 sec ips: 6.78764 images/s eta: 4:02:50
    [01/18 14:29:23] ppgan.engine.trainer INFO: Iter: 1150/100000 lr: 1.990e-04 loss: 13.804 batch_cost: 0.12896 sec reader_cost: 0.00008 sec ips: 7.75449 images/s eta: 3:32:27
    [01/18 14:29:29] ppgan.engine.trainer INFO: Iter: 1200/100000 lr: 1.989e-04 loss: 4.678 batch_cost: 0.13077 sec reader_cost: 0.00008 sec ips: 7.64728 images/s eta: 3:35:19
    [01/18 14:29:36] ppgan.engine.trainer INFO: Iter: 1250/100000 lr: 1.988e-04 loss: 11.096 batch_cost: 0.13756 sec reader_cost: 0.00008 sec ips: 7.26970 images/s eta: 3:46:23
    [01/18 14:29:44] ppgan.engine.trainer INFO: Iter: 1300/100000 lr: 1.987e-04 loss: 24.029 batch_cost: 0.14615 sec reader_cost: 0.00010 sec ips: 6.84228 images/s eta: 4:00:25
    [01/18 14:29:51] ppgan.engine.trainer INFO: Iter: 1350/100000 lr: 1.986e-04 loss: 14.311 batch_cost: 0.14573 sec reader_cost: 0.00009 sec ips: 6.86211 images/s eta: 3:59:36
    [01/18 14:29:58] ppgan.engine.trainer INFO: Iter: 1400/100000 lr: 1.985e-04 loss: 17.655 batch_cost: 0.14838 sec reader_cost: 0.00010 sec ips: 6.73934 images/s eta: 4:03:50
    [01/18 14:30:06] ppgan.engine.trainer INFO: Iter: 1450/100000 lr: 1.984e-04 loss: 9.815 batch_cost: 0.14712 sec reader_cost: 0.00010 sec ips: 6.79716 images/s eta: 4:01:38
    [01/18 14:30:13] ppgan.engine.trainer INFO: Iter: 1500/100000 lr: 1.982e-04 loss: 20.609 batch_cost: 0.15017 sec reader_cost: 0.00010 sec ips: 6.65920 images/s eta: 4:06:31
    [01/18 14:30:21] ppgan.engine.trainer INFO: Iter: 1550/100000 lr: 1.981e-04 loss: 22.655 batch_cost: 0.14877 sec reader_cost: 0.00010 sec ips: 6.72189 images/s eta: 4:04:06
    [01/18 14:30:28] ppgan.engine.trainer INFO: Iter: 1600/100000 lr: 1.980e-04 loss: 22.751 batch_cost: 0.14651 sec reader_cost: 0.00010 sec ips: 6.82556 images/s eta: 4:00:16
    [01/18 14:30:35] ppgan.engine.trainer INFO: Iter: 1650/100000 lr: 1.979e-04 loss: 368.427 batch_cost: 0.14723 sec reader_cost: 0.00010 sec ips: 6.79201 images/s eta: 4:01:20
    [01/18 14:30:43] ppgan.engine.trainer INFO: Iter: 1700/100000 lr: 1.977e-04 loss: 19.512 batch_cost: 0.14658 sec reader_cost: 0.00009 sec ips: 6.82226 images/s eta: 4:00:08
    [01/18 14:30:50] ppgan.engine.trainer INFO: Iter: 1750/100000 lr: 1.976e-04 loss: 9.517 batch_cost: 0.14538 sec reader_cost: 0.00009 sec ips: 6.87872 images/s eta: 3:58:03
    [01/18 14:30:57] ppgan.engine.trainer INFO: Iter: 1800/100000 lr: 1.975e-04 loss: 17.127 batch_cost: 0.13771 sec reader_cost: 0.00009 sec ips: 7.26190 images/s eta: 3:45:22
    [01/18 14:31:03] ppgan.engine.trainer INFO: Iter: 1850/100000 lr: 1.973e-04 loss: 9.396 batch_cost: 0.13269 sec reader_cost: 0.00009 sec ips: 7.53654 images/s eta: 3:37:03
    [01/18 14:31:10] ppgan.engine.trainer INFO: Iter: 1900/100000 lr: 1.972e-04 loss: 11.732 batch_cost: 0.12869 sec reader_cost: 0.00008 sec ips: 7.77042 images/s eta: 3:30:24
    [01/18 14:31:17] ppgan.engine.trainer INFO: Iter: 1950/100000 lr: 1.970e-04 loss: 6.371 batch_cost: 0.14135 sec reader_cost: 0.00009 sec ips: 7.07441 images/s eta: 3:50:59
    [01/18 14:31:24] ppgan.engine.trainer INFO: Iter: 2000/100000 lr: 1.969e-04 loss: 19.288 batch_cost: 0.14611 sec reader_cost: 0.00009 sec ips: 6.84437 images/s eta: 3:58:38
    [01/18 14:31:24] ppgan.engine.trainer INFO: Test iter: [0/836]
    /home/aistudio/work/PaddleGAN/ppgan/metrics/psnr_ssim.py:176: RuntimeWarning: Mean of empty slice.
      return ssim_map.mean()
    /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/numpy/core/_methods.py:188: RuntimeWarning: invalid value encountered in double_scalars
      ret = ret.dtype.type(ret / rcount)
    [01/18 14:31:30] ppgan.engine.trainer INFO: Test iter: [50/836]
    [01/18 14:31:36] ppgan.engine.trainer INFO: Test iter: [100/836]
    [01/18 14:31:41] ppgan.engine.trainer INFO: Test iter: [150/836]
    [01/18 14:31:47] ppgan.engine.trainer INFO: Test iter: [200/836]
    [01/18 14:31:52] ppgan.engine.trainer INFO: Test iter: [250/836]
    [01/18 14:31:58] ppgan.engine.trainer INFO: Test iter: [300/836]
    [01/18 14:32:04] ppgan.engine.trainer INFO: Test iter: [350/836]
    [01/18 14:32:09] ppgan.engine.trainer INFO: Test iter: [400/836]
    [01/18 14:32:15] ppgan.engine.trainer INFO: Test iter: [450/836]
    [01/18 14:32:20] ppgan.engine.trainer INFO: Test iter: [500/836]
    [01/18 14:32:26] ppgan.engine.trainer INFO: Test iter: [550/836]
    [01/18 14:32:31] ppgan.engine.trainer INFO: Test iter: [600/836]
    [01/18 14:32:37] ppgan.engine.trainer INFO: Test iter: [650/836]
    [01/18 14:32:42] ppgan.engine.trainer INFO: Test iter: [700/836]
    [01/18 14:32:48] ppgan.engine.trainer INFO: Test iter: [750/836]
    [01/18 14:32:54] ppgan.engine.trainer INFO: Test iter: [800/836]
    [01/18 14:32:58] ppgan.engine.trainer INFO: Metric psnr: inf
    [01/18 14:32:58] ppgan.engine.trainer INFO: Metric ssim: nan
    [01/18 14:33:05] ppgan.engine.trainer INFO: Iter: 2050/100000 lr: 1.967e-04 loss: 4.794 batch_cost: 0.12932 sec reader_cost: 0.00008 sec ips: 7.73275 images/s eta: 3:31:06
    [01/18 14:33:11] ppgan.engine.trainer INFO: Iter: 2100/100000 lr: 1.966e-04 loss: 6.932 batch_cost: 0.13047 sec reader_cost: 0.00008 sec ips: 7.66441 images/s eta: 3:32:53
    [01/18 14:33:18] ppgan.engine.trainer INFO: Iter: 2150/100000 lr: 1.964e-04 loss: 11.207 batch_cost: 0.13163 sec reader_cost: 0.00009 sec ips: 7.59711 images/s eta: 3:34:39
    [01/18 14:33:24] ppgan.engine.trainer INFO: Iter: 2200/100000 lr: 1.962e-04 loss: 11.202 batch_cost: 0.13088 sec reader_cost: 0.00008 sec ips: 7.64079 images/s eta: 3:33:19
    [01/18 14:33:31] ppgan.engine.trainer INFO: Iter: 2250/100000 lr: 1.961e-04 loss: 11.765 batch_cost: 0.13034 sec reader_cost: 0.00008 sec ips: 7.67220 images/s eta: 3:32:20
    [01/18 14:33:37] ppgan.engine.trainer INFO: Iter: 2300/100000 lr: 1.959e-04 loss: 12.314 batch_cost: 0.13326 sec reader_cost: 0.00009 sec ips: 7.50428 images/s eta: 3:36:59
    [01/18 14:33:44] ppgan.engine.trainer INFO: Iter: 2350/100000 lr: 1.957e-04 loss: 3.787 batch_cost: 0.13138 sec reader_cost: 0.00009 sec ips: 7.61134 images/s eta: 3:33:49
    [01/18 14:33:50] ppgan.engine.trainer INFO: Iter: 2400/100000 lr: 1.955e-04 loss: 11.284 batch_cost: 0.12889 sec reader_cost: 0.00008 sec ips: 7.75870 images/s eta: 3:29:39
    [01/18 14:33:57] ppgan.engine.trainer INFO: Iter: 2450/100000 lr: 1.953e-04 loss: 22.345 batch_cost: 0.12972 sec reader_cost: 0.00008 sec ips: 7.70919 images/s eta: 3:30:53
    [01/18 14:34:03] ppgan.engine.trainer INFO: Iter: 2500/100000 lr: 1.951e-04 loss: 16.613 batch_cost: 0.12862 sec reader_cost: 0.00008 sec ips: 7.77481 images/s eta: 3:29:00
    Exception in thread Thread-2:
    Traceback (most recent call last):
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/threading.py", line 926, in _bootstrap_inner
        self.run()
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/threading.py", line 870, in run
        self._target(*self._args, **self._kwargs)
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/dataloader_iter.py", line 213, in _thread_loop
        self._thread_done_event)
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/fetcher.py", line 121, in fetch
        data.append(self.dataset[idx])
      File "/home/aistudio/work/PaddleGAN/ppgan/datasets/mpr_dataset.py", line 105, in __getitem__
        inp_img = to_tensor(inp_img)
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/vision/transforms/functional.py", line 82, in to_tensor
        return F_pil.to_tensor(pic, data_format)
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/vision/transforms/functional_pil.py", line 88, in to_tensor
        img = paddle.cast(img, np.float32) / 255.
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/layers/tensor.py", line 249, in cast
        out = _C_ops.cast(x, 'in_dtype', x.dtype, 'out_dtype', dtype)
    SystemError: (Fatal) Operator cast raises an paddle::memory::allocation::BadAlloc exception.
    The exception content is
    :ResourceExhaustedError: 
    
    Out of memory error on GPU 0. Cannot allocate 3.000244MB memory on GPU 0, 31.716675GB memory has been allocated and available memory is only 2.625000MB.
    
    Please check whether there is any other process using GPU 0.
    1. If yes, please stop them, or start PaddlePaddle on another GPU.
    2. If no, please decrease the batch size of your model. 
    
     (at /paddle/paddle/fluid/memory/allocation/cuda_allocator.cc:79)
    . (at /paddle/paddle/fluid/imperative/tracer.cc:221)
    
    
    Traceback (most recent call last):
      File "tools/main.py", line 56, in <module>
        main(args, cfg)
      File "tools/main.py", line 46, in main
        trainer.train()
      File "/home/aistudio/work/PaddleGAN/ppgan/engine/trainer.py", line 191, in train
        self.model.train_iter(self.optimizers)
      File "/home/aistudio/work/PaddleGAN/ppgan/models/mpr_model.py", line 59, in train_iter
        restored = self.nets['generator'](self.lq)
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 914, in __call__
        outputs = self.forward(*inputs, **kwargs)
      File "/home/aistudio/work/PaddleGAN/ppgan/models/generators/mpr.py", line 510, in forward
        x3_cat = self.stage3_orsnet(x3_cat, feat2, res2)
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 914, in __call__
        outputs = self.forward(*inputs, **kwargs)
      File "/home/aistudio/work/PaddleGAN/ppgan/models/generators/mpr.py", line 338, in forward
        x = self.orb3(x)
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 914, in __call__
        outputs = self.forward(*inputs, **kwargs)
      File "/home/aistudio/work/PaddleGAN/ppgan/models/generators/mpr.py", line 276, in forward
        res = self.body(x)
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 914, in __call__
        outputs = self.forward(*inputs, **kwargs)
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/container.py", line 98, in forward
        input = layer(input)
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 914, in __call__
        outputs = self.forward(*inputs, **kwargs)
      File "/home/aistudio/work/PaddleGAN/ppgan/models/generators/mpr.py", line 65, in forward
        res = self.body(x)
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 914, in __call__
        outputs = self.forward(*inputs, **kwargs)
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/container.py", line 98, in forward
        input = layer(input)
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 914, in __call__
        outputs = self.forward(*inputs, **kwargs)
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/nn/layer/conv.py", line 677, in forward
        use_cudnn=self._use_cudnn)
      File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/nn/functional/conv.py", line 123, in _conv_nd
        pre_bias = getattr(_C_ops, op_type)(x, weight, *attrs)
    SystemError: (Fatal) Operator conv2d raises an paddle::memory::allocation::BadAlloc exception.
    The exception content is
    :ResourceExhaustedError: 
    
    Out of memory error on GPU 0. Cannot allocate 334.750000kB memory on GPU 0, 31.716675GB memory has been allocated and available memory is only 2.625000MB.
    
    Please check whether there is any other process using GPU 0.
    1. If yes, please stop them, or start PaddlePaddle on another GPU.
    2. If no, please decrease the batch size of your model. 
    
     (at /paddle/paddle/fluid/memory/allocation/cuda_allocator.cc:79)
    . (at /paddle/paddle/fluid/imperative/tracer.cc:221)
    
    opened by hhxdestiny 4
  • 本地使用wav2lip各种尝试都报段错误

    本地使用wav2lip各种尝试都报段错误

    按照官方教程一步步跑示例

    Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations if data.dtype == np.object: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:02<00:00, 2.75s/it] 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:02<00:00, 2.75s/it]


    C++ Traceback (most recent call last):

    0 paddle::framework::SignalHandle(char const*, int) 1 paddle::platform::GetCurrentTraceBackStringabi:cxx11


    Error Message Summary:

    FatalError: Segmentation fault is detected by the operating system. [TimeInfo: *** Aborted at 1620281429 (unix time) try "date -d @1620281429" if you are using GNU date ***] [SignalInfo: *** SIGSEGV (@0x0) received by PID 32030 (TID 0x7effcb6f4740) from PID 0 ***]

    question 
    opened by thunder95 4
  • error when running `applications/tools/animeganv2.py`

    error when running `applications/tools/animeganv2.py`

    code is like: python applications/tools/animeganv2.py --input_image path/to/gakki.png --output_path path/to/animeGAN errors are:

    --------------------------------------
    C++ Traceback (most recent call last):
    --------------------------------------
    0   paddle::imperative::Tracer::TraceOp(std::string const&, paddle::imperative::NameVarBaseMap const&, paddle::imperative::NameVarBaseMap const&, paddle::framework::AttributeMap, std::map<std::string, std::string, std::less<std::string >, std::allocator<std::pair<std::string const, std::string > > > const&)
    1   paddle::imperative::Tracer::TraceOp(std::string const&, paddle::imperative::NameVarBaseMap const&, paddle::imperative::NameVarBaseMap const&, paddle::framework::AttributeMap, paddle::platform::Place const&, bool, std::map<std::string, std::string, std::less<std::string >, std::allocator<std::pair<std::string const, std::string > > > const&)
    2   paddle::imperative::PreparedOp::Run(paddle::imperative::NameVarBaseMap const&, paddle::imperative::NameVarBaseMap const&, paddle::framework::AttributeMap const&)
    3   std::_Function_handler<void (paddle::framework::ExecutionContext const&), paddle::framework::OpKernelRegistrarFunctor<paddle::platform::CPUPlace, false, 0ul, paddle::operators::GemmConvKernel<paddle::platform::CPUDeviceContext, float>, paddle::operators::GemmConvKernel<paddle::platform::CPUDeviceContext, double> >::operator()(char const*, char const*, int) const::{lambda(paddle::framework::ExecutionContext const&)#1}>::_M_invoke(std::_Any_data const&, paddle::framework::ExecutionContext const&)
    4   paddle::operators::GemmConvKernel<paddle::platform::CPUDeviceContext, float>::Compute(paddle::framework::ExecutionContext const&) const
    5   paddle::operators::math::Im2ColFunctor<(paddle::operators::math::ColFormat)0, paddle::platform::CPUDeviceContext, float>::operator()(paddle::platform::CPUDeviceContext const&, paddle::framework::Tensor const&, std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&, paddle::framework::Tensor*, paddle::framework::DataLayout)
    6   paddle::framework::SignalHandle(char const*, int)
    7   paddle::platform::GetCurrentTraceBackString[abi:cxx11]()
    
    ----------------------
    Error Message Summary:
    ----------------------
    FatalError: `Segmentation fault` is detected by the operating system.
      [TimeInfo: *** Aborted at 1615879561 (unix time) try "date -d @1615879561" if you are using GNU date ***]
      [SignalInfo: *** SIGSEGV (@0x7f56573e42c0) received by PID 11689 (TID 0x7f60fec05740) from PID 1463698112 ***]
    
    Segmentation fault (core dumped)
    
    

    my environment: ubuntu 18.04,python 3.8.5,paddlepaddle-gpu 2.0.0

    opened by oukohou 4
  • Pixel2Style2Pixel 是否已经out of date?

    Pixel2Style2Pixel 是否已经out of date?

    docs/zh_CN/tutorials/pixel2style2pixel.md里的参数配置:

    cd applications/
    python -u tools/styleganv2.py \
           --input_image <替换为输入的图像路径> \
           --output_path <替换为生成图片存放的文件夹> \
           --weight_path <替换为你的预训练模型路径> \
           --model_type ffhq-inversion \
           --seed 233 \
           --size 1024 \
           --style_dim 512 \
           --n_mlp 8 \
           --channel_multiplier 2 \
           --cpu
    

    可实际所调用的tools/styleganv2.py里并无参数input_image?

    opened by oukohou 4
  • [chore] Free librosa version

    [chore] Free librosa version

    (zh version after en | 英文后面是中文)

    Why? | 为什么?

    Locking librosa strictly to v0.8.1 makes PaddleGAN more difficult to be used with other packages.


    把 librosa 版本严格锁在 v0.8.1 导致 PaddleGAN 更难和其它包一起使用。

    Is it safe? | 这安全吗?

    We only use librosa to read/write wav! Search librosa in the repo.

    (You can check the change log if you want)


    ~~我们用 librosa 只是为了读写 wav!~~在仓库中搜索 librosa。

    (也可再检查一下更新日志

    History of the librosa version | librosa 版本的历史

    1. Add librosa v0.7.0: add requirement for wav2lip (#147) @a8ba73b
    2. Free librosa version: fix numba install in py39 (#427) @5a639c0
    3. Lock librosa to v0.8.1: update librosa version (#504) @0235853

    1. 添加 librosa v0.7.0: 添加 wav2lip 的依赖 (#147) @a8ba73b
    2. 放松 librosa 版本: fix numba install in py39 (#427) @5a639c0
    3. 锁定 librosa 到 v0.8.1: 更新 librosa 版本 (#504) @0235853
    opened by YDX-2147483647 3
  • PaddleGAN中MPRNet训练问题

    PaddleGAN中MPRNet训练问题

    问题描述: 使用PaddleGAN中mprnet_deblurring.yaml进行训练,选用了GoPro数据集,未修改其余参数。 使用环境: AI Studio在线平台、PaddlePaddle2.2.0、Python3.7 代码如下:

    从github上克隆PaddleGAN代码 !git clone https://gitee.com/paddlepaddle/PaddleGAN 安装所需安装包 %cd PaddleGAN/ !pip install -r requirements.txt !pip install imageio-ffmpeg %cd applications/ 单卡训练 !python -u PaddleGAN/tools/main.py --config-file work/mprnet_deblurring.yaml

    报错如下:

    [11/18 15:19:07] ppgan INFO: Configs: {'total_iters': 100000, 'output_dir': 'output_dir/mprnet_deblurring-2021-11-18-15-19', 'model': {'name': 'MPRModel', 'generator': {'name': 'MPRNet'}, 'char_criterion': {'name': 'CharbonnierLoss'}, 'edge_criterion': {'name': 'EdgeLoss'}}, 'dataset': {'train': {'name': 'MPRTrain', 'rgb_dir': 'GoPro', 'num_workers': 16, 'batch_size': 4, 'img_options': {'patch_size': 256}}, 'test': {'name': 'MPRTrain', 'rgb_dir': 'GoPro', 'num_workers': 16, 'batch_size': 4, 'img_options': {'patch_size': 256}}}, 'lr_scheduler': {'name': 'CosineAnnealingRestartLR', 'learning_rate': 0.0002, 'periods': [25000, 25000, 25000, 25000], 'restart_weights': [1, 1, 1, 1], 'eta_min': 1e-06}, 'validate': {'interval': 10, 'save_img': False, 'metrics': {'psnr': {'name': 'PSNR', 'crop_border': 4, 'test_y_channel': True}, 'ssim': {'name': 'SSIM', 'crop_border': 4, 'test_y_channel': True}}}, 'optimizer': {'name': 'Adam', 'net_names': ['generator'], 'beta1': 0.9, 'beta2': 0.999, 'epsilon': 1e-08}, 'log_config': {'interval': 10, 'visiual_interval': 5000}, 'snapshot_config': {'interval': 5000}, 'is_train': True, 'profiler_options': None, 'timestamp': '-2021-11-18-15-19'} W1118 15:19:07.026855 714 device_context.cc:404] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 10.1, Runtime API Version: 10.1 W1118 15:19:07.031368 714 device_context.cc:422] device: 0, cuDNN Version: 7.6. /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/tensor/creation.py:125: DeprecationWarning: np.object is a deprecated alias for the builtin object. To silence this warning, use object by itself. Doing this will not modify any behavior and is safe. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations if data.dtype == np.object: Traceback (most recent call last): File "PaddleGAN/tools/main.py", line 56, in main(args, cfg) File "PaddleGAN/tools/main.py", line 46, in main trainer.train() File "/home/aistudio/PaddleGAN/ppgan/engine/trainer.py", line 190, in train self.model.train_iter(self.optimizers) File "/home/aistudio/PaddleGAN/ppgan/models/mpr_model.py", line 65, in train_iter loss_edge.append(self.edge_criterion(restored[i], self.target)) File "/home/aistudio/PaddleGAN/ppgan/models/criterions/pixel_loss.py", line 270, in call loss = self.loss(self.laplacian_kernel(x), self.laplacian_kernel(y)) File "/home/aistudio/PaddleGAN/ppgan/models/criterions/pixel_loss.py", line 264, in laplacian_kernel new_filter[:,:,::2,::2] = down*4 # upsample ValueError: (InvalidArgument) Leaf Tensor (dygraph_tmp_1341) that doesn't stop gradient can't use inplace strategy. [Hint: Expected self->IsLeaf() && !self->OverridedStopGradient() == false, but received self->IsLeaf() && !self->OverridedStopGradient():1 != false:0.] (at /paddle/paddle/fluid/pybind/imperative.cc:718)

    opened by ONEISALL-h 3
  • update numba version to be compatible with python3.10

    update numba version to be compatible with python3.10

    thank you for great project! I have issue with installing ppgan package with python3.10, because there is no such version for numba package on pypi. Could you please relax it to make it compatibe with new python versions?

    opened by eaidova 2
  • NAFNet 训练时,当训练集数不足时

    NAFNet 训练时,当训练集数不足时

    Traceback (most recent call last): File "tools/main.py", line 56, in main(args, cfg) File "tools/main.py", line 46, in main Exception in thread Thread-1: Traceback (most recent call last): File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/threading.py", line 926, in _bootstrap_inner self.run() File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/dataloader_iter.py", line 534, in _thread_loop batch = self._get_data() File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/dataloader_iter.py", line 671, in _get_data batch.reraise() File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/worker.py", line 169, in reraise raise self.exc_type(msg) ValueError: DataLoader worker(0) caught ValueError with message: Traceback (most recent call last): File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/worker.py", line 336, in _worker_loop batch = fetcher.fetch(indices) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/fetcher.py", line 121, in fetch data.append(self.dataset[idx]) File "/home/aistudio/PaddleGAN-develop/ppgan/datasets/nafnet_dataset.py", line 64, in getitem padding_mode='reflect') File "<array_function internals>", line 6, in pad File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/numpy/lib/arraypad.py", line 746, in pad pad_width = _as_pairs(pad_width, array.ndim, as_index=True) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/numpy/lib/arraypad.py", line 521, in _as_pairs return np.broadcast_to(x, (ndim, 2)).tolist() File "<array_function internals>", line 6, in broadcast_to File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/numpy/lib/stride_tricks.py", line 180, in broadcast_to return _broadcast_to(array, shape, subok=subok, readonly=True) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/numpy/lib/stride_tricks.py", line 125, in _broadcast_to op_flags=['readonly'], itershape=shape, order='C') ValueError: operands could not be broadcast together with remapped shapes [original->remapped]: (4,) and requested shape (3,2)

    800张训练集,batch_size 8,patch_size 100 时不会出现 当 patch_size 设置为更大的数时会出现

    疑似错误代码:

            # Reflect Pad in case image is smaller than patch_size
            if padw != 0 or padh != 0:
                inp_img = np.pad(inp_img, (0, 0, padw, padh),
                                 padding_mode='reflect')
                tar_img = np.pad(tar_img, (0, 0, padw, padh),
                                 padding_mode='reflect')
    
    
    opened by rsj123 0
  • 视频超分模型导出问题

    视频超分模型导出问题

    在以下文档中所有的视频超分模型如何导出呀?

    https://github.com/PaddlePaddle/PaddleGAN/blob/develop/docs/zh_CN/tutorials/video_super_resolution.md
    

    环境:cpu环境 版本:paddlegan develop 导出命令:

    python tools/export_model.py -c configs/msvsr_l_reds.yaml --inputs_size="1,2,3,180,320" --model_name model --load ~/Downloads/PP-MSVSR-L_reds_x4.pdparams
    

    问题:模型导出除了按照教程中的pp-msvsr导出模型成功,其他pp-msvsr-l 等等 其它模型导出错误,提示

    [11/07 10:08:28] ppgan INFO: Found /Users/aichao/.cache/ppgan/modified_spynet.pdparams
    Traceback (most recent call last):
      File "./ppgan/utils/config.py", line 23, in __getattr__
        return self[key]
    KeyError: 'export_model'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "tools/export_model.py", line 88, in <module>
        main(args, cfg)
      File "tools/export_model.py", line 81, in main
        model.export_model(cfg.export_model, args.output_dir, inputs_size,
      File "./ppgan/utils/config.py", line 25, in __getattr__
        raise AttributeError(key)
    AttributeError: export_model
    
    opened by ChaoII 0
Releases(v2.1.0)
  • v2.1.0(Jan 4, 2022)

    Release Note

    PaddleGAN 2.1.0版本有如下重要更新:

    • 发布视频超分辨率模型PP-MSVSR以及多个预训练权重
    • 发布轻量级动作驱动模型(体积压缩:229M->10.1M),并优化融合效果
    • 发布高分辨率的FOMM和Wav2Lip预训练模型
    • 发布人脸反演,人脸融合和人脸编辑等多个基于StyleGANv2的有趣应用
    • 发布百度自研且效果领先的风格迁移模型LapStyle及其有趣应用,并上线官网体验页面
    • 发布轻量的图像超分辨模型PAN
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Jun 2, 2021)

  • v2.0.0-beta(Mar 1, 2021)

Owner
null
A small tool to joint picture including gif

README 做设计的时候遇到拼接长图的情况,但是发现没有什么好用的能拼接gif的工具。 于是自己写了个gif拼接小工具。 可以自动拼接gif、png和jpg等常见格式。 效果 从上至下 从下至上 从左至右 从右至左 使用 克隆仓库 git clone https://github.com/Dels

null 3 Dec 15, 2021
A PaddlePaddle implementation of STGCN with a few modifications in the model architecture in order to forecast traffic jam.

About This repository contains the code of a PaddlePaddle implementation of STGCN based on the paper Spatio-Temporal Graph Convolutional Networks: A D

Tianjian Li 1 Jan 11, 2022
Open CV - Convert a picture to look like a cartoon sketch in python

Use the video https://www.youtube.com/watch?v=k7cVPGpnels for initial learning.

Sammith S Bharadwaj 3 Jan 29, 2022
[ICML 2021] Break-It-Fix-It: Learning to Repair Programs from Unlabeled Data

Break-It-Fix-It: Learning to Repair Programs from Unlabeled Data This repo provides the source code & data of our paper: Break-It-Fix-It: Unsupervised

Michihiro Yasunaga 86 Nov 30, 2022
Very simple NCHW and NHWC conversion tool for ONNX. Change to the specified input order for each and every input OP. Also, change the channel order of RGB and BGR. Simple Channel Converter for ONNX.

scc4onnx Very simple NCHW and NHWC conversion tool for ONNX. Change to the specified input order for each and every input OP. Also, change the channel

Katsuya Hyodo 16 Dec 22, 2022
A modular, primitive-first, python-first PyTorch library for Reinforcement Learning.

TorchRL Disclaimer This library is not officially released yet and is subject to change. The features are available before an official release so that

Meta Research 860 Jan 7, 2023
Implementation for HFGI: High-Fidelity GAN Inversion for Image Attribute Editing

HFGI: High-Fidelity GAN Inversion for Image Attribute Editing High-Fidelity GAN Inversion for Image Attribute Editing Update: We released the inferenc

Tengfei Wang 371 Dec 30, 2022
PaddleRobotics is an open-source algorithm library for robots based on Paddle, including open-source parts such as human-robot interaction, complex motion control, environment perception, SLAM positioning, and navigation.

简体中文 | English PaddleRobotics paddleRobotics是基于paddle的机器人开源算法库集,包括人机交互、复杂运动控制、环境感知、slam定位导航等开源算法部分。 人机交互 主动多模交互技术TFVT-HRI 主动多模交互技术是通过视觉、语音、触摸传感器等输入机器人

null 185 Dec 26, 2022
Official implementation for "Style Transformer for Image Inversion and Editing" (CVPR 2022)

Style Transformer for Image Inversion and Editing (CVPR2022) https://arxiv.org/abs/2203.07932 Existing GAN inversion methods fail to provide latent co

Xueqi Hu 153 Dec 2, 2022
FuseDream: Training-Free Text-to-Image Generationwith Improved CLIP+GAN Space OptimizationFuseDream: Training-Free Text-to-Image Generationwith Improved CLIP+GAN Space Optimization

FuseDream This repo contains code for our paper (paper link): FuseDream: Training-Free Text-to-Image Generation with Improved CLIP+GAN Space Optimizat

XCL 191 Dec 31, 2022
Amazon Forest Computer Vision: Satellite Image tagging code using PyTorch / Keras with lots of PyTorch tricks

Amazon Forest Computer Vision Satellite Image tagging code using PyTorch / Keras Here is a sample of images we had to work with Source: https://www.ka

Mamy Ratsimbazafy 360 Dec 10, 2022
Amazon Forest Computer Vision: Satellite Image tagging code using PyTorch / Keras with lots of PyTorch tricks

Amazon Forest Computer Vision Satellite Image tagging code using PyTorch / Keras Here is a sample of images we had to work with Source: https://www.ka

Mamy Ratsimbazafy 359 Jan 5, 2023
Stitch it in Time: GAN-Based Facial Editing of Real Videos

STIT - Stitch it in Time [Project Page] Stitch it in Time: GAN-Based Facial Edit

null 1.1k Jan 4, 2023
[CVPR 2022] TransEditor: Transformer-Based Dual-Space GAN for Highly Controllable Facial Editing

TransEditor: Transformer-Based Dual-Space GAN for Highly Controllable Facial Editing (CVPR 2022) This repository provides the official PyTorch impleme

Billy XU 128 Jan 3, 2023
Benchmark for Answering Existential First Order Queries with Single Free Variable

EFO-1-QA Benchmark for First Order Query Estimation on Knowledge Graphs This repository contains an entire pipeline for the EFO-1-QA benchmark. EFO-1

HKUST-KnowComp 14 Oct 24, 2022
This Jupyter notebook shows one way to implement a simple first-order low-pass filter on sampled data in discrete time.

How to Implement a First-Order Low-Pass Filter in Discrete Time We often teach or learn about filters in continuous time, but then need to implement t

Joshua Marshall 4 Aug 24, 2022
Fiddle is a Python-first configuration library particularly well suited to ML applications.

Fiddle Fiddle is a Python-first configuration library particularly well suited to ML applications. Fiddle enables deep configurability of parameters i

Google 227 Dec 26, 2022