Help Understanding groundTruth for CNN segmentation.
3 ビュー (過去 30 日間)
古いコメントを表示
I am attempting binary xray segementation using convolutional neural networks in matlab. I have a folder of the preoprocessed images, and a folder of binary segementations which match those images.
The segmentaions are binary so they have two class outputs denoted by a 0 and 1 respectively, "Background", "Cervical_Masks".
My problem stems from using the groundTruth function in matlab.
imds=imageDatastore('Stringtofiles', 'FileExtensions', '.tif', 'IncludeSubfolders', 0, 'LabelSource', 'foldernames');
imds_Masks=imageDatastore('/Stringtofiles', 'FileExtensions', '.tif', 'IncludeSubfolders', 0, 'LabelSource', 'foldernames');
groundT=groundTruthDataSource(imds);
ldc = labelDefinitionCreator();
addLabel(ldc,'Cervical_Masks',labelType.PixelLabel);
addLabel(ldc,'Background',labelType.PixelLabel, PixeWhenlLabelID.0);
labelDefs = create(ldc);
labelData=table(imds_Masks.Files, 'VariableNames', {'PixelLabelData'});
gTruth = groundTruth(groundT,labelDefs,labelData);
[imds,pxds] = pixelLabelTrainingData(gTruth);
After this point my data is wrong.
Simply checking it for any subject reveals that the pxds file which should represent the mask is incorrect.
subject=22
I = readimage(imds,subject);
C = readimage(pxds,subject);
imshowpair(I,uint8(C),'montage')
I think this is because I am not using the labeling correct.
Could someone please help?
Thanks!
0 件のコメント
回答 (2 件)
Anshika Chaurasia
2021 年 9 月 17 日
編集済み: Anshika Chaurasia
2021 年 9 月 17 日
Hi,
On looking the provided code, the possible reason for incorrect label could be in following line:
addLabel(ldc,'Background',labelType.PixelLabel, PixeWhenlLabelID.0);
I am not sure about "PixeWhenlLabelID.0".
It would be better if you can share the images or some test code. It would be easy for us to reproduce your issue at our end.
Refer to the following blog:
0 件のコメント
yanqi liu
2021 年 9 月 28 日
sir,please check the follow code to get some information
clc; clear all; close all;
% image file
data = load('stopSignsAndCars.mat');
imageFilenames = data.stopSignsAndCars.imageFilename(1:2)
imageFilenames = fullfile(toolboxdir('vision'),'visiondata',imageFilenames);
dataSource = groundTruthDataSource(imageFilenames);
% label
ldc = labelDefinitionCreator();
addLabel(ldc,'stopSign',labelType.Rectangle);
addLabel(ldc,'carRear',labelType.Rectangle);
labelDefs = create(ldc)
% add target
stopSignTruth = {[856 318 39 41];[445 523 52 54]};
carRearTruth = {[398 378 315 210];[332 633 691 287]};
% make label
labelNames = {'stopSign';'carRear'};
labelData = table(stopSignTruth,carRearTruth,'VariableNames',labelNames)
% display
gTruth = groundTruth(dataSource,labelDefs,labelData)
figure; imshow(gTruth.DataSource.Source{1});
hold on;
rectangle('Position', gTruth.LabelData.stopSign{1}, 'EdgeColor', 'g', 'LineWidth', 2);
rectangle('Position', gTruth.LabelData.carRear{1}, 'EdgeColor', 'c', 'LineWidth', 2);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Image and Video Ground Truth Labeling についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!