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

5 views (last 30 days)
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);

Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!