CV之IG:基于CNN网络架构+ResNet网络进行DIY图像生成网络


W1234
爱吃汉堡包 2022-09-19 16:29:45 49950
分类专栏: 资讯

CV之IG:基于CNN网络架构+ResNet网络进行DIY图像生成网络

目录

设计思路

实现代码


设计思路

实现代码

  1. 定义图像生成网络:image, training,两个参数
  2. Less border effects when padding a little before passing through ..
  3. image = tf.pad(image, [[0, 0], [10, 10], [10, 10], [0, 0]], mode='REFLECT')
  4. with tf.variable_scope('conv1'):
  5. conv1 = relu(instance_norm(conv2d(image, 3, 32, 9, 1)))
  6. with tf.variable_scope('conv2'):
  7. conv2 = relu(instance_norm(conv2d(conv1, 32, 64, 3, 2)))
  8. with tf.variable_scope('conv3'):
  9. conv3 = relu(instance_norm(conv2d(conv2, 64, 128, 3, 2)))
  10. with tf.variable_scope('res1'):
  11. res1 = residual(conv3, 128, 3, 1)
  12. with tf.variable_scope('res2'):
  13. res2 = residual(res1, 128, 3, 1)
  14. with tf.variable_scope('res3'):
  15. res3 = residual(res2, 128, 3, 1)
  16. with tf.variable_scope('res4'):
  17. res4 = residual(res3, 128, 3, 1)
  18. with tf.variable_scope('res5'):
  19. res5 = residual(res4, 128, 3, 1)
  20. print(res5.get_shape())
  21. with tf.variable_scope('deconv1'):
  22. deconv1 = relu(instance_norm(conv2d_transpose(res5, 128, 64, 3, 2)))
  23. deconv1 = relu(instance_norm(resize_conv2d(res5, 128, 64, 3, 2, training)))
  24. with tf.variable_scope('deconv2'):
  25. deconv2 = relu(instance_norm(conv2d_transpose(deconv1, 64, 32, 3, 2)))
  26. deconv2 = relu(instance_norm(resize_conv2d(deconv1, 64, 32, 3, 2, training)))
  27. with tf.variable_scope('deconv3'):
  28. deconv_test = relu(instance_norm(conv2d(deconv2, 32, 32, 2, 1)))
  29. deconv3 = tf.nn.tanh(instance_norm(conv2d(deconv2, 32, 3, 9, 1)))
  30. y = (deconv3 + 1) * 127.5
  31. height = tf.shape(y)[1]
  32. width = tf.shape(y)[2]
  33. y = tf.slice(y, [0, 10, 10, 0], tf.stack([-1, height - 20, width - 20, -1]))
  34. return y

网站声明:如果转载,请联系本站管理员。否则一切后果自行承担。

本文链接:https://www.xckfsq.com/news/show.html?id=3598
赞同 0
评论 0 条
爱吃汉堡包L0
粉丝 0 发表 9 + 关注 私信
上周热门
如何使用 StarRocks 管理和优化数据湖中的数据?  2947
【软件正版化】软件正版化工作要点  2867
统信UOS试玩黑神话:悟空  2828
信刻光盘安全隔离与信息交换系统  2723
镜舟科技与中启乘数科技达成战略合作,共筑数据服务新生态  1256
grub引导程序无法找到指定设备和分区  1221
华为全联接大会2024丨软通动力分论坛精彩议程抢先看!  164
点击报名 | 京东2025校招进校行程预告  163
2024海洋能源产业融合发展论坛暨博览会同期活动-海洋能源与数字化智能化论坛成功举办  162
华为纯血鸿蒙正式版9月底见!但Mate 70的内情还得接着挖...  157
本周热议
我的信创开放社区兼职赚钱历程 40
今天你签到了吗? 27
如何玩转信创开放社区—从小白进阶到专家 15
信创开放社区邀请他人注册的具体步骤如下 15
方德桌面操作系统 14
用抖音玩法闯信创开放社区——用平台宣传企业产品服务 13
我有15积分有什么用? 13
如何让你先人一步获得悬赏问题信息?(创作者必看) 12
2024中国信创产业发展大会暨中国信息科技创新与应用博览会 9
中央国家机关政府采购中心:应当将CPU、操作系统符合安全可靠测评要求纳入采购需求 8

加入交流群

请使用微信扫一扫!