What criteria should be used to select the number of images used in image processing for detection based on image segemntation?

4 visualizaciones (últimos 30 días)
how can I know the number required for model to detect crack based on image segmentation. The model not use any training and the gound truth for each image is created and jaccrad index is measure for each image. TP, FP, FN, TN are determined for each image, So how many image is enough for my study?

Respuestas (1)

Image Analyst
Image Analyst el 23 de Nov. de 2023
Here is what MATLAB Playground says:
"The number of images required to validate a traditional image analysis algorithm depends on various factors such as the complexity of the algorithm, the variability of the images, and the desired level of accuracy. However, a common practice is to use a dataset of at least 30 images to evaluate the algorithm's performance.
Some common metrics used to evaluate the performance of image analysis algorithms include accuracy, precision, recall, F1 score, and receiver operating characteristic (ROC) curve analysis. These metrics can be used to compare the algorithm's output to the ground truth or manual annotations.
To calculate metrics for image analysis algorithms in MATLAB, you can compare the algorithm's output to the ground truth or manual annotations using functions such as `confusionmat`, `accuracy`, `precision`, `recall`, and `f1score` from the Statistics and Machine Learning Toolbox. These functions can be used to calculate the confusion matrix and various performance metrics based on the true positive, false positive, true negative, and false negative rates.
Here's an example of how to use `confusionmat` and `accuracy` functions to calculate the accuracy of an image classification algorithm:
```matlab
% Load the ground truth labels and predicted labels
load image_labels.mat
% Calculate the confusion matrix
C = confusionmat(groundTruthLabels, predictedLabels);
% Calculate the accuracy
acc = accuracy(groundTruthLabels, predictedLabels);
```
To visualize the confusion matrix for an image analysis algorithm in MATLAB, you can use the `confusionchart` function from the Statistics and Machine Learning Toolbox. This function creates a confusion matrix chart that displays the true positive, false positive, true negative, and false negative rates.
Here's an example of how to use `confusionchart` to visualize the confusion matrix for an image classification algorithm:
```matlab
% Load the ground truth labels and predicted labels
load image_labels.mat
% Calculate the confusion matrix
C = confusionmat(groundTruthLabels, predictedLabels);
% Visualize the confusion matrix
confusionchart(C);
```
This will create a confusion matrix chart that displays the true positive, false positive, true negative, and false negative rates.
To calculate and visualize precision-recall curves for an image analysis algorithm in MATLAB, you can use the `perfcurve` function from the Statistics and Machine Learning Toolbox. This function calculates the precision and recall values for different classification thresholds and returns the precision-recall curve.
Here's an example of how to use `perfcurve` to calculate and visualize the precision-recall curve for an image classification algorithm:
```matlab
% Load the ground truth labels and predicted scores
load image_scores.mat
% Calculate the precision and recall values
[precision, recall, thresholds] = perfcurve(groundTruthLabels, predictedScores, 'positive', 1);
% Visualize the precision-recall curve
plot(recall, precision);
xlabel('Recall');
ylabel('Precision');
title('Precision-Recall Curve');
```
This will create a precision-recall curve that displays the precision and recall values for different classification thresholds.
Yes, I can provide an example of how to use MATLAB to visualize an ROC curve for an image analysis algorithm. Here's an example code snippet that demonstrates how to use the `perfcurve` function to calculate the true positive rate (TPR) and false positive rate (FPR) for different classification thresholds and plot the ROC curve:
```matlab
% Load the ground truth labels and predicted scores
load image_scores.mat
% Calculate the true positive rate and false positive rate
[TPR, FPR, thresholds] = perfcurve(groundTruthLabels, predictedScores, 'positive', 1);
% Plot the ROC curve
plot(FPR, TPR);
xlabel('False Positive Rate');
ylabel('True Positive Rate');
title('ROC Curve');
```
This will create an ROC curve that displays the true positive rate (TPR) on the y-axis and the false positive rate (FPR) on the x-axis.
  2 comentarios
yasmin ismail
yasmin ismail el 23 de Nov. de 2023
@Image Analyst thanks for your help
I used 300 images but the supervisor think its not adequate and think small amount of data may lead to inaccurate results although my model based on image processing not machine learning. Thus, is there any sources or refrences I can refer that image number not be less than 30 images?
Image Analyst
Image Analyst el 23 de Nov. de 2023
It all depends on what you need. If your results are not good enough, then use more. Often I start with one image to develop an algorithm, if it's a typical or representative image. Then I try it on 5 or 10 more images that my client gave me. I ask them to give me more typical images as well as some "extreme" images that look a lot different. Often the algorithm won't work on those weird images so I need to tweak it to work on those while still working on the original "good" image. Then I deploy it to them and let them run it on whatever images they acquire. Sometimes they will notice an image that it did not work on and we need to decide, in the algorithm, how to handle that bizarre image. Either fix the algorithm to handle it, or just throw it out and mark it as a bad image (for example the image is all black, or the camera wasn't pointed at the subject it was supposed to be pointing at, or whatever).

Iniciar sesión para comentar.

Categorías

Más información sobre Image Processing and Computer Vision en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by