Message Boards Message Boards

GROUPS:

Unet network using the neural network tools

Posted 3 months ago
620 Views
|
4 Replies
|
0 Total Likes
|

Hi I created the following unet network using the neural network tools:

UNET := NetGraph[
  <|
   "enc_1" -> conv[64],
   "enc_2" -> {pool, conv[128]},
   "enc_3" -> {pool, conv[256]},
   "enc_4" -> {pool, conv[512]},
   "enc_5" -> {pool, conv[10]},
   "dec_1" -> dec[512],
   "dec_2" -> dec[256],
   "dec_3" -> dec[128],
   "dec_4" -> dec[64],
   "map" -> {ConvolutionLayer[1, {1, 1}], LogisticSigmoid}
   |>,
  {
   NetPort["Input"] -> 
    "enc_1" -> "enc_2" -> "enc_3" -> "enc_4" -> "enc_5",
   {"enc_4", "enc_5"} -> "dec_1",
   {"enc_3", "dec_1"} -> "dec_2",
   {"enc_2", "dec_2"} -> "dec_3",
   {"enc_1", "dec_3"} -> "dec_4",
   "dec_4" -> "map" -> NetPort["Output"]},
  "Input" -> 
   NetEncoder[{"Image", {512, 1}, ColorSpace -> "Grayscale"}], 
  "Output\[Rule] NetDecoder[{" Image "," Grayscale "}]
   ]

How can I get the output of the "enc5" layer ?

4 Replies
Posted 3 months ago

This can be done by connecting an output port to that layer. Example.

Posted 3 months ago

Thank you. In accordance to the first example in your link, I added in the NetGraph

"enc_5" -> NetPort["layer5"]

Then, I tried to run it with the same command in the example:

nNetInfo =  NetTrain[net, trainingData,  "Output" -> CrossEntropyLossLayer["Index"]]

But I got error massages:

OptionValue::nodef "Unknown option \!\(\"Output\"\) for NetTrain"
NetTrain::missinslot "Specification for slot \!\(\"layer5\"\) is missing."

and in the NetTrain function command "Output" and "index" are colored by red.

What am I doing wrong ?

Thanks

Posted 3 months ago

Any ideas please ? 1. How can I get the Output of layer “enc5” ?

Posted 3 months ago
NetTrain[
 unet,
 <|
  "Input" -> images,
  "Output" -> masks
  |>,
 LossFunction -> {"Output" -> CrossEntropyLossLayer["Binary"]}
 ]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract