Error in image size U-Net

4 ビュー (過去 30 日間)
Atallah Baydoun
Atallah Baydoun 2019 年 9 月 13 日
コメント済み: Atallah Baydoun 2019 年 9 月 19 日
I am trying to train a Unet for semantic segmentation.
My images sizes are X*Y*Z*5.
The X,Y, and Z are different between different images but the training is done using patches.
When the patch size is set to [64 64 32 5], the training runs successfully.
If I choose a patch size of higher X and Y dimensions such as [256 448 8 5], I got the error below:
Error using trainNetwork (line 165)
Unexpected image size: All images must have the same size.
Any thoughts ?

回答 (1 件)

Sourav Bairagya
Sourav Bairagya 2019 年 9 月 18 日
In U-Net, generally the patch sizes are determined in accordance with the subsequent max-pool layers, so that the down-sampling by factor of 2 at each max-pool layer goes smoothly and training goes well. Hence, to make the training smoother, it is important to determine a proper patch size and use the same for all input training samples irrespective of their original dimensions.
From the problem you are facing, it seems that your U-net architecture is defined to take the input patches of size (64X64X32). Hence, when you are trying feed patches of different size than this, it is throwing error.
If the network architecture is a pre-defined one, then you should use the defined input patch size for training.
If the network is defined by you, then you should change the input dimension in ‘imageInputLayer’ of ‘layers’ object to your desired one and then feed to ‘trainNetwork’ function.
Hope this will help you.
  1 件のコメント
Atallah Baydoun
Atallah Baydoun 2019 年 9 月 19 日
Thanks Sourav for your help.
I did some debugging, and it seems that with the current coding in Matlab, data augmentation using X and Y flipping to augment data.
Let us suppose that you have an image 320 * 460 * 40.
You set a patch sizw of 260 * 360 * 4.
During the random patch extraction process with data augmentation, Matlab will try to catch a patch of 360*260*4and 360>320 so we get the error.

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

カテゴリ

Help Center および File ExchangeImage Filtering and Enhancement についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by