Can I predict the brix and acidity values of strawberry from images ?

3 views (last 30 days)
I was wondering if we could predict the brix and acidity values from strawberry images, once we have classified the strawberry images to ripe, turning and white. If s, what method can be used? Is it regression? what kind of regression analysis? kindly help me in coding with matlab in predicting the brix and acidity values from strawberry images if it is possible.

Answers (1)

TED MOSBY
TED MOSBY on 25 Jun 2025
Edited: TED MOSBY on 25 Jun 2025
Hi,
It is definitely possible to predict Brix and acidity values after you've classified them into certain stages. This falls under the domain of regression analysis using machine learning techniques on image features.
Support Vector Regression (SVR), Artificial Neural Networks (ANN), and Random Forest Regression can be used for predicting fruit quality parameters from image features.
The general approach usually involves:
1. Data Collection (Ground Truth): For each strawberry image, you need to manually measure its actual Brix and acidity values using standard methods (e.g., refractometer for Brix, titration for acidity). This "ground truth" data is needed for training and evaluating your regression models.
2. Image Preprocessing:
  • Region of Interest (ROI) Extraction: Isolate the strawberry from the background. This can be done using segmentation techniques (e.g., color-based segmentation, thresholding, or more advanced methods like Mask R-CNN if you want to be precise).
  • Normalization: Normalize image intensities if lighting conditions varied slightly.
3. Feature Extraction: This is where you derive numerical features from the strawberry images that are correlated with Brix and acidity. Common features are:
  • Color Features: Mean, standard deviation, and histograms of pixel values in different color spaces
  • Texture Features: Statistical features (mean, variance, entropy) from grayscale images and Haralick features (contrast, correlation, energy, homogeneity) from Gray-Level Co-occurrence Matrix (GLCM)
  • Shape Features: Area, perimeter, circularity, aspect ratio.
4. Regression Model Training:
  • Feature Selection/Dimensionality Reduction: If you extract many features, techniques like Principal Component Analysis (PCA) or feature selection algorithms to reduce dimensionality and avoid overfitting.
Regression Algorithms: This is where you predict continuous values (Brix and acidity). Various regression algorithms can be used:
  • Multiple Linear Regression (MLR): A simple baseline for a linear relationship between features and Brix/acidity.
  • Support Vector Regression (SVR): For non-linear regression tasks and is robust to outliers.
  • Artificial Neural Networks (ANN) / Multilayer Perceptrons (MLP): Can learn complex non-linear relationships.
  • Random Forest Regression: An ensemble method that combines multiple decision trees, gives good accuracy and robustness.
  • Partial Least Squares Regression (PLSR): Useful when you have many correlated predictor variables, as is often the case with spectral or image features.
  • Convolutional Neural Networks (CNNs): For a more advanced approach, you can use CNNs directly on the raw or preprocessed images to learn features and predict Brix/acidity end-to-end.
5. Model Evaluation:
  • Divide your dataset into training and testing sets.
  • Evaluate the model's performance on the unseen test set using metrics like:
  • Mean Absolute Error (MAE): Average absolute difference between predicted and actual values.
  • Root Mean Squared Error (RMSE): Measures the average magnitude of the errors, giving more weight to larger errors.
  • R-squared (R2): Indicates how well the model explains the variance in the dependent variable (Brix/acidity). A higher R2 indicates a better fit.
Hope this helps!

Categories

Find more on MATLAB 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!