网站首页 > 开源技术 正文
本文主要讲解如何使用预训练的卷积神经网络AlexNet生成Deep Dream图像
2015年Google发布了一个比较有意思的东西,Deep Dream,关于Deep Dream,可参考查看如下文章
Sherlock:一文理解Deep Dream
Google 开发的 Deep Dream 是如何用算法作画的?
Deep Dream是深度学习的一种特征可视化技术,能够生成强烈激活网络层的图像。通过可视化Deep Dream图像,可以突出显示深层网络学习到的图像特征,这些图像特征对于理解和调试网络非常有用
本文使用MATLAB的Neural Network Toolbox?, Neural Network Toolbox Model for AlexNet Network 来生成Deep Dream图像。
加载预训练网络
加载预训练的AlexNet 网络。如果Neural Network Toolbox Model _for AlexNet Network_没有安装,则MATLAB会提供下载链接。
net = alexnet;生成图像
选择最后一个全连接层。首先查看网络层
net.Layersans =
25x1 Layer array with layers:
1 'data' Image Input 227x227x3 images with 'zerocenter' normalization
2 'conv1' Convolution 96 11x11x3 convolutions with stride [4 4] and padding [0 0 0 0]
3 'relu1' ReLU ReLU
4 'norm1' Cross Channel Normalization cross channel normalization with 5 channels per element
5 'pool1' Max Pooling 3x3 max pooling with stride [2 2] and padding [0 0 0 0]
6 'conv2' Convolution 256 5x5x48 convolutions with stride [1 1] and padding [2 2 2 2]
7 'relu2' ReLU ReLU
8 'norm2' Cross Channel Normalization cross channel normalization with 5 channels per element
9 'pool2' Max Pooling 3x3 max pooling with stride [2 2] and padding [0 0 0 0]
10 'conv3' Convolution 384 3x3x256 convolutions with stride [1 1] and padding [1 1 1 1]
11 'relu3' ReLU ReLU
12 'conv4' Convolution 384 3x3x192 convolutions with stride [1 1] and padding [1 1 1 1]
13 'relu4' ReLU ReLU
14 'conv5' Convolution 256 3x3x192 convolutions with stride [1 1] and padding [1 1 1 1]
15 'relu5' ReLU ReLU
16 'pool5' Max Pooling 3x3 max pooling with stride [2 2] and padding [0 0 0 0]
17 'fc6' Fully Connected 4096 fully connected layer
18 'relu6' ReLU ReLU
19 'drop6' Dropout 50% dropout
20 'fc7' Fully Connected 4096 fully connected layer
21 'relu7' ReLU ReLU
22 'drop7' Dropout 50% dropout
23 'fc8' Fully Connected 1000 fully connected layer
24 'prob' Softmax softmax
25 'output' Classification Output crossentropyex with 'tench', 'goldfish', and 998 other classes
全连接层为第23层
layer = 23;通过设置channels选择要可视化的类
channels = [9 188 231 563 855 975];类名存储在输出层的ClassNames属性中
net.Layers(end).ClassNames(channels)
ans =
6×1 cell array
{'hen' }
{'Yorkshire terrier'}
{'Shetland sheepdog'}
{'fountain' }
{'theater curtain' }
{'geyser' }
使用deepDreamImage函数生成图像
I = deepDreamImage(net,layer,channels);显示图像
figure
montage(I)生成更加细节的图像
增加所谓的“金字塔级别”(pyramid levels)的数量和每个pyramid levels的迭代次数可以生成更加细节的图像。
将迭代次数设置为100
iterations = 100;强烈激活“hen”类别(通道 9)
设置pyramid levels为4
levels = 4;强烈激活“pot”类(通道 739)。
详细代码
https://mianbaoduo.com/o/bread/Y5malZxp
- 上一篇: 十个可用的ai绘画工具
- 下一篇: 在哪里可以用AI绘画
猜你喜欢
- 2024-12-11 十几种AI工具推荐给你,写作类、图像类、设计类,一应俱全!
- 2024-12-11 AI绘画 | 艺术与科技的交汇点
- 2024-12-11 升级显卡玩3A!华硕显卡双十一大促推荐
- 2024-12-11 最新热点:谷歌黑科技,街景也能拍电影?
- 2024-12-11 谷歌的人工智能学会了画画,看起来像是嗑了LSD
- 2024-12-11 在哪里可以用AI绘画
- 2024-12-11 十个可用的ai绘画工具
- 2024-12-11 6个人工智能ai绘画网站分享
- 2024-12-11 谷歌全新研究项目:探索AI与艺术的结合
- 2024-12-11 DEEPDREAM来了!这一次谷歌准备抢艺术家的饭碗
欢迎 你 发表评论:
- 1581℃北京那些看上去很牛的车牌们!(北京厉害车牌)
- 1101℃2025年度视频去水印软件TOP5对比:哪款最值得用
- 671℃《我的世界》不同版本的差异 ——新手向
- 587℃新疆话里的“虫子”
- 543℃正畸治疗后的牙间黑三角
- 504℃蓝牙设备配对失败的系统性解决方案与技术解析
- 503℃中兴光猫 Telnet下设置大全(中兴光猫命令大全)
- 499℃未备份电脑文件数据恢复的七种方法
- 最近发表
- 标签列表
-
- jdk (81)
- putty (66)
- rufus (78)
- 内网穿透 (89)
- okhttp (70)
- powertoys (74)
- windowsterminal (81)
- netcat (65)
- ghostscript (65)
- veracrypt (65)
- asp.netcore (70)
- wrk (67)
- aspose.words (80)
- itk (80)
- ajaxfileupload.js (66)
- sqlhelper (67)
- express.js (67)
- phpmailer (67)
- xjar (70)
- redisclient (78)
- wakeonlan (66)
- tinygo (85)
- startbbs (72)
- webftp (82)
- vsvim (79)

本文暂时没有评论,来添加一个吧(●'◡'●)