Initialize a Neural Network from layers but do NOT train
이전 댓글 표시
I want to initialize a neural network from a set of layers, but I do not want to train it. Basically I just want to create it as a forward model, set the weights and biases randomly, and be able to evaluate it at given data point. The tutorials and documentation are not very clear on how to do this. For example from https://www.mathworks.com/help/nnet/examples/create-simple-deep-learning-network-for-classification.html they have
layers = [imageInputLayer([28 28 1])
convolution2dLayer(5,20)
reluLayer
maxPooling2dLayer(2,'Stride',2)
fullyConnectedLayer(10)
softmaxLayer
classificationLayer()];
But then they define the network through a training function:
convnet = trainNetwork(trainDigitData,layers,options);
I don't want this. I just want something along the lines of
convnet = network(layers);
Then I want to be able manually access all weights and biases, set them as I wish and be able to evaluate the network at a single or multiple input images. Is this possible? Thank you.
채택된 답변
추가 답변 (1개)
Vla Ser
2020년 10월 13일
0 개 추천
https://www.mathworks.com/help/deeplearning/ref/assemblenetwork.html - you can use assemble network to create it from list of layers.
댓글 수: 1
Royi Avital
2021년 12월 2일
For DAGNetwork I get an error that weights are not initialized. Have you solved this?
카테고리
도움말 센터 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!