Is it possible to view the features of a dagnet network?

1 次查看(过去 30 天)
I'm trying to create examples of images that 'strongly activate' channels of convolutional layers of a CNN (see https://www.mathworks.com/help/nnet/examples/visualize-features-of-a-convolutional-neural-network.html).
I've tried using the function deepDreamImage() but it only works for SeriesNetwork types, which I cannot use because my network has filters in parallel. Is there an equivalent function or workaround I can use for a DAGnetwork?
act1 = activations(net,im,'conv1','OutputAs','channels')
works on my network but produces greyscale outputs and I'm looking for color images.
I tried:
layer=5;
channels=1:8;
I = deepDreamImage(net,layer,channels,'PyramidLevels',1);
MatLab Error: Error using deepDreamImage Expected input number 1, network, to be one of these types: SeriesNetwork Instead its type was DAGNetwork.
Thanks!

采纳的回答

Elif BAYKAL
Elif BAYKAL 2018-11-21
layer = 2;
name = net.Layers(layer).Name
net = SeriesNetwork(net.Layers);
channels = 1:56;
I = deepDreamImage(net,layer,channels,'PyramidLevels',1);
  1 个评论
Stuart Whipp
Stuart Whipp 2018-12-10
Does the above answer yorur question? I've developed a function for activations of recurrent networks such as LSTM. This could possibly be amended to work for DAGs, though in my experience the DAG layers are listed at the end, after output layers (in terms of layer index).
You'd want to ensure you were removing only the layers after the one you're interested in (in terms of layer architecture sequence not index) and I'm guessing the layer selected would have to follow an addition/depth concat layer otherwise there'd be two parallel/disparate outputs? In essence, this method applies a regression layer at the end of a sliced network and so will only output from one layer as though it was the penultimate layer of a net. Hope that makes sense!

请先登录,再进行评论。

更多回答(1 个)

Philip Brown
Philip Brown 2023-5-4
If you're looking for using the deepDreamImage function for DAGNetwork networks, that's supported from R2019b.

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by