【ganimation整理】不完整版项目分析(包含模型和部分代码)~

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档

Ganimation :通过动作单元(Action Units )操纵人脸表情

ECCV2018
在这里插入图片描述
以面部动作单元(AU)和单独图片为输入的条件GAN
通过类似cycleGAN的思想实现无监督学习

在这里插入图片描述
在这里插入图片描述


数据集准备(git里vipermu的数据集au是错的,需要自己生成au)

CelebA
–image_dir 图像目录
在这里插入图片描述
通过Openface处理人脸图像得到包含对应表情landmarks的文件
–attr_path 图像对应表情向量
在这里插入图片描述


项目目录

# 目录
-ganimation-master
-----config.py            #参数设置
-----data_loader.py       #数据集加载
-----logger.py            #记录参数
-----main.py              #主函数
-----model.py             #模型
-----solver.py			  #操作
-----utils.py  		   	  #相关用法

-----experiments 		  #训练过程中保存log、models的地址
-----data       		  #存放数据集
-----animations    		  #存放animation操作需要的参考图像、参考表情向量
						  #animation的输入图像以及操作输出图像

使用方法(切换至适配的虚拟环境)

1.训练(train)

python main.py --mode train

2.表情编辑(animation)

python main.py --mode animation

model.py 模型定义

初始化权重与定义残差模块

class BaseNetwork(nn.Module): #初始化权重
    def __init__(self):
        super(BaseNetwork, self).__init__()

    def init_weights(self):
        self.apply(self._weights_init_fn)

    def _weights_init_fn(self, m):
        classname = m.__class__.__name__
        if classname.find('Conv') != -1:
            m.weight.data.normal_(0.0, 0.02)
            if hasattr(m.bias, 'data'):
                m.bias.data.fill_(0)
        elif classname.find('BatchNorm2d') != -1:
            m.weight.data.normal_(1.0, 0.02)
            m.bias.data.fill_(0)


class ResidualBlock(BaseNetwork):
    """Residual Block with instance normalization.定义两层卷积结构的残差模块"""

    def __init__(self, dim_in, dim_out):
        super(ResidualBlock, self).__init__()
        self.main = nn.Sequential(
            nn.Conv2d(dim_in, dim_out, kernel_size=3,
                      stride=1, padding=1, bias=False),
            nn.InstanceNorm2d(dim_out, affine=True, track_running_stats=True),
            nn.ReLU(inplace=True),
            nn.Conv2d(dim_out, dim_out, kernel_size=3,
                      stride=1, padding=1, bias=False),
            nn.InstanceNorm2d(dim_out, affine=True, track_running_stats=True))

        self.init_weights()

    def forward(self, x):
        return x + self.main(x)

Generator生成器模型

在这里插入图片描述
提取特征的部分:先经过一个77的大卷积核并将通道数变为64,然后两次下采样,经过6个连续的残差模块提取特征后再两次上采样恢复分辨率。
head部分有两个:color map部分、attention模块:两个head都是有7
7的反卷积恢复到图像原本分辨率,再经过激活函数得到回归结果


class Generator(BaseNetwork):
    """Generator network."""

    def __init__(self, conv_dim=64, c_dim=5, repeat_num=6):
        super(Generator, self).__init__()

        layers = []
        layers.append(nn.Conv2d(3+c_dim, conv_dim, kernel_size=7, #大卷积核展宽通道到64
                                stride=1, padding=3, bias=False))
        layers.append(nn.InstanceNorm2d(
            conv_dim, affine=True, track_running_stats=True))
        layers.append(nn.ReLU(inplace=True))

        self.debug1 = nn.Sequential(*layers)

        # Down-sampling layers.
        curr_dim = conv_dim
        for i in range(2): #两次下采样
            layers.append(nn.Conv2d(
  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
### 回答1: 当然,以下是20个比较流行的AI作画模型代码: 1. StyleGAN2 - https://github.com/NVlabs/stylegan2 2. DALL-E - https://github.com/openai/dall-e 3. BigGAN - https://github.com/ajbrock/BigGAN-PyTorch 4. CycleGAN - https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix 5. Pix2Pix - https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix 6. ProGAN - https://github.com/akanimax/progan-pytorch 7. StarGAN - https://github.com/yunjey/stargan 8. GANimation - https://github.com/albertpumarola/GANimation 9. UNIT - https://github.com/mingyuliutw/UNIT 10. MUNIT - https://github.com/NVlabs/MUNIT 11. BEGAN - https://github.com/carpedm20/BEGAN-tensorflow 12. ACGAN - https://github.com/lukedeo/ac-gan 13. DCGAN - https://github.com/carpedm20/DCGAN-tensorflow 14. DiscoGAN - https://github.com/SKTBrain/DiscoGAN 15. VAE-GAN - https://github.com/rkulas/vae-gan-tensorflow 16. WGAN - https://github.com/carpedm20/WGAN-tensorflow 17. LSGAN - https://github.com/carpedm20/LSGAN-tensorflow 18. EBGAN - https://github.com/carpedm20/EBGAN-tensorflow 19. BICUBIC-SRGAN - https://github.com/leftthomas/SRGAN 20. SRGAN - https://github.com/leftthomas/SRGAN 这些模型都是非常流行的AI作画模型,并且在GitHub上都有开源代码可供使用。希望这些资源能够帮助你。 ### 回答2: 以下是20个比较流行的AI作画模型代码的推荐: 1. DeepArt:https://github.com/woop/DeepArt 2. CycleGAN:https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix 3. Neural-Style:https://github.com/jcjohnson/neural-style 4. FastPhotoStyle:https://github.com/NVIDIA/FastPhotoStyle 5. CartoonGAN:https://github.com/Yijunmaverick/CartoonGAN-Test-Pytorch-Torch 6. DeepDream:https://github.com/google/deepdream 7. DALL-E:https://github.com/openai/DALL-E 8. pix2pixHD:https://github.com/NVIDIA/pix2pixHD 9. MUNIT:https://github.com/NVlabs/MUNIT 10. SPADE:https://github.com/NVlabs/SPADE 11. AnimeGAN:https://github.com/TachibanaYoshino/AnimeGAN 12. Neural-Painter:https://github.com/rylewan/neural-painter 13. WatercolorGAN:https://github.com/nicolalandro/WatercolorGAN 14. DeepArtEffects:https://github.com/fergusonalex/deep-art-effects 15. Neural-Doodle:https://github.com/alexjc/neural-doodle 16. NeuralTalk:https://github.com/karpathy/neuraltalk 17. Neural-Complete:https://github.com/karpathy/neuraltalk2 18. DeepDraw:https://github.com/alexjc/draw 19. DeepNude:https://github.com/alexjc/DeepNude-an-Image-to-Image-technology 20. Neural-Sketch:https://github.com/alexjc/neural-sketch 以上推荐的模型代码都有相应的GitHub链接,你可以根据需求挑选适合你的项目。请注意,有些模型可能涉及敏感内容,使用时请确保合法合规。 ### 回答3: 以下是20个比较流行的AI作画模型代码: 1. DeepArt:这是一个基于深度学习的神经网络模型,可以将图像转化为艺术风格的代码。 2. NeuralStyleTransfer:这是一个基于卷积神经网络的代码,可以将图像的风格迁移到另一个图像上。 3. FastStyleTransfer:这是一个基于快速风格迁移算法的代码,可以快速将图像的风格转化为艺术风格。 4. CycleGAN:这是一个基于循环一致性生成对抗网络的代码,可以将图像从一个域转化到另一个域,如从照片转化为油画风格。 5. DeepDream:这是一个基于卷积神经网络的代码,可以生成迷幻的幻觉效果。 6. Pix2Pix:这是一个基于条件生成对抗网络的代码,可以将输入图像转化为输出图像,并保持其内容和结构。 7. DCGAN:这是一个基于深度卷积生成对抗网络的代码,可以生成逼真的图像。 8. WGAN-GP:这是一个基于改进的生成对抗网络的代码,可以生成更稳定和高质量的图像。 9. VariationalAutoencoder:这是一个基于变分自编码器的代码,可以生成多样化的图像。 10. StyleGAN:这是一个基于生成式对抗网络的代码,可以生成逼真且具有艺术品风格的图像。 11. CartoonGAN:这是一个基于生成对抗网络的代码,可以将图像转化为卡通风格。 12. DeepFaceLab:这是一个基于深度学习代码,可以进行人脸合成和编辑。 13. StarGAN:这是一个基于条件生成对抗网络的代码,可以进行多域图像转换。 14. U-GAT-IT:这是一个基于生成对抗网络的代码,可以进行无监督的图像到图像翻译。 15. OpenAI DALL-E:这是一个基于变分自编码器的代码,可以生成与文本描述相对应的图像。 16. NeuralDoodle:这是一个基于神经网络的代码,可以生成具有艺术风格的涂鸦效果。 17. NeuralTalk:这是一个基于深度学习代码,可以将图像生成相应的文字描述。 18. GPT-3:这是一个基于神经网络的代码,可以生成高质量的文本内容。 19. DeepSpeech:这是一个基于深度学习代码,可以进行语音识别和转写。 20. DeepPose:这是一个基于深度学习代码,可以进行人体姿势估计和识别。 以上是20个比较流行的AI作画模型代码,并涵盖了图像生成、风格迁移、图像转换等多个领域。请根据您的需要选择合适的代码

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值