Medical Image Segmentation Using SegNet

4 ビュー (過去 30 日間)
soheib hadj moussa
soheib hadj moussa 2020 年 4 月 14 日
回答済み: Ryan Comeau 2020 年 5 月 9 日
Hi,
I labeled gray scale images using Pixel Label in Image Labeler app (MATLAB 2019b). I am using semantic segmentation (https://www.mathworks.com/matlabcentral/fileexchange/66448-medical-image-segmentation-using-segnet) to classify different objects in the images. When I ran this part of the code (I changed the third element in the imageSize to 1 because I am using the gray scale images):
i find this error
Error using segnetLayers>iCheckImageSizeHasThreeElementsForVGG (line 454)
imageSize must have three elements and the third element must be 3 when creating SegNet based off of VGG-16 or
VGG-19.
Error in segnetLayers (line 170)
iCheckImageSizeHasThreeElementsForVGG(args.imageSize);
Error in medImgSegExample3 (line 75)
lgraph = segnetLayers(imageSize,numClasses,'vgg16');

回答 (1 件)

Ryan Comeau
Ryan Comeau 2020 年 5 月 9 日
Hello, I have encountered this problem as well. It's sort of hilarious because it's a simple problem and I banged my head against the table as well for like 10 hours. When you are doing transfer learning(the technique of using pre trained weights) your images need to be the same size as the ones which the network was trained on, which includes the color channels. This leaves you with two solutions:
  1. train your own detector, just take their architecture
  2. Turn your images from greyscale into rgb by using the following bit of code(i used this for SSD object detection, but based on your error it seems to be the same issue). The rgb2gray is here:https://www.mathworks.com/matlabcentral/answers/377407-how-to-convert-grayscale-to-rgb
map = hsv(256); % Or whatever colormap you want.
rgbImage = ind2rgb(im, map); % im is a grayscale or indexed image.
You will need to play around with the value in hsv and tune it to your needs.
Hope this helps
RC

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by