Message Boards Message Boards

0
|
5520 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Unet network using the neural network tools

Posted 5 years ago

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 ?

POSTED BY: Guy Malki
4 Replies
NetTrain[
 unet,
 <|
  "Input" -> images,
  "Output" -> masks
  |>,
 LossFunction -> {"Output" -> CrossEntropyLossLayer["Binary"]}
 ]
POSTED BY: Alexey Golyshev
Posted 5 years ago

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

POSTED BY: Guy Malki
Posted 5 years 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 BY: Guy Malki
Posted 5 years ago

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

POSTED BY: Rohit Namjoshi
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