How to know the data set after augment?
Show older comments
Hello everyone,
I was developed the coding for augmented my data for trainning process using 3D U-Net network. But I dont know how to find the addition data after augment? Because I checked in workspace but not found. Below is my coding, the function @augment3dPatch is for augment data
Also I attached the function for running my coding.
The data for image training (ImagesTr), groundtruthlabeling training (LabelsTr), image validation (imagesVal ), groundtruth validation (labelsVal) can download thru this link https://drive.google.com/drive/folders/176Ffn3d-61HFYiK7ywFFD9rRuzmXnN26?usp=share_link
I try this command to view in workspace how much my augemnted data (as in this article (as attached) in page 7), but not see.
imgOut = read(dsTrain);
whos
clc
clear all
close all
%testDataimages
DATASetDir = fullfile('C:\Users\Akmal\Desktop\NEW 3D U NET');
IMAGEDir = fullfile(DATASetDir,'ImagesTr');
volReader = @(x) matRead(x);
volds = imageDatastore(IMAGEDir, ...
'FileExtensions','.mat','ReadFcn', volReader);
% labelReader = @(x) matread(x);
matFileDir = fullfile('C:\Users\Akmal\Desktop\NEW 3D U NET\LabelsTr');
classNames = ["background", "tumor"];
pixelLabelID = [0 1];
% pxds = (LabelDirr,classNames,pixelLabelID, ...
% 'FileExtensions','.mat','ReadFcn',labelReader);
pxds = pixelLabelDatastore(matFileDir,classNames,pixelLabelID, ...
'FileExtensions','.mat','ReadFcn',@matRead);
volume = preview(volds);
label = preview(pxds);
up1 = uipanel;
h = labelvolshow(label, volume, 'Parent', up1);
h.CameraPosition = [4 2 -3.5];
h.LabelVisibility(1) = 0;
h.VolumeThreshold = 0.5;
volumeViewer(volume, label)
patchSize = [128 128 64];
patchPerImage = 16;
miniBatchSize = 8;
patchds = randomPatchExtractionDatastore(volds,pxds,patchSize, ...
'PatchesPerImage',patchPerImage);
patchds.MiniBatchSize = miniBatchSize;
%% AUGMENT DATA FOR TRAINING
dsTrain = transform(patchds,@augment3dPatch);
imgOut = read(dsTrain);
whos
volLocVal = fullfile('C:\Users\Akmal\Desktop\NEW 3D U NET\imagesVal');
voldsVal = imageDatastore(volLocVal, ...
'FileExtensions','.mat','ReadFcn',volReader);
lblLocVal = fullfile('C:\Users\Akmal\Desktop\NEW 3D U NET\labelsVal');
pxdsVal = pixelLabelDatastore(lblLocVal,classNames,pixelLabelID, ...
'FileExtensions','.mat','ReadFcn',volReader);
dsVal = randomPatchExtractionDatastore(voldsVal,pxdsVal,patchSize, ...
'PatchesPerImage',patchPerImage);
dsVal.MiniBatchSize = miniBatchSize;
%% AUGMENT DATA FOR VALIDATION
dsVal = transform(patchds,@augment3dPatch);
inputSize = [128 128 64];
numClasses = 2;
encoderDepth = 2;
lgraph = unet3dLayers(inputSize,numClasses,'EncoderDepth',encoderDepth,'NumFirstEncoderFilters',16)
figure,plot(lgraph);

1 Comment
Walter Roberson
on 26 Feb 2023
How does this differ from https://www.mathworks.com/matlabcentral/answers/1918595-how-to-know-the-data-set-after-augment?s_tid=srchtitle ?
Answers (0)
Categories
Find more on Semantic Segmentation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!