Abstract:Oil content, protein, glucosinolates, and internal qualities are required to be detected during harvesting, transportation, storage, and sale of rapeseed. In this study, a portable device was designed to detect the rapeseed internal quality using near-infrared spectroscopy, in order to realize the multi-index, portable, and rapid non-destructive testing. The hardware was integrated with the dimensions of 246 mm × 128 mm × 127 mm, such as a mini spectrometer, an LCD touchscreen, and a Raspberry Pi processor. The device was operated stably outdoors for 6 hours. The 65 varieties of rapeseed were sampled from different production areas. Diffuse reflectance spectra were then collected from 900 to 1700nm. The wavelength stability tests were carried out to determine a stable spectral region from 900 to 1633nm. Data was divided using KS, SPXY, and Random number. The dataset division was obtained with R2 as the index, where the KS was used for the oil content and protein, while the random numbers were for the glucosinolates, erucic acid, and moisture content. Various methods of data smoothing were evaluated with data smoothness as the index, such as SNV, SG, MSC, D1, and D2. SG smoothing (5-window, and 3rd order) was determined as the best preprocessing. Cars, Pca, GA, Lars, Uve, and Spa were used as data reduction to explore the best dimension reduction for each physicochemical index. Cars reduced the dimensions of the oil content model by 73%. Pca reduced the dimensions of the protein and erucic acid models by 98%. Thus the predictive accuracy of erucic acid was improved by 31.49%, whereas, the predictive error was reduced by 40.78%. PLS, ANN, CNN, SVR, and ELM models were used with RMSE, R2, and MAE as the indices. The calibration model was determined for the oil content using KS+SG+Cars+PLS, for the protein using SPXY+SG+Pca+PLS, for the glucosinolates using Random+SG+PLS, for the moisture content using Random+SG+ELM, and the for erucic acid using Random+SG+Pca+PLS. Model indices were as follows: RMSE, R2, and MAE for the oil content were 1.40, 0.95, 1.16; for the protein 1.46, 0.86, 1.24; for the glucosinolates 20.70, 0.73, 15.73; for the erucic acid 3.63, 0.86, 3.28; for the moisture content 0.36, 0.98, 0.24, respectively. The device was used to collect the spectra from 1 to 7g of rapeseed seven times for the light transmission. Results showed that the absorption error for 3 to 7g was within ±5%. Electronic scales were then removed for direct sample testing during field tests. Five stability tests were conducted at temperatures from 15℃ to 35℃, all of which were within reliable ranges; Stability tests were set as the relative humidity from 40% to 80% and found condensation at 70% relative humidity, which was corrected to maintain stability from 40% to 70% relative humidity. Accuracy tests on the device showed the correlation coefficients (R2) for oil content, protein content, glucosinolates, moisture content, and erucic acid between predicted and real sets at 0.932, 0.855, 0.734, 0.968, and 0.761, respectively; RMSE values were 1.35, 1.67, 19.6, 0.34, and 2.96, respectively. Therefore, the device can be expected to perform real-time non-destructive testing of oil content, protein, glucosinolates, moisture content, and erucic acid in rapeseed after safe storage.