How to use feature input layer in transfer learning to concatenate the features with the output of fully-connected layer using MATLAB

3 次查看(过去 30 天)
Following the above MATHWORKS example. While performing transfer learning from vgg16, I want to add a concatenation layer with two inputs. One input will be from the last pre-trained layer of the vgg16, which is input 1 (in1) that is true. But, at input 2 (in2) I want to add the hand-crafted features (in mat file), but I cannot make it properly. Please guide me on this. I'm using featureInputLayer to get features and want to use them to concatenate with in1.
close all; clear all; clc;
% Load Pre-trained CNN Model
net = vgg16;
% Replacing the last 3 layers
TransNet = [
net.Layers(1:end-3)
% featureInputLayer(280,'Name','in2')
concatenationLayer(1,2,'Name','concat')
fullyConnectedLayer(4096, 'Name','fc8')
softmaxLayer('Name','sm')
classificationLayer('Name','classification')];
analyzeNetwork(TransNet);

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by