- imageDatastore: https://www.mathworks.com/help/matlab/ref/imagedatastore.html
- List of Supported Layers: https://www.mathworks.com/help/deeplearning/ug/list-of-deep-learning-layers.html
- trainnet: https://www.mathworks.com/help/deeplearning/ref/trainnet.html
Breast Density in Mammography
8 views (last 30 days)
Show older comments
Hi to all,
Does anyone knows of any app/code to classify mammograms in density terms? Or even an app that computes a density value.
I do not want to retrieve a segmentation, only a classification or a single final value.
Thank you!
0 Comments
Answers (1)
Aastha
on 18 Jun 2025
I understand your objective is to regress a density value from a mammogram image. You may consider the following steps to accomplish this using a Convolutional Neural Network (CNN) in MATLAB:
1. Begin by preparing your dataset, where the input data consists of mammogram images and the corresponding target values are the associated density values. Store the image files in a folder and create a datastore or table that links each image to its label.
imageFolder = 'path_to_images';
imds = imageDatastore(imageFolder, 'FileExtensions', '.png', 'LabelSource', 'foldernames');
% Assuming labels are stored in a separate table or array
load('densityLabels.mat'); % Contains variable `densityValues`
tbl = table(imds.Files, densityValues, 'VariableNames', {'Image', 'Density'});
2. Next, define the CNN architecture using a layers array. The network should be structured for a regression task. You may use the following MATLAB code snippet for reference:
layers = [
imageInputLayer([M N 1])
convolution2dLayer(3,8,Padding="same")
batchNormalizationLayer
reluLayer
fullyConnectedLayer(numResponses)
];
3. Configure the training process by specifying training options with the "trainingOptions" function. Then, train the CNN model using the "trainnet" function. Choose an appropriate loss function for your regression task as per your requirements.
For more information on the functions mentioned above, you may refer to the following documentation pages:
I hope this helps!
0 Comments
See Also
Categories
Find more on Biotech and Pharmaceutical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!