ImageDatas​toreでサイズを変​更しつつ、ラベルづけ​をする方法を教えてく​ださい

7 visualizaciones (últimos 30 días)
Inada Ren
Inada Ren el 30 de Jul. de 2020
Editada: Kenta el 31 de Jul. de 2020
Aというフォルダの中にa,bというサブフォルダがあり、様々なサイズの画像が入っています。これらの画像のサイズを100x100に変換しながら、ImageDatastoreで読み込んで、フォルダ名でラベルづけをする方法を教えてください。
imds = imageDatastore('./A','IncludeSubfolders',true,'LabelSource','foldernames');
サイズの変更がない場合はこれでラベル付けしながら読み込めるのですが、ここからサイズを変更する方法がわかりません。augmentedImageDatastoreでやろうとしましたが、
imageSize = [100 100 1];
imds = augmentedImageDatastore('./A', imageSize, 'IncludeSubfolders',true,'LabelSource','foldernames');
上のコードではうまく動きませんでした。

Respuestas (1)

Kenta
Kenta el 31 de Jul. de 2020
こちら、ネットで探すと以下のようなわかりやすい記事がありました。
こちらにもあるのですが、
imds = imageDatastore('./A','IncludeSubfolders',true,'LabelSource','foldernames');
でimdsを作成したのち、
auimds = augmentedImageDatastore([100 100 1],imds)
などで、サイズを変更できます。データ拡張(オーギュメンテーション)も、このコマンドに入れ込むことができます。
  2 comentarios
Inada Ren
Inada Ren el 31 de Jul. de 2020
回答ありがとうございます。早速上記で試してみたところ、サイズ変更はできているのですが、
tbl = countEachLabel(auimds)
上記でラベルを確認してみると「関数 'countEachLabel' の呼び出し内に、不足している引数または正しくない引数データ型がないかを確認してください。」とエラーになってしまいます。
Kenta
Kenta el 31 de Jul. de 2020
Editada: Kenta el 31 de Jul. de 2020
countEachLabel 関数はaugmentデータストアには適用できないので、augimds=>imdsとすればよいです。ラベルの情報もaugimdsに入っているのでうまく計算は進むと思います。trainNetwork関数に、augimdsや層、オプションを入れたら実行できると思います。

Iniciar sesión para comentar.

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!