Convert a LayerGraph into a DAGNetwork - Validate and Initialize the Net

조회 수: 34 (최근 30일)
Royi Avital
Royi Avital 2021년 12월 2일
댓글: Royi Avital 2021년 12월 3일
In theory, the function assembleNetwork() should convert a LayerGraph into a DAGNetwork.
Yet in practice, it doesn't always work:
numRows = 64;
numCols = 64;
numChannels = 3;
numClasses = 3;
assembleNetwork(unetLayers([numRows, numCols, numChannels], numClasses));
Warning: Network issues detected.

Caused by:
Layer 'Segmentation-Layer': Empty Classes property. Classes will be set to categorical(1:N), where N is the number of classes.
Error using assembleNetwork (line 47)
Invalid network.

Caused by:
Layer 'Bridge-Conv-1': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Bridge-Conv-1': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Bridge-Conv-2': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Bridge-Conv-2': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Decoder-Stage-1-Conv-1': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Decoder-Stage-1-Conv-1': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Decoder-Stage-1-Conv-2': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Decoder-Stage-1-Conv-2': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Decoder-Stage-1-UpConv': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Decoder-Stage-1-UpConv': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Decoder-Stage-2-Conv-1': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Decoder-Stage-2-Conv-1': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Decoder-Stage-2-Conv-2': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Decoder-Stage-2-Conv-2': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Decoder-Stage-2-UpConv': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Decoder-Stage-2-UpConv': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Decoder-Stage-3-Conv-1': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Decoder-Stage-3-Conv-1': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Decoder-Stage-3-Conv-2': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Decoder-Stage-3-Conv-2': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Decoder-Stage-3-UpConv': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Decoder-Stage-3-UpConv': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Decoder-Stage-4-Conv-1': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Decoder-Stage-4-Conv-1': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Decoder-Stage-4-Conv-2': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Decoder-Stage-4-Conv-2': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Decoder-Stage-4-UpConv': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Decoder-Stage-4-UpConv': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Encoder-Stage-1-Conv-1': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Encoder-Stage-1-Conv-1': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Encoder-Stage-1-Conv-2': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Encoder-Stage-1-Conv-2': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Encoder-Stage-2-Conv-1': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Encoder-Stage-2-Conv-1': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Encoder-Stage-2-Conv-2': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Encoder-Stage-2-Conv-2': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Encoder-Stage-3-Conv-1': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Encoder-Stage-3-Conv-1': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Encoder-Stage-3-Conv-2': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Encoder-Stage-3-Conv-2': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Encoder-Stage-4-Conv-1': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Encoder-Stage-4-Conv-1': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Encoder-Stage-4-Conv-2': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Encoder-Stage-4-Conv-2': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'Final-ConvolutionLayer': Empty Weights property. Specify a nonempty value for the Weights property.
Layer 'Final-ConvolutionLayer': Empty Bias property. Specify a nonempty value for the Bias property.
Layer 'ImageInputLayer': Empty Mean property. For an image input layer with 'zerocenter' normalization, specify a nonempty value for the Mean property.
My question is, how can I convert myNet = unetLayers([numRows, numCols, numChannels], numClasses) into an initialized and validated network so I can use it for prediction (It will be garbage in garbage out as the net is randomly initialized, but I'm after the action of the conversion)?

답변 (1개)

yanqi liu
yanqi liu 2021년 12월 3일
yes,sir,may be use assembleNetwork for pretrained layers,if make an init empty unet,may be just use
clc; clear all; close all;
numRows = 64;
numCols = 64;
numChannels = 3;
numClasses = 3;
lgraph = unetLayers([numRows, numCols, numChannels], numClasses)
lgraph =
LayerGraph with properties: Layers: [58×1 nnet.cnn.layer.Layer] Connections: [61×2 table] InputNames: {'ImageInputLayer'} OutputNames: {'Segmentation-Layer'}
% assembleNetwork(lgraph)
plot(lgraph)
  댓글 수: 1
Royi Avital
Royi Avital 2021년 12월 3일
I am after being able to predict with the net without training, not plotting its architecture.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by