# How to determine which Layers should be used in my NetChain?

I have a answer in this post which is based on neural network,but I have to say that reault is too bad and have no practicability.I think the reason is that selection of network layers.So I give some try after that

image = ImageResize[Import["https://i.stack.imgur.com/zP5xF.jpg"],
Scaled[2/3]] You can get it by

(Uncompress@*FromCharacterCode@*Flatten@*(ImageData[#1, "Byte"] &)@*
Import)["http://ooo.0o0.ooo/2016/12/19/58576a2262e4a.png"]


## Based on 20, Tanh, 2

net = NetChain[{20, Tanh, 2,
SoftmaxLayer["Output" -> NetDecoder[{"Class", {True, False}}]]},
"Input" -> 3];
ringQ = NetTrain[net, trainData, MaxTrainingRounds -> 20];
Image[Map[If[ringQ[#], #, N@{1, 1, 1}] &, ImageData[image], {2}]] ## Based on 20, Ramp, 2

net = NetChain[{20, Ramp, 2,
SoftmaxLayer["Output" -> NetDecoder[{"Class", {True, False}}]]},
"Input" -> 3];
ringQ = NetTrain[net, trainData, MaxTrainingRounds -> 20];
Image[Map[If[ringQ[#], #, N@{1, 1, 1}] &, ImageData[image], {2}]] ## Based on 20, LogisticSigmoid, 2

net = NetChain[{20, LogisticSigmoid, 2,
SoftmaxLayer["Output" -> NetDecoder[{"Class", {True, False}}]]},
"Input" -> 3];
ringQ = NetTrain[net, trainData, MaxTrainingRounds -> 20];
Image[Map[If[ringQ[#], #, N@{1, 1, 1}] &, ImageData[image], {2}]] ## Based on 20, LogisticSigmoid,Tanh, 2

net = NetChain[{20, LogisticSigmoid, Tanh, 2,
SoftmaxLayer["Output" -> NetDecoder[{"Class", {True, False}}]]},
"Input" -> 3];
ringQ = NetTrain[net, trainData, MaxTrainingRounds -> 20];
Image[Map[If[ringQ[#], #, N@{1, 1, 1}] &, ImageData[image], {2}]] But I just give some blind tests,any criterion or method can guide us to selecting those layers to improve the result?

In your example, it's just an binary classify problem per pixel value, traditional image classify criterions could help you.

In an binary classify problem, we convert an image into vector, and use an Activation Function such as LogisticSigmoid to do, so there is no need use [LogisticSigmoid, Tanh].

2 is the same to the number of of classes[here 2], SoftmaxLayer is doing calculating probobilities of each class.

20 is an linear layer is the same in doing logistic regression.

Neural Network in some simple cases is the same with traditional doing, but training the parameters by NN's way.

According to ClusterClassify's example, Image@Lab color space is better.   There are two goals, one is the ring contains the green parts in the mirror. Without doing any other image functions, I think we can add some space[pixel position] related features or pooling features[pixel neighbor color] to train an Binary Region Segmentor.