Transfer learning for 2D image using Alexnet

7 ビュー (過去 30 日間)
R G
R G 2020 年 8 月 18 日
コメント済み: junyong hong 2022 年 1 月 26 日
but my data in this case is 2D data, so the network responded some error.
Error using trainNetwork (line 154)
The training images are of size 227x227x1 but the input layer expects images of size 227x227x3.
I have tried to convert the image to 3D image in the file @readFunctionTrain but it does not work (see attached image).
I am not sure about the function @readFunctionTrain but it seems not allow me to do any change.
Have someone ever face this problem?
  2 件のコメント
Mohammad Sami
Mohammad Sami 2020 年 8 月 19 日
Are your images in grayscale ?
R G
R G 2020 年 8 月 19 日
yes, they are grayscale

サインインしてコメントする。

採用された回答

Mohammad Sami
Mohammad Sami 2020 年 8 月 22 日
編集済み: Mohammad Sami 2020 年 8 月 22 日
Another option would be for you to use the augmented image data store function. It includes both resizing and grey to RGB functionality.
if true
auimds = augmentedImageDatastore([224,224],imds,'ColorPreprocessing','gray2rgb');
end
  2 件のコメント
R G
R G 2020 年 9 月 13 日
thank you, it works now!
junyong hong
junyong hong 2022 年 1 月 26 日
sweet af

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 8 月 19 日
Or you can use an Augmented Image Datastore, as that has an option to automatically adjust the color.
  2 件のコメント
R G
R G 2020 年 8 月 19 日
Im trying your first suggest but get error here, not sure how this code work and what is @(x)
Mohammad Sami
Mohammad Sami 2020 年 8 月 22 日
The transform function was introduced in R2019a. If you are unable to upgrade, the alternative would be to set a custom ReadFcn function for your imageDatastore

サインインしてコメントする。

カテゴリ

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