Image Classification using Percentage
古いコメントを表示
We are working on a project. The goal of the project is to calculate the ratio (in percentage) of musillage in photos. I successfully classified whether a phot has musillage or not (%0 or %100) but not any number in between. The photos are classified using image labeling. The code is attached, woul you please suggest how to improve the working code to cover the percentage of musillages. Two photos of both classes are attached.
Thanks in advance
++
clear all; clc;
imds = imageDatastore("C:\Users\fatih.yigit\OneDrive - ALTINBAS UNIVERSITY\Project 10\project10\Musillage_Photos", ...
IncludeSubfolders=true, ...
LabelSource="foldernames");
numTrainFiles = 25;
[imdsTrain,imdsValidation] = splitEachLabel(imds,numTrainFiles,"randomized");
classNames = categories(imdsTrain.Labels);
inputSize = [300 300 3];
numClasses = 2;
layers = [
imageInputLayer(inputSize)
convolution2dLayer(20,50)
batchNormalizationLayer
reluLayer
fullyConnectedLayer(numClasses)
softmaxLayer];
options = trainingOptions("sgdm", ...
MaxEpochs=50, ...
ValidationData=imdsValidation, ...
ValidationFrequency=30, ...
Plots="training-progress", ...
Metrics="accuracy", ...
Verbose=false);
net = trainnet(imdsTrain,layers,"crossentropy",options);
scores = minibatchpredict(net,imdsValidation);
YValidation = scores2label(scores,classNames);
++
5 件のコメント
Image Analyst
2025 年 2 月 16 日
編集済み: Image Analyst
2025 年 2 月 16 日
I don't understand this question about your college project at all. Here is the definition
"mu·ci·lage ˈmyü-s(ə-)lij. 1. : a gelatinous substance of various plants (as legumes or seaweeds) that contains protein and polysaccharides and is similar to plant gums. 2. : an aqueous usually viscid solution (as of a gum) used in pharmacy as an excipient and in medicine as a demulcent."
So the first problem is you posted photos of sky, beach, ocean, buildings, and ships. What is your definition of mucilage? Where is it in the photos you attached?
Problem #2 is that you seem to want to use deep learning to segment out the mucilage yet you gave us only 2 training photos, no ground truth photos, no validation photos, and no test photos. You can't do training with only 2 photos and no ground truth information. It could be possible to do traditional image analysis with only two photos but you need to give a good definition of what you want to segment.
Third problem is that you say "Two photos of both classes are attached." when no such photos are attached.
Fourth problem is that even if you had a percentage of the scene covered in mucilage, the percentage would have no meaningful use with those photos because of the scene and field of view, and especially what's in the field of view. There is no action that you could take based on the percentage. For example you can't say that if the percentage is more than 50% of the picture, I need to clean my beach (or ship or whatever) when you have buildings, mountains, and other stuff in there which would never get covered by mucilage.
Fatih
2025 年 2 月 16 日
Image Analyst
2025 年 2 月 16 日
Snapshots taken with various viewpoints cannot give accurate percentages. You would need overhead photos of the whole sea area. Even then, the percentage of blue or green that is covered by brown or white gunk depends on how much of the sea/ocean you include. If you double the amount of clear sea water in the scene (by zooming out) then you increase the area of clear water and the gunk stays the same so the percentage goes down even though the amount of gunk didn't change. And how did you determine the ground truth percentage for each photo? Just guessed? Hand traced the gunk and ocean regions? Some other way?
Fatih
2025 年 2 月 17 日
Walter Roberson
2025 年 2 月 17 日
imds = imageDatastore("C:\Users\fatih.yigit\OneDrive - ALTINBAS UNIVERSITY\Project 10\project10\Musillage_Photos", ...
IncludeSubfolders=true, ...
LabelSource="foldernames");
You are getting your labels from the foldernames, not from ground-truth labels.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Image Data Workflows についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!