Transfer learning for 2D image using Alexnet

조회 수: 3 (최근 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 CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by