Add variable as input parameter in deep learning model

6 ビュー (過去 30 日間)
Md Abdur Rahman
Md Abdur Rahman 2021 年 4 月 10 日
コメント済み: Md Abdur Rahman 2021 年 4 月 18 日
I am working on CNN model which increases pixel value of input image by x times. Here, the value of x is different for each pixel, which can be managed by CNN. I also want the value of x to be decided differently based on another variable. However, CNN model only takes image as input.
How can I add another additional variable with image as input for CNN model?

採用された回答

Srivardhan Gadila
Srivardhan Gadila 2021 年 4 月 14 日
You can refer to Multiple-Input and Multiple-Output Networks to create a network with multiple inputs.
The following is an example:
%% Define muliple input network.
layers1 = [
imageInputLayer([28 28 3],'Name','input')
convolution2dLayer(3,3,'Padding','same','Name','conv_1')
multiplicationLayer(2,'Name','mul')
regressionLayer('Name','regression')];
lgraph = layerGraph(layers1);
layers2 = [imageInputLayer([28 28 3],'Name','x')];
lgraph = addLayers(lgraph,layers2);
% Connect layers.
lgraph = connectLayers(lgraph,'x','mul/in2');
% Analyze network.
analyzeNetwork(lgraph)
You can refer to List of Deep Learning Layers for the available layers and Deep Learning Custom Layers to create a custom layer for your problem.
  4 件のコメント
Md Abdur Rahman
Md Abdur Rahman 2021 年 4 月 15 日
Thanks a lot
Md Abdur Rahman
Md Abdur Rahman 2021 年 4 月 18 日
I have few more questions, as I am having difficulty to prepare deep learning model.
The CNN model that I am work on has 2 parts i.e. encoder(convolution layers and downsampling) and decoder (convolution layers and up sampling) for image enhancement purpose. Encoder part can be considered for image characteristics analysis, and decoder part is for genererating output image.
Now, I am planning to add a scaler value as additional input by 'featureInputLayer'. Is it ok to add after encoder or adding the begining to give image and scalar value as inputs at the same time is better choice?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDeep Learning for Image Processing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by