how to convert 227x227 image into 227x227x3

8 views (last 30 days)
manoj sain
manoj sain on 3 Dec 2021
Answered: yanqi liu on 4 Dec 2021
I am working on deep learning. try to use alexnet for training . but it takes 227x227x227 and i have 227x227.

Sign in to comment.

Accepted Answer

yanqi liu
yanqi liu on 4 Dec 2021
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',...
function data = data_preporcess(file)
data = imread(file);
if ndims(data) == 2
data = cat(3, data, data, data);
data = double(data);

Community Treasure Hunt

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

Start Hunting!

Translated by