The invention discloses a hyperspectral detection method for the
sugar degree and
hardness of tomatoes. The method comprises the following steps: firstly, acquiring a hyperspectral reflection or transmission spectrum of tomatoes in a range of 400-1000nm, and carrying out pretreatment such as standard normal transformation, multivariate
scatter correction, Savitzky-Golay
smoothing and orthogonal
signal correction on the original spectrum; then, characteristic
wavelength screening is carried out on the preprocessed spectrum through a competitive adaptive reweighted sampling (CARS), an irreducible variable
elimination (UVE) or a UVE-CARS joint
algorithm, and a characteristic spectrum matrix is obtained; a Kennard-Stone (KS)
algorithm is further adopted to divide a training sample into a correction set and a prediction set, a tomato
sugar degree model and a tomato
hardness model are constructed based on
partial least squares regression (PLSR), and an optimal main factor number is determined through
cross validation; and inputting the characteristic spectrum of the tomato to be detected into the model, and outputting the predicted values of
sugar degree and
hardness. The method has the advantages of no damage to fruits, high modeling stability, good prediction precision and the like, and is suitable for the fields of tomato quality evaluation, grading,
postharvest treatment and the like.