Malic acid sweetness detection method and device based on machine vision
Through the malaria sweetness detection method based on machine vision, machine learning models are used to predict, and the problem that existing detection methods need to destroy fruits is solved, achieving a fast and non-destructive detection effect.
Patent Information
- Application Number
- CN202510044037.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-05-23
AI Technical Summary
The existing malar sweetness detection method requires the destruction of fruits, which is time-consuming and costly, and cannot be applied to rapid detection in large-scale production.
Using machine vision-based detection methods, Apple appearance images are acquired, preprocessed and feature information analysis are performed, and machine learning models are used to predict sweetness and sourness, and destructive detection is achieved.
It realizes the sweet and sour testing without destroying the apple, which is suitable for rapid testing in large-scale production, reducing costs and testing time.
Smart Images

Figure CN120028330A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine vision technology, and in particular to a method and device for detecting the sourness and sweetness of apples based on machine vision. Background Art
[0002] In the relevant technology, the sweetness and sourness of apples is a key quality indicator that affects the flavor of apples. At present, the sweetness and sourness detection of apples mainly relies on laboratory chemical analysis methods, such as high-performance liquid chromatography, acid-base titration, etc. Although these methods can provide relatively accurate test results, they often require the destruction of fruits, which is time-consuming and costly, and cannot be applied to rapid detection in large-scale production.
[0003] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to propose a method and device for detecting the sourness and sweetness of apples based on machine vision, which can complete the sourness and sweetness detection of apples without destroying the apples, and can be applicable to the rapid detection process in large-scale production.
[0005] To achieve the above object, one aspect of an embodiment of the present application provides a method for detecting the sourness and sweetness of apples based on machine vision, the method comprising the following steps:
[0006] Acquire appearance images of the apple to be inspected, wherein the appearance images of the apple to be inspected include images taken at different angles of the apple to be inspected;
[0007] Preprocessing the to-be-detected apple appearance image to obtain a first apple appearance image;
[0008] analyzing the apple appearance feature information in the first apple appearance image, wherein the apple appearance feature information includes color information, texture information, fruit volume-to-weight ratio, or fruit hardness information;
[0009] The apple appearance feature information is input into a target machine learning model to predict the sweetness and sourness, thereby obtaining the target sweetness and sourness of the apple to be tested.
[0010] In some embodiments, the preprocessing of the to-be-detected apple appearance image to obtain the first apple appearance image includes:
[0011] Performing denoising on the to-be-detected apple appearance image to obtain a second apple appearance image;
[0012] performing image enhancement processing on the second apple appearance image to obtain a third apple appearance image;
[0013] Perform image segmentation on the third apple appearance image to obtain the first apple appearance image.
[0014] In some embodiments, performing image enhancement processing on the second apple appearance image to obtain a third apple appearance image includes:
[0015] Performing grayscale processing on the appearance image of the apple to be detected to obtain a grayscale image;
[0016] Perform apple edge detection on the grayscale image to obtain the third apple appearance image.
[0017] In some embodiments, analyzing the apple appearance feature information in the first apple appearance image includes:
[0018] Counting the number of pixels in different color channels in the first apple appearance image;
[0019] generating a histogram corresponding to the first apple appearance image according to the number of pixels;
[0020] The color information in the apple appearance feature information is generated according to the histogram.
[0021] In some embodiments, analyzing the apple appearance feature information in the first apple appearance image includes:
[0022] Calculating average grayscale values of different windows in the first apple appearance image;
[0023] Calculate the difference of the average grayscale values between non-overlapping windows;
[0024] Determine a target window from different windows according to the difference;
[0025] Calculate the average value of the average grayscale value corresponding to all target windows as the peel roughness in the apple appearance feature information;
[0026] Calculating a gray level co-occurrence matrix of the first apple appearance image;
[0027] Calculating the variance corresponding to the gray level co-occurrence matrix;
[0028] Determine the texture contrast in the apple appearance feature information according to the variance;
[0029] Obtaining the magnitude and direction histogram of the gradient vector corresponding to the gray level co-occurrence matrix;
[0030] The texture directionality in the apple appearance feature information is determined according to the magnitude and direction histogram of the gradient vector.
[0031] In some embodiments, analyzing the apple appearance feature information in the first apple appearance image includes:
[0032] Selecting a preset area from the first apple appearance image as an area of interest image;
[0033] Acquire the spectrum value of the image of the region of interest within a preset wavelength range;
[0034] The fruit hardness information in the apple appearance feature information is predicted according to the spectral value and a preset hardness prediction model.
[0035] In some embodiments, analyzing the apple appearance feature information in the first apple appearance image includes:
[0036] Processing the first apple appearance image to obtain a standard contour image;
[0037] Acquire an apple slice contour image according to the standard contour image;
[0038] Fitting the apple slice contour image to obtain a B-spline curve;
[0039] The volume of the apple is calculated according to the B-spline curve;
[0040] Inputting the first apple appearance image into a weight prediction model to predict the weight of the apple;
[0041] The fruit volume-to-weight ratio in the apple appearance feature information is calculated according to the apple volume and the apple weight.
[0042] In some embodiments, the step of inputting the apple appearance feature information into a target machine learning model to perform sourness and sweetness prediction to obtain the target sourness and sweetness of the apple to be tested comprises:
[0043] The support vector regression model, the random forest regression model and the deep neural network model in the target machine learning model are trained respectively by using the training set;
[0044] Inputting the apple appearance feature information into a trained support vector regression model to predict the first sourness and sweetness of the apple to be tested;
[0045] Inputting the apple appearance feature information into a trained random forest regression model to predict the second sourness and sweetness of the apple to be tested;
[0046] Inputting the apple appearance feature information into a trained deep neural network model to predict the third sourness and sweetness of the apple to be tested;
[0047] The target sweetness and sourness is calculated according to the first sweetness and sourness, the second sweetness and sourness, and the third sweetness and sourness.
[0048] To achieve the above object, another aspect of the embodiment of the present application provides a device for detecting the sourness and sweetness of apples based on machine vision, the device comprising:
[0049] An acquisition module is used to acquire appearance images of the apple to be detected, wherein the appearance images of the apple to be detected include images taken at different angles of the apple to be detected;
[0050] A preprocessing module, used for preprocessing the to-be-detected apple appearance image to obtain a first apple appearance image;
[0051] an analysis module, configured to analyze the apple appearance feature information in the first apple appearance image, wherein the apple appearance feature information includes color information, texture information, fruit volume-to-weight ratio, or fruit hardness information;
[0052] The prediction module is used to input the apple appearance feature information into the target machine learning model to predict the sourness and sweetness, so as to obtain the target sourness and sweetness of the apple to be tested.
[0053] To achieve the above objective, another aspect of an embodiment of the present application provides a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the above method when executing the computer program.
[0054] The embodiments of the present application include at least the following beneficial effects: The present application provides a method and device for detecting the sourness and sweetness of apples based on machine vision. The scheme obtains images including images taken at different angles of an apple to be detected as the appearance image of the apple to be detected, and then pre-processes the appearance image of the apple to be detected to obtain a first apple appearance image. Then, after analyzing the apple appearance feature information in the first apple appearance image, the apple appearance feature information is input into a target machine learning model to perform sourness and sweetness prediction to obtain the target sourness and sweetness of the apple to be detected, thereby completing the apple sourness and sweetness detection without destroying the apple, and can be applied to the rapid detection process in large-scale production. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 is a flow chart of a method for detecting the sourness and sweetness of apples based on machine vision provided in an embodiment of the present application;
[0056] Figure 2 It is a structural schematic diagram of an apple sourness and sweetness detection device based on machine vision provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application, they are only examples of devices and methods consistent with some aspects of the embodiments of the present application.
[0058] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".
[0059] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.
[0060] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0061] Before describing the embodiments of the present application in detail, some nouns and terms involved in the embodiments of the present application are first described. The nouns and terms involved in the embodiments of the present application are subject to the following explanations.
[0062] In the relevant technology, the sweetness and sourness of apples is a key quality indicator that affects the flavor of apples. At present, the sweetness and sourness detection of apples mainly relies on laboratory chemical analysis methods, such as high-performance liquid chromatography, acid-base titration, etc. Although these methods can provide relatively accurate test results, they often require the destruction of fruits, which is time-consuming and costly, and cannot be applied to rapid detection in large-scale production.
[0063] In view of this, a method and device for detecting the sourness and sweetness of an apple based on machine vision are provided in an embodiment of the present application. The present application obtains images including images taken at different angles of an apple to be detected as the appearance image of the apple to be detected, and then pre-processes the appearance image of the apple to be detected to obtain a first apple appearance image. Then, after analyzing the apple appearance feature information in the first apple appearance image, the apple appearance feature information is input into a target machine learning model to perform sourness and sweetness prediction to obtain the target sourness and sweetness of the apple to be detected, thereby completing the apple sourness and sweetness detection without destroying the apple, and can be applicable to the rapid detection process in large-scale production.
[0064] The following is a detailed description of the embodiments of the present application in conjunction with the accompanying drawings:
[0065] Reference Figure 1 The present application embodiment provides a method for detecting the sourness and sweetness of apples based on machine vision, which includes but is not limited to the following steps:
[0066] Step S110, obtaining an appearance image of an apple to be inspected;
[0067] Step S120, preprocessing the apple appearance image to be detected to obtain a first apple appearance image;
[0068] Step S130, analyzing the apple appearance feature information in the first apple appearance image, wherein the apple appearance feature information includes color information, texture information, fruit volume-to-weight ratio or fruit hardness information;
[0069] Step S140: input the apple appearance feature information into the target machine learning model to predict the sourness and sweetness, and obtain the target sourness and sweetness of the apple to be tested.
[0070] In an embodiment of the present application, the appearance image of the apple to be detected includes images taken at different angles of the apple to be detected. Specifically, in this embodiment, a single apple on a tree can be photographed at different angles by a hyperspectral camera, thereby obtaining hyperspectral images of a single apple at different angles as the appearance image of the apple to be detected. In this embodiment, a high-resolution industrial camera can also be used to photograph a single apple on a tree at different angles, thereby obtaining RGB images of a single apple at different angles as the appearance image of the apple to be detected. This embodiment captures more comprehensive apple surface information by obtaining apple surface images at different angles.
[0071] It is understandable that after obtaining the appearance image of the apple to be detected, the present embodiment pre-processes the appearance image of the apple to be detected, thereby improving the accuracy of the subsequent processing steps. Specifically, the pre-processing process of the present embodiment may be to perform denoising on the appearance image of the apple to be detected to obtain a second apple appearance image, perform image enhancement on the second apple appearance image to obtain a third apple appearance image, and then perform image segmentation on the third apple appearance image to obtain the first apple appearance image.
[0072] In this embodiment, the denoising method may include but is not limited to a filter-based method, a model-based method or a learning-based method. Among them, the filter-based method includes but is not limited to a mean filtering method or a statistical sorting method; the model-based method includes but is not limited to a non-local self-similar model method, a gradient model method or a Markov random field model method; the learning-based method includes but is not limited to a deep convolutional neural network method, a convolutional neural network method, and an autoencoder-generated adversarial network method. The specific denoising process can be selected according to the characteristics of the apple appearance image and the type of noise. The image enhancement process can be performed by graying the apple appearance image to be detected to obtain a grayscale image, and then performing apple edge detection on the grayscale image to obtain a third apple appearance image, thereby making the difference in pixel values in the third apple appearance image, thereby improving the image contrast.
[0073] It is understandable that the apple appearance feature information includes but is not limited to color information, texture information, fruit volume-to-weight ratio or fruit hardness information. In the embodiment of the present application, taking the analysis of color information in the apple appearance feature information as an example, the embodiment can generate a histogram corresponding to the first apple appearance image according to the number of pixels after counting the number of pixels in different color channels in the first apple appearance image, and then generate the color information in the apple appearance feature information according to the histogram.
[0074] Taking the analysis of texture information in the appearance feature information of apples as an example, since the texture information includes information such as peel roughness, texture contrast, and texture directionality, this implementation includes but is not limited to the following steps:
[0075] Step S210, calculating the average grayscale value of different windows in the first apple appearance image;
[0076] Step S220, calculating the difference in average grayscale values between non-overlapping windows;
[0077] Step S230: determining a target window from different windows according to the difference; wherein the target window may be a window corresponding to the maximum difference;
[0078] Step S240, calculating the average of the average grayscale values corresponding to all target windows as the peel roughness in the apple appearance feature information;
[0079] Step S250, calculating the gray level co-occurrence matrix of the first apple appearance image;
[0080] Step S260, calculating the variance corresponding to the gray level co-occurrence matrix;
[0081] Step S270, determining the texture contrast in the apple appearance feature information according to the variance;
[0082] Step S280, obtaining the magnitude and direction histogram of the gradient vector corresponding to the gray level co-occurrence matrix;
[0083] Step S290: Determine the texture directionality in the apple appearance feature information according to the magnitude and direction histogram of the gradient vector.
[0084] It can be understood that the grayscale histogram is the result of counting the grayscale of a single pixel on the image; the grayscale co-occurrence matrix is the result of counting the conditions in which two pixels on the image that maintain a certain distance have a certain grayscale. Exemplarily, select any point (x, y) in the first apple appearance image (N×N) and another point (x+a, y+b) that deviates from the point (x, y), and set the grayscale value of the point pair to (g1, g2). Let the point (x, y) move on the entire first apple appearance image, and various (g1, g2) values will be obtained. Let the number of grayscale values be k, then there are k square combinations of (g1, g2). For the entire first apple appearance image, count the number of times each (g1, g2) value appears, and then arrange them into a square matrix, and then use the total number of times (g1, g2) appears to normalize them to the probability of occurrence P(g1, g2). Such a square matrix is called a grayscale co-occurrence matrix. Different numerical combinations of distance difference values (a, b) can obtain joint probability matrices in different situations. The values of (a, b) should be selected according to the characteristics of the texture periodic distribution. For finer textures, small difference values such as (1, 0), (1, 1), and (2, 0) are selected. Specifically, when a=1, b=0, the pixel pair is horizontal, that is, 0-degree scanning; when a=0, b=1, the pixel pair is vertical, that is, 90-degree scanning; when a=1, b=1, the pixel pair is right diagonal, that is, 45-degree scanning; when a=-1, b=1, the pixel pair is left diagonal, that is, 135-degree scanning. Therefore, the probability of two pixel gray levels occurring at the same time converts the spatial coordinates of (x, y) into a description of a "grayscale pair" (g1, g2), forming a grayscale co-occurrence matrix.
[0085] Specifically, after obtaining information such as peel roughness, texture contrast, and texture directionality, this embodiment can characterize the texture information of the apple to be detected corresponding to the first apple appearance image.
[0086] Taking the analysis of the fruit firmness information in the apple appearance feature information as an example, the analysis process of this embodiment can be performed by selecting a preset area from the first apple appearance image as the region of interest image, obtaining the spectral value of the region of interest image within a preset wavelength range, and then predicting the fruit firmness information in the apple appearance feature information according to the spectral value and the preset firmness prediction model. Exemplarily, a region with a preset area size of 30*150 pixels is selected from the first apple appearance image as the region of interest image, and then the spectral value of the region of interest image within the range of 200-800nm is extracted, and then based on the spectral value, the fruit firmness information is calculated by using the regression least squares method.
[0087] Taking the analysis of the fruit volume-to-weight ratio in the apple appearance feature information as an example, the analysis process of this embodiment includes but is not limited to the following steps:
[0088] Step S310, processing the first apple appearance image to obtain a standard outline image;
[0089] Step S320, obtaining an apple slice contour image according to the standard contour image;
[0090] Step S330, fitting the apple slice contour image to obtain a B-spline curve;
[0091] Step S340, calculating the volume of the apple according to the B-spline curve; in this step, after calculating the sub-volumes corresponding to the contour image of the apple slice, the total volume obtained by summing up all the sub-volumes is taken as the volume of the apple;
[0092] Step S350: input the first apple appearance image into the weight prediction model to predict the weight of the apple;
[0093] Step S360: Calculate the fruit volume-to-weight ratio in the apple appearance feature information according to the apple volume and the apple weight.
[0094] It is understandable that the weight prediction model can be a model that combines the YOLOv3 deep learning model and the linear regression model. Specifically, after the first apple appearance image is input into the YOLOv3 deep learning model, the apple region is segmented by pixel calculation, and then the characteristic parameters of the apple region are input into the linear regression model to reversely deduce the apple weight. The fruit volume-to-weight ratio in the apple appearance feature information is then calculated in combination with the previously calculated apple volume.
[0095] Specifically, after analyzing all the contents of the apple appearance feature information, this embodiment inputs all the apple appearance feature information into the target machine learning model to predict the sourness and sweetness. It can be understood that the sourness and sweetness prediction process of this embodiment includes but is not limited to the following steps:
[0096] Step S410: training the support vector regression model, random forest regression model and deep neural network model in the target machine learning model respectively through the training set;
[0097] Step S420, inputting the apple appearance feature information into the trained support vector regression model to predict the first sourness and sweetness of the apple to be tested;
[0098] Step S430, inputting the apple appearance feature information into the trained random forest regression model to predict the second sweetness and sourness of the apple to be tested;
[0099] Step S440, inputting the apple appearance feature information into the trained deep neural network model to predict the third sourness and sweetness of the apple to be tested;
[0100] Step S450: Calculate the target sweetness and sourness according to the first sweetness and sourness, the second sweetness and sourness, and the third sweetness and sourness.
[0101] In an embodiment of the present application, the training set may be composed of known apple appearance feature information and its corresponding evaluation sourness and sweetness data. After the support vector regression model, random forest regression model and deep neural network model in the target machine learning model are respectively used for these training sets, and then the sourness and sweetness of the apple to be tested is predicted by each sub-model, the target sourness and sweetness of the apple to be tested is calculated based on the weight coefficient of each sub-model and the sourness and sweetness of the apple to be tested predicted by all sub-models, thereby effectively improving the accuracy of the prediction result of the sourness and sweetness of the apple.
[0102] From the above content, it can be seen that the method of the embodiment of the present application realizes non-destructive detection of the sweetness and sourness of apples through machine vision technology, avoids the destruction of fruits in traditional methods, and reduces equipment and operating costs; and compared with laboratory chemical detection methods, the method of the embodiment of the present application has the advantage of fast detection speed, and is suitable for large-scale real-time detection of the sweetness and sourness of apples on the production line.
[0103] Reference Figure 2 The embodiment of the present application provides a device for detecting the sourness and sweetness of apples based on machine vision, the device comprising:
[0104] An acquisition module 510 is used to acquire appearance images of the apple to be detected, wherein the appearance images of the apple to be detected include images taken at different angles of the apple to be detected;
[0105] A preprocessing module 520, configured to preprocess the apple appearance image to be detected to obtain a first apple appearance image;
[0106] An analysis module 530 is used to analyze the apple appearance feature information in the first apple appearance image, wherein the apple appearance feature information includes color information, texture information, fruit volume-to-weight ratio or fruit hardness information;
[0107] The prediction module 540 is used to input the apple appearance feature information into the target machine learning model to predict the sourness and sweetness, and obtain the target sourness and sweetness of the apple to be tested.
[0108] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0109] In addition, an embodiment of the present application further provides a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement Figure 1 The method shown.
[0110] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0111] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A method for detecting the sourness and sweetness of apples based on machine vision, characterized in that: The method comprises the following steps: Acquire appearance images of the apple to be inspected, wherein the appearance images of the apple to be inspected include images taken at different angles of the apple to be inspected; Preprocessing the to-be-detected apple appearance image to obtain a first apple appearance image; analyzing the apple appearance feature information in the first apple appearance image, wherein the apple appearance feature information includes color information, texture information, fruit volume-to-weight ratio, or fruit hardness information; The apple appearance feature information is input into a target machine learning model to predict the sweetness and sourness, thereby obtaining the target sweetness and sourness of the apple to be tested.
2. The method according to claim 1, characterized in that The preprocessing of the to-be-detected apple appearance image to obtain a first apple appearance image includes: Performing denoising on the to-be-detected apple appearance image to obtain a second apple appearance image; performing image enhancement processing on the second apple appearance image to obtain a third apple appearance image; Perform image segmentation on the third apple appearance image to obtain the first apple appearance image.
3. The method according to claim 2, characterized in that The performing image enhancement processing on the second apple appearance image to obtain a third apple appearance image includes: Performing grayscale processing on the appearance image of the apple to be detected to obtain a grayscale image; Perform apple edge detection on the grayscale image to obtain the third apple appearance image.
4. The method according to claim 1, characterized in that: The analyzing the apple appearance feature information in the first apple appearance image includes: Counting the number of pixels in different color channels in the first apple appearance image; generating a histogram corresponding to the first apple appearance image according to the number of pixels; The color information in the apple appearance feature information is generated according to the histogram.
5. The method according to claim 1, characterized in that The analyzing the apple appearance feature information in the first apple appearance image includes: Calculating average grayscale values of different windows in the first apple appearance image; Calculate the difference of the average grayscale values between non-overlapping windows; Determine a target window from different windows according to the difference; Calculate the average value of the average grayscale value corresponding to all target windows as the peel roughness in the apple appearance feature information; Calculating a gray level co-occurrence matrix of the first apple appearance image; Calculating the variance corresponding to the gray level co-occurrence matrix; Determine the texture contrast in the apple appearance feature information according to the variance; Obtaining the magnitude and direction histogram of the gradient vector corresponding to the gray level co-occurrence matrix; The texture directionality in the apple appearance feature information is determined according to the magnitude and direction histogram of the gradient vector.
6. The method according to claim 1, characterized in that The analyzing the apple appearance feature information in the first apple appearance image includes: Selecting a preset area from the first apple appearance image as an area of interest image; Acquire the spectrum value of the image of the region of interest within a preset wavelength range; The fruit hardness information in the apple appearance feature information is predicted according to the spectral value and a preset hardness prediction model.
7. The method according to claim 1, characterized in that The analyzing the apple appearance feature information in the first apple appearance image includes: Processing the first apple appearance image to obtain a standard contour image; Acquire an apple slice contour image according to the standard contour image; Fitting the apple slice contour image to obtain a B-spline curve; The volume of the apple is calculated according to the B-spline curve; Inputting the first apple appearance image into a weight prediction model to predict the weight of the apple; The fruit volume-to-weight ratio in the apple appearance feature information is calculated according to the apple volume and the apple weight.
8. The method according to claim 1, characterized in that: The step of inputting the apple appearance feature information into a target machine learning model to predict the sweetness and sourness to obtain the target sweetness and sourness of the apple to be tested comprises: The support vector regression model, the random forest regression model and the deep neural network model in the target machine learning model are trained respectively by using the training set; Inputting the apple appearance feature information into a trained support vector regression model to predict the first sourness and sweetness of the apple to be tested; Inputting the apple appearance feature information into a trained random forest regression model to predict the second sourness and sweetness of the apple to be tested; Inputting the apple appearance feature information into a trained deep neural network model to predict the third sourness and sweetness of the apple to be tested; The target sweetness and sourness is calculated according to the first sweetness and sourness, the second sweetness and sourness, and the third sweetness and sourness.
9. A device for detecting the sweetness and sourness of apples based on machine vision, characterized in that: The device comprises: An acquisition module, used to acquire appearance images of the apple to be detected, wherein the appearance images of the apple to be detected include images taken at different angles of the apple to be detected; A preprocessing module, used for preprocessing the to-be-detected apple appearance image to obtain a first apple appearance image; an analysis module, configured to analyze the apple appearance feature information in the first apple appearance image, wherein the apple appearance feature information includes color information, texture information, fruit volume-to-weight ratio, or fruit hardness information; The prediction module is used to input the apple appearance feature information into the target machine learning model to predict the sourness and sweetness, so as to obtain the target sourness and sweetness of the apple to be tested.
10. A computer device, characterized in that: The computer device comprises a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 8 when executing the computer program.