カスタムミニバッチデ​​ータストアで学習さ​せ​たネットワークを​任意​のサイズの画像​に適用​させる方法

3 views (last 30 days)
Fork
Fork on 30 Oct 2018
Commented: Fork on 4 Nov 2018
今までは、denoiseImage関数を用いて、学習させていましたが、 ミニバッチデータストア を参考にミニバッチデータストアを用いて、学習させ、ネットワークを作成しましたが、denoiseImageのように任意のサイズの画像に適用できず、学習時の入力画像サイズでしか、ネットワークを適用できません。 ミニバッチデータストアのプログラムを変更する必要があるのでしょうか、それとも別の方法があるのでしょうか。

Answers (2)

Tohru Kikawada
Tohru Kikawada on 1 Nov 2018
任意の画像サイズに適用するためには、ミニバッチデータストア内で画像を分割し、画像パッチをまとめてバッチとして渡すような実装が必要です。
denoisingImageDatastore の実装はご覧になりましたでしょうか。下記の397行目に画像パッチを切り出している処理があります。
>> edit denoisingImageDatastore
少し複雑ですが、上記を参考に実装をお試しください。
  1 Comment
Fork
Fork on 4 Nov 2018
お忙しいところ、ご回答いただきありがとうございました。
for i = 1:ds.MiniBatchSize ds.CurrentFullImage = im2double(ds.InputImageDatastore.readimage(ds.CurrentImageIndex)); rowLocations = randi(max(size(ds.CurrentFullImage,1)-50,1), i, 1); colLocations = randi(max(size(ds.CurrentFullImage,2)-50,1), i, 1); patches{i} = ds.CurrentFullImage(rowLocations(i):rowLocations(i)+49,... colLocations(i):colLocations(i)+49, :);
このように直してみましたが、50*50のままでした。 denoisingImageDatastore のように、画像パッチをまとめてバッチとして渡すためには、どのようなコードの追加が必要でしょうか
また、denoisingImageSourceでも、偽色を取り除くことは可能なのでしょうか

Sign in to comment.


Fork
Fork on 2 Nov 2018
お忙しいところ、ご回答いただきありがとうございました。
for i = 1:ds.MiniBatchSize
ds.CurrentFullImage = im2double(ds.InputImageDatastore.readimage(ds.CurrentImageIndex));
rowLocations = randi(max(size(ds.CurrentFullImage,1)-50,1), i, 1);
colLocations = randi(max(size(ds.CurrentFullImage,2)-50,1), i, 1);
patches{i} = ds.CurrentFullImage(rowLocations(i):rowLocations(i)+49,...
colLocations(i):colLocations(i)+49, :);
このように直してみましたが、50*50のままでした。
denoisingImageDatastore のように、画像パッチをまとめてバッチとして渡すためには、どのようなコードの追加が必要でしょうか
また、denoisingImageSourceでも、偽色を取り除くことは可能なのでしょうか

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!