how to convert 227x227 image into 227x227x3

6 ビュー (過去 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 件のコメント
Walter Roberson
Walter Roberson 2021 年 12 月 3 日
Your title asks about 224 x 224 to 224 x 224 x 3, but your text asks for 227 x 227 to 227 x 227 x 227 ?
The methods we would use would be different for the two.
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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 12 月 3 日

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by