how to convert 227x227 image into 227x227x3

조회 수: 8(최근 30일)
manoj sain
manoj sain 2021년 12월 3일
답변: yanqi liu 2021년 12월 4일
I am working on deep learning. try to use alexnet for training . but it takes 227x227x227 and i have 227x227.
  댓글 수: 2
manoj sain
manoj sain 2021년 12월 3일
its updated now sir

댓글을 달려면 로그인하십시오.

채택된 답변

yanqi liu
yanqi liu 2021년 12월 4일
yes,sir,may be use
% convert 227x227 image into 227x227x3
imds = imageDatastore('imagefolder','IncludeSubfolders',true,'LabelSource','foldernames');
auimds = augmentedImageDatastore(imds,'ColorPreprocessing','gray2rgb')
% or
trainingImages = imageDatastore('imagefolder',...
'IncludeSubfolders',true,...
'LabelSource','foldernames','ReadFcn',@data_preporcess);
function data = data_preporcess(file)
data = imread(file);
if ndims(data) == 2
data = cat(3, data, data, data);
end
data = double(data);
end

태그

Community Treasure Hunt

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

Start Hunting!

Translated by