cnn for feature extraction
16 ビュー (過去 30 日間)
古いコメントを表示
i am doing project on image classification.i have converted image in R,G and B channels.now i need to extract features from each channel using cnn.how can i use cnn for feature extraction in image.
0 件のコメント
回答 (3 件)
Sourav Bairagya
2019 年 12 月 16 日
As you have your RGB images ready, then you can define your custom convolutional neural network using 'dlNetwork' object and train it to extract features out of it.
For training you can leverage this link:
For extracting feature from the trained network, use 'predict' function. To know more about this leverage this link:
0 件のコメント
esther MUKOYA
2021 年 1 月 25 日
Kindly could you share on the method used to convert the images to RGB?
0 件のコメント
Shahram Taheri
2022 年 7 月 19 日
Hi,
imds = imageDatastore('Your Dataset PATH', ...
'IncludeSubfolders',true,'LabelSource','foldernames');
imds = shuffle(imds);
[imdsTrain,imdsValidation] = splitEachLabel(imds,0.7);
net = resnet18;
%net=densenet201;
inputSize = net.Layers(1).InputSize;
%analyzeNetwork(net)
augimdsTrain = augmentedImageDatastore(inputSize(1:2),imdsTrain,'ColorPreprocessing','gray2rgb');
augimdsTest = augmentedImageDatastore(inputSize(1:2),imdsValidation,'ColorPreprocessing','gray2rgb');
layer = 'pool5';
featuresTrain = activations(net,augimdsTrain,layer,'OutputAs','rows');
featuresTest = activations(net,augimdsTest,layer,'OutputAs','rows');
YTrain = imdsTrain.Labels;
YTest = imdsValidation.Labels;
classifier = fitcecoc(featuresTrain,YTrain);
YPred = predict(classifier,featuresTest);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Image Data Workflows についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!