Problem with building a specific CNN
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi There,
I am really struggling to build the layers of the CNN displayed in the image attached. This is what I currently have but it is not working unfortunately.
layers = [
imageInputLayer([512 512 1])
convolution2dLayer(filterSize,numFilters,'Padding',1)
reluLayer()
transposedConv2dLayer(24,24,'Stride',2);
reluLayer()
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(12,48,'Padding',1)
reluLayer()
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(8,96,'Padding',1)
reluLayer()
maxPooling2dLayer(2,'Stride',48)
fullyConnectedLayer(2)
softmaxLayer()
pixelClassificationLayer()
]
Any help would be extremely appreciated.
2 Kommentare
Javier Pinzón
am 1 Dez. 2017
Hello Elliot,
What specifically you mean with "not work", the CNN get error when executing?, No improvement in the Accuracy?, Train goes well, but when test does not recognize?,
It would be useful to be provied the specific problem that you are facing.
Regards
Antworten (2)
Javier Pinzón
am 31 Jan. 2018
Hello Elliott,
Sorry for the really late response.
As far as I can see, the error is located in the amount of classes that you are training, i.e. the number of categories or subfolders that you have in your training data. For example, in your network yo say:
fullyConnectedLayer(2)
But you have a training forlder with 3 subfolders, for example:
Training-
- Apple
- Pear
- Pineapple
so you have 3 categories but only 2 outputs in your last fully connected layer, so you need to put:
fullyConnectedLayer(3)
or only use 2 categories, ereasing or moving the no needed category.
Hope the help was not really late or helps other people.
Regards
Javier
2 Kommentare
Peter Eze
am 19 Dez. 2018
This does not apply to SegNet on VGG16. The error occurs most here but there is no fully connected layer. Any solution?
Javier Pinzón
am 8 Feb. 2019
Hello Peter, Sorry for the late response.
on SegNet, first of all, you should have all your images in the same folder, because the outputs are the number of categories segmented. So, if you only use a category called Lessions, so your number of outputs are 1. But if you SEGMENTED the background as well (what is highly recommended for me), so your amount of categories are 2. so, the number of filters at the last convolution on the decoder must match this valor.
Hope it helps.
Regards,
Javier
Rene
am 19 Apr. 2018
Are you using any kind of data preprocessing or augmentation before sending inputs to the network? I've been finding I get this error a lot when I either fiddle with data preprocessing using something like an augmentedImageSource or specifying 'randcrop' in the image input layer. It's possible that augmentation only works for classification, where you can augment the training image all you like and the label vector doesn't change. This would be problematic for segmentation networks where you'd also need to apply the same random transformation to the label as well. Perhaps this is leading to some kind of mismatch somewhere. I've also found that modifying the parameters of the convolutional layers causes this error. Some combos work and others don't. It's really unclear exactly where the problem lies with this error message. (NB all the times I've had this error message myself have been without the use of a fully connected layer in the network)
1 Kommentar
Peter Eze
am 19 Dez. 2018
Yes, this is true. I am currently having this problem with SegNet on VGG-16. There is no fully connected layer and I want to segment into lession and background. Any solution to this yet?
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!