This invention relates to the field of
pet food spectral detection technology, and discloses a
pet food spectral detection device and method. The method involves sampling at equal intervals within a preset
wavelength range, eliminating
noise interference through
dark current and standard white plate calibration; taking the natural logarithm of reflectance to balance the
dynamic range; constructing a linear spline basis at equal intervals, and adaptively calculating the regularization coefficient based on the energy ratio of the
signal and basis functions; constructing an
augmented matrix based on the inner product of the basis functions and the
signal, and solving for the spline coefficients using
Gaussian elimination; reconstructing the spectrum using the coefficients and quantifying the residuals; establishing a
reference model based on the mean and standard deviation of multiple qualified sample coefficients; comparing the
Euclidean distance between the coefficients of the sample to be tested and the model mean with a threshold, and generating residuals, distances, thresholds, and a judgment report; the entire process requires no empirical parameters or manual tuning, enabling batch online adaptive detection, achieving rapid and accurate detection with
noise correction, feature enhancement,
overfitting suppression, and
traceability.