Vehicle-mounted soil nutrient detection system and method based on comparative learning
By using a vehicle-mounted soil nutrient detection system and employing a comparative learning method to perform multi-level comparisons of soil spectra, the problems of low efficiency and environmental pollution in existing soil nutrient detection technologies have been solved, achieving real-time and accurate soil nutrient detection.
Patent Information
- Application Number
- CN202510943499.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-09
- Publication Date
- 2025-11-07
AI Technical Summary
Existing mobile soil nutrient detection methods have significant limitations and low efficiency. In particular, the difficulty of mining and extracting spectral stability features increases in field agricultural operations. Chemical detection methods suffer from long detection cycles, significant human interference, and potential environmental pollution risks.
A vehicle-mounted soil nutrient detection system based on contrastive learning is adopted. The system is powered by a traction module, which assists the detection module in breaking up and leveling the soil. Combined with a spectral detection unit and a calculation and control unit, it achieves stable feature extraction and multi-level comparison of spectral signals. A soil nutrient detection model is constructed using contrastive learning methods.
It enables real-time and efficient soil nutrient detection, eliminates physical morphological interference, acquires low-noise spectral signals, improves the accuracy and reliability of soil nutrient content detection, and meets the needs of rapid, non-destructive, and green detection.
Smart Images

Figure CN120908134A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of soil detection, and particularly relates to a vehicle-mounted soil nutrient detection system and method based on contrast learning. BACKGROUND
[0002] Currently, soil organic matter and total nitrogen detection is mainly based on chemical detection methods, which have problems such as long detection period and large human interference, and the chemical reagents used will cause environmental pollution. Therefore, the soil nutrient detection method needs to be changed to fast, non-destructive and green, and at the same time meet the real-time, fast and mobile detection requirements.
[0003] However, the near-infrared spectrum itself faces problems such as serious spectral peak overlap and wide effective bandwidth. In the field of agricultural operation, the problems will be greatly aggravated, and the mobile operation conditions also put higher requirements on the extraction of spectral stability characteristics.
[0004] Therefore, the mobile soil nutrient detection method in the related art has the technical problems of great limitation and low efficiency. SUMMARY
[0005] The present application provides a vehicle-mounted soil nutrient detection system and method based on contrast learning, which solves the defects of the mobile soil nutrient detection method in the prior art, has great limitation and low efficiency, and realizes real-time and efficient vehicle-mounted field soil nutrient detection.
[0006] The present application provides a vehicle-mounted soil nutrient detection system based on contrast learning, comprising the following steps. A traction module is used to provide traction to pull the detection equipment to move in an unknown plot, and to conduct power to an auxiliary detection module; the auxiliary detection module is electrically connected with the traction module, used to receive the power, and to crush and flatten the soil samples of the unknown plot collected by the detection equipment to obtain a flat soil surface; a soil detection module comprises a spectrum detection unit and a calculation and control unit, and is used to perform spectrum detection on the flat soil surface to obtain soil nutrient content, wherein the spectrum detection unit is used to perform spectrum detection on the flat soil surface to obtain soil spectrum signals; the calculation and control unit is in communication connection with the spectrum detection unit, and is used to extract stable features of the soil spectrum signals to obtain a to-be-detected spectrum of the unknown plot; and the calculation and control unit is further used to perform multi-level comparison between the to-be-detected spectrum of the unknown plot and a standard spectrum of a calibration plot pre-stored to determine the soil nutrient content of the unknown plot.
[0007] The application provides a vehicle-mounted soil nutrient detection system based on contrast learning, and the computing and control unit is specifically used for: performing first-level contrast operation on the to-be-detected spectrum of the unknown plot and the standard spectrum of the calibration plot based on principal component analysis, to obtain a soil spectrum detection set, wherein the first-level contrast operation is used for spectrum difference elimination.
[0008] The application provides a vehicle-mounted soil nutrient detection system based on contrast learning, and the first-level contrast operation comprises: Wherein, represents a target feature direction, represents a spectrum feature dimension, represents a unit vector constraint, represents a real number space, represents the projection of the to-be-detected spectrum of the unknown plot on the target feature direction, represents the projection of the standard spectrum of the calibration plot on the target feature direction, represents contrast intensity, represents soil spectrum features.
[0009] The application provides a vehicle-mounted soil nutrient detection system based on contrast learning, and the computing and control unit is specifically used for: obtaining a first soil spectrum and a second soil spectrum of the calibration plot; inputting the first soil spectrum and the second soil spectrum into soil feature extraction networks with the same structure respectively to add Gaussian noise, to obtain first soil feature variables and second soil feature variables; performing second-level contrast operation on the first soil feature variables and the second soil feature variables based on a joint loss function, to obtain a to-be-detected feature set with the same shape and similar structure; and constructing a soil nutrient detection model based on the to-be-detected feature set.
[0010] The application provides a vehicle-mounted soil nutrient detection system based on contrast learning, and the computing and control unit is specifically used for: inputting the soil spectrum detection set into the soil nutrient detection model, to obtain soil nutrient content of the unknown plot output by the soil nutrient detection model, wherein the soil nutrient content at least comprises one of soil organic matter and total nitrogen.
[0011] The application provides a vehicle-mounted soil nutrient detection system based on contrast learning, and the joint loss function comprises: Wherein, is a loss function based on cosine similarity, is a loss function based on a Gaussian kernel function and a squared Euclidean distance matrix, represents the contrast intensity.
[0012] The application also provides a vehicle-mounted soil nutrient detection method based on contrast learning, comprising the following steps: performing spectrum detection on a flat soil surface to obtain soil nutrient content, wherein the steps comprise: performing spectrum detection on a flat soil surface to obtain a soil spectrum signal; performing stable feature extraction on the soil spectrum signal to obtain a to-be-detected spectrum of an unknown plot; performing multi-level contrast on the to-be-detected spectrum of the unknown plot and a standard spectrum of a calibration plot stored in advance to determine the soil nutrient content of the unknown plot.
[0013] The application also provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the vehicle-mounted soil nutrient detection method based on contrast learning according to any one of the above descriptions when executing the program.
[0014] The application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program is executable by a processor to implement the vehicle-mounted soil nutrient detection method based on contrast learning according to any one of the above descriptions.
[0015] The application also provides a computer program product comprising a computer program, wherein the computer program is executable by a processor to implement the vehicle-mounted soil nutrient detection method based on contrast learning according to any one of the above descriptions.
[0016] The vehicle-mounted soil nutrient detection system and method based on contrast learning provided by the application drive the auxiliary detection module to effectively crush and flatten the soil sample through the power conducted by the traction module, ensure that the generated flat soil surface eliminates physical form interference, and thus provide a stable base for subsequent spectrum detection; in the soil detection module, the spectrum detection unit directly obtains a low-noise soil spectrum signal accordingly, thus effectively connecting the front-end physical processing and data acquisition; the calculation and control unit first converts the signal into a to-be-detected spectrum through stable feature extraction, and then performs hierarchical comparison with a pre-stored calibration plot standard spectrum based on a multi-level contrast mechanism, and finally outputs a soil nutrient content with high accuracy. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description one by one. Obviously, the drawings in the following description are some embodiments of the application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.
[0018] Figure 1 is a module schematic diagram of a vehicle-mounted soil nutrient detection system based on contrast learning provided by the application.
[0019] Figure 2 is a structural schematic diagram of a soil detection module provided by the application.
[0020] Figure 3 is a first-level contrast operation schematic diagram of a vehicle-mounted soil nutrient detection system and method based on contrast learning provided by the application.
[0021] Figure 4 is a second-level contrast operation schematic diagram of a vehicle-mounted soil nutrient detection system and method based on contrast learning provided by the application.
[0022] Figure 5 is a flow schematic diagram of a vehicle-mounted soil nutrient detection method based on contrast learning provided by the application.
[0023] Figure 6 is a physical structure schematic diagram of an electronic device provided by the application. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the present application will be described clearly and completely below in combination with the drawings in the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0025] The growth and breeding of crops cannot be separated from the supply of soil nutrients. A rapid, timely and effective large-area soil nutrient detection system and method suitable for the growth and planting needs of crops has great benefits for guiding the effective recycling of cultivated land. However, the detection of soil organic matter and total nitrogen is still mainly based on chemical detection methods, which have problems such as long detection period and large human interference. At the same time, the use of chemical reagents will have the hidden danger of environmental pollution. Therefore, the soil nutrient detection system and method need to be changed to fast, non-destructive and green, while meeting the real-time, rapid and mobile detection needs. Under this background, developing a vehicle-mounted soil nutrient spectral detection method and system is an inevitable trend of future development.
[0026] Near-infrared spectrum can reflect the combination frequency and frequency doubling information of C-H, N-H and other groups, so it is often used for detection of soil organic matter, total nitrogen and other nutrients. However, the problems of serious spectral peak overlap and wide effective bandwidth of near-infrared spectrum itself will be greatly aggravated in the field of agricultural operation, and the mobile operation conditions also put forward higher requirements for the mining and extraction of spectral stability characteristics.
[0027] In order to solve the above problems, the present application provides a vehicle-mounted soil nutrient detection method and system based on contrast learning. The vehicle-mounted soil total nitrogen and organic matter content detection device and system is carried on the traction unit such as tractor, which continuously measures the soil in different fields (including calibration plots and unknown plots) during driving. By performing a first-level comparison operation on the spectral information obtained from the calibration plots and unknown plots, the difference information between the two is removed to obtain the detected spectral data set. Then, a second-level comparison operation is performed on the spectral data in the calibration plots to complete the model training under the condition of small sample. Finally, the model obtained by small sample modeling in the calibration plots is used to detect the soil nutrient content in the unknown plots, so as to realize the purpose of detecting the soil nutrient in the detected plots.
[0028] The purpose of the present application is to provide a vehicle-mounted soil nutrient detection method and system based on contrast learning, which can obtain stable spectral characteristics in the mobile detection task of soil nutrients. The characteristics are obtained through the first-level comparison operation of soil spectrum of calibration plots and unknown plots, and the second-level comparison operation of single spectral data in the calibration plots. The present application is suitable for continuous, real-time and rapid on-site detection requirements in the detection task of soil organic matter and total nitrogen, and provides a real-time and effective on-site detection method in the field of agricultural operation.
[0029] Reference Figure 1 , Figure 1 is a module schematic diagram of the vehicle-mounted soil nutrient detection system based on contrast learning provided by the present application.
[0030] The present application is a vehicle-mounted soil nutrient detection system and method based on contrast learning, mainly aiming at the detection task of soil organic matter and total nitrogen content in large-scale farmland.
[0031] The vehicle-mounted soil nutrient detection system based on contrast learning provided by the present application comprises the following modules: The traction module 101 is used to provide traction to pull the detection device forward in the unknown plot, and to conduct power to the auxiliary detection module 102; The auxiliary detection module 102 is electrically connected with the traction module 101, used to receive power, and to crush and flatten the soil samples collected by the detection device in the unknown plot, so as to obtain a flat soil surface; The soil detection module 103 comprises a spectrum detection unit 1031 and a calculation and control unit 1032, and is used for performing spectrum detection on the flat soil surface to obtain soil nutrient content, wherein the soil detection module 103 comprises the following: The spectrum detection unit 1031 is used for performing spectrum detection on the flat soil surface to obtain a soil spectrum signal. The calculation and control unit 1032 is in communication connection with the spectrum detection unit, and is used for performing stable feature extraction on the soil spectrum signal to obtain a to-be-detected spectrum of the unknown plot. The calculation and control unit 1032 is further used for performing multi-level comparison between the to-be-detected spectrum of the unknown plot and a pre-stored standard spectrum of a calibration plot to determine the soil nutrient content of the unknown plot.
[0032] In the embodiment of the present application, the traction module mainly refers to an agricultural implement (such as a tractor) for mounting a vehicle-mounted detection device. The traction module can pull the detection device to move in the plot to be detected, and can provide power for the auxiliary detection module to operate.
[0033] The auxiliary detection module is mainly used as a device and apparatus for converting the soil state into a detection state, and specifically comprises a rake tooth, a transmission system and a leveling structure.
[0034] The rake tooth is used for breaking and crushing the surface soil and large soil blocks, and cutting the surface weeds and crop residues to form a fine soil structure for detection. The leveling structure is used for leveling the broken soil to obtain a flat soil surface for detection. The transmission system drives the rake tooth and the leveling structure to move and rotate through the power output of the traction module.
[0035] The soil detection module is used for spectrum information acquisition, to-be-detected feature calculation, feature set comparison and screening, control instruction setting and the like of the field soil of the farmland.
[0036] Reference Figure 2 , Figure 2 is a structural diagram of the soil detection module provided by the present application.
[0037] The soil detection module mainly comprises one storage, calculation and control unit, one positioning unit, one interactive unit, one spectrum detection unit (i.e. a spectrometer, a collimator, a light source, a lens), one battery management module and one set of battery.
[0038] The spectrum detection unit is used for spectrum signal acquisition, and mainly comprises a spectrometer, a collimator, a light source, a lens (including a coating film, and can pass through a 900-1700nm waveband) and the like.
[0039] The storage, calculation and control unit is used for controlling the operation of the spectrum detection unit, performing stable feature extraction on the continuously collected soil spectrum, and comparing with the standard features (stored in the unit) to obtain standard stable features; the positioning unit is used for obtaining device positioning information, facilitating determination of the position of the vehicle-mounted device, and providing record information; the interactive unit is used for formulating and issuing control instructions and human-computer interaction; and the power management module and the battery pack provide energy supply for the entire soil detection module and ensure stable operation of the device.
[0040] In the embodiment of the present application, the traction module adopts a tractor power output unit, which continuously transmits power to the auxiliary detection module through a mechanical transmission shaft. The module drives the detection device to move forward at a speed of 2-5 km / h during driving, ensuring stable movement of the device in unknown plots.
[0041] After receiving the transmission power, the auxiliary detection module drives the hydraulic crushing roller to preliminarily crush the collected soil, controlling the soil particle size within the range of 2-5 mm. Then, the spring pressurized scraper compacts the soil surface to form a flat detection plane with a roughness of ≤2 mm, effectively eliminating optical detection errors.
[0042] The spectrum detection unit is a spectrometer that emits 900-1700 nm near-infrared waves at a 45° incident angle to the flat surface, collects diffuse reflection signals (sampling frequency 10 Hz, resolution ≤3 nm) through a coated lens, and generates original soil spectrum signals.
[0043] First-level comparison operation: The domain difference between the calibration plot and the unknown plot is removed by principal component analysis. First, the high-frequency noise of the spectrum is filtered out by discrete wavelet transform, then the calibration plot is used as the background data set and the unknown plot is used as the sample data set, the cross-plot stable features are extracted by the variance maximization algorithm, and the spectrum feature vector to be detected is generated.
[0044] Second-level comparison operation: Gaussian noise is added to the spectrum of the calibration plot to generate a two-way enhanced data (soil spectrum #1 / #2), which is input into the 3-layer CNN+Transformer feature extraction network. The two-way features are aligned by the joint loss function (cosine similarity and MMD domain alignment loss), and a 128-dimensional test feature set is constructed. Based on the test feature set, a soil nutrient detection model (such as a fully connected regression model) is trained, and finally the soil organic matter (g / kg) and total nitrogen content (mg / kg) are output.
[0045] Through the embodiment of the present application, the power driven auxiliary detection module conducted by the traction module effectively breaks and levels the soil sample, ensures that the generated leveled soil surface eliminates physical form interference, thereby providing a stable base for subsequent spectral detection; in the soil detection module, the spectral detection unit directly obtains a low-noise soil spectrum signal accordingly, logically connecting the front-end physical processing and data acquisition; the calculation and control unit first converts the signal into a to-be-detected spectrum through stable feature extraction, and then performs hierarchical comparison with the pre-stored standard spectrum of the calibration plot based on a multi-level comparison mechanism, and finally outputs a high-accuracy soil nutrient content.
[0046] According to the vehicle-mounted soil nutrient detection system based on contrast learning provided by the present application, the calculation and control unit is specifically used for: Through contrast principal component analysis, a first-level comparison operation is performed on the to-be-detected spectrum of the unknown plot and the standard spectrum of the calibration plot, and a soil spectrum detection set is obtained, wherein the first-level comparison operation is used for spectrum difference elimination.
[0047] In the embodiment of the present application, the spectrum between different plots under the same operation scene is eliminated (i.e. the first-level comparison operation).
[0048] Reference Figure 3 , Figure 3 is the first-level comparison operation schematic diagram of the vehicle-mounted soil nutrient detection system and method based on contrast learning provided by the present application, wherein it includes a target plot (i.e. an unknown plot), a spectrum detection (including a spectrometer, a light source, a collimator and a lens), a to-be-detected soil (i.e. a soil sample), a soil spectrum full set (original), a sample data set, a background data set, a comparison function, irrelevant variable elimination and a spectrum data set.
[0049] Firstly, the spectrum detection unit collects the spectrum of the soil in the calibration plot (i.e. the soil nutrient content known plot) / unknown plot (i.e. the soil nutrient content unknown plot) to obtain corresponding spectrum information; then, the irrelevant variable elimination between the calibration plot and the unknown plot is performed by using contrast principal component analysis, and a soil spectrum detection set is obtained for subsequent second-level comparison operation.
[0050] In some embodiments, during the travel of the device, the spectrum detection unit collects the soil spectrum signal (wavelength range 900-1700nm) of the unknown plot in real time, while the pre-stored calibration plot standard spectrum data is called. The calculation and control unit first performs discrete wavelet transform preprocessing on the two types of spectra, uses Daubechies wavelet basis function to filter out high-frequency environmental noise (such as device vibration, light mutation and other interference), and retains low-frequency spectrum components representing the essence of soil nutrients.
[0051] Subsequently, the contrast principal component analysis is performed: the standard spectrum of the calibration plot is set as a background data set, and the to-be-detected spectrum of the unknown plot is set as a sample data set; by adjusting a contrast intensity parameter (a), a target feature direction (b) is searched in a unit sphere space, and a difference between an explained variance of the sample data set and an explained variance of the background data set is maximized. For example, when a>0.5, the inhibition of interference factors such as field temperature and humidity changes and residual crop debris is automatically enhanced, and a spectrum detection set that only retains soil nutrient-related features is output.
[0052] By means of the embodiment of the present application, the spectrum features can be effectively extracted and compared by using the contrast learning method, accurate and targeted spectrum data basis is provided for subsequent soil nutrient detection, and the accuracy and reliability of the soil nutrient detection are improved.
[0053] According to the vehicle-mounted soil nutrient detection system based on contrast learning provided by the present application, the first contrast operation comprises: Among them, represents the target feature direction, represents the spectrum feature dimension, represents the unit vector constraint, represents the real number space, represents the projection of the to-be-detected spectrum of the unknown plot on the target feature direction, represents the projection of the standard spectrum of the calibration plot on the target feature direction, represents the contrast intensity, represents the soil spectrum feature.
[0054] In the embodiment of the present application, for the target feature direction , the explained variances in the unknown plot and the calibration plot are and , respectively. The adjustment parameter between the two controls the “contrast intensity”, and the higher the value is, the higher the rejection intensity of irrelevant variables between the two is.
[0055] represents the covariance matrix of the sample data set (unknown plot), represents the covariance matrix of the background data set (calibration plot), represents “defined as”, and represents the transposed matrix. Among them, the original spectrum data (for example, the to-be-detected spectrum of the unknown plot) is removed of high-frequency components by discrete wavelet transform. It is assumed that the input signal is
[0056] , after the convolution of scale function and wavelet function , low frequency component and high frequency component are obtained. Wherein, and are the coefficients of low-pass filter and high-pass filter respectively. The calculation process of discrete wavelet transform can be realized by recursive decomposition, given a signal , the expression of wavelet transform is: Wherein, indicates wavelet mother function, is the coefficient of wavelet transform, is the wavelet base function after scale and translation transformation, respectively indicate the index of scale and position.
[0057] It should be noted that, in the actual operation process, the spectral data (standard spectrum) obtained by calibrating the land is used as the background data set, and the spectral data (to be detected spectrum) obtained by unknown land is used as the sample data set, and the two together constitute the soil spectrum set. Wherein, the position information of the calibration land and the unknown land is distinguished by the positioning module.
[0058] Through the embodiment of the present application, the unique spectral characteristics of the unknown land can be highlighted, and the common noise between the lands is filtered.
[0059] According to the vehicle-mounted soil nutrient detection system based on contrast learning provided by the present application, the calculation and control unit is specifically used for: obtaining the first soil spectrum and the second soil spectrum of the calibration land; inputting the first soil spectrum and the second soil spectrum into the soil feature extraction network with the same structure respectively to add Gaussian noise, and obtaining the first soil feature variable and the second soil feature variable; performing second-level contrast operation based on the first soil feature variable and the second soil feature variable through the joint loss function, and obtaining the to-be-detected feature set with the same shape and similar structure; based on the to-be-detected feature set, constructing a soil nutrient detection model.
[0060] In view of the problem that a large number of samples are needed for modeling, the present application provides a contrast learning method to effectively extract soil nutrient spectral features.
[0061] In the embodiment of the present application, the spectral of the calibration land with less sample quantity (relative to the full set data) is used to obtain stable features, so as to construct a prediction model which can be used for unknown land soil nutrient content detection. This process includes second-level contrast operation.
[0062] Reference Figure 4 , Figure 4 is the second level contrast operation schematic diagram of the vehicle-mounted soil nutrient detection system and method based on contrast learning provided by the application. It includes: spectral data, soil spectrum #1 (i.e. first soil spectrum), soil spectrum #2 (i.e. second soil spectrum), encoder, feature variable #1 (i.e. first soil feature variable), feature variable #2 (i.e. second soil feature variable), to-be-detected feature set (i.e. to-be-detected feature set), detection model based on standard feature set, and soil organic matter and total nitrogen content.
[0063] In the embodiment of the application, first, single spectral data is obtained from the standard spectrum (standard spectral data set) of the calibration plot, and soil spectrum #1 and soil spectrum #2 (i.e. first soil spectrum and second soil spectrum) are obtained by adding Gaussian noise operation; then, the two are sent to soil feature extraction networks with the same structure to obtain feature variable #1 and feature variable #2 (i.e. first soil feature variable and second soil feature variable), and then the joint loss function (such as cosine similarity and domain alignment loss) is used to ensure that the feature variables have the same shape and similar structure, thereby obtaining the to-be-detected feature set.
[0064] Through the embodiment of the application, Gaussian noise is added to the input spectrum in the feature extraction network to simulate various disturbances that may be encountered in the real vehicle-mounted detection environment; contrast learning can learn the internal representation of the data, so that in the feature space, the feature representation of the same sample under different perspectives / transformations (the same spectrum after adding different noise) is as close as possible (positive sample pair), and the feature representation of different samples is as far away as possible (negative sample pair).
[0065] According to the vehicle-mounted soil nutrient detection system based on contrast learning provided by the application, the joint loss function includes: Among them, is a loss function based on cosine similarity, is a loss function based on Gaussian kernel function and Euclidean distance square matrix, represents the contrast intensity.
[0066] Among them, is a loss function based on cosine similarity, and the specific expression is: Among them, , respectively represent the first prediction head output vector and the second prediction head output vector (extracting the deep representation of soil organic matter / nitrogen phosphorus potassium); , respectively represent the first target vector, the second target vector (as an anchor point for similarity comparison), and represents the dot product operation, represents the L2 norm.
[0067] wherein, is a loss function realized on the basis of a Gaussian kernel function and a Euclidean distance square matrix , and the specific expression is as follows: wherein, () represents the mean of matrix elements, represents the to-be-detected spectrum of an unknown plot, represents the standard spectrum of a calibration plot, represents a cross-domain sample pair.
[0068] Through the embodiments of the present application, SimSiamLoss guarantees the feature invariance under homologous spectrum augmentation and breaks the noise interference bottleneck; MMDLoss eliminates the distribution difference between cross-plot domains; and finally, the real-time and accurate detection of organic matter / nitrogen in the vehicle-mounted scene is achieved.
[0069] According to the vehicle-mounted soil nutrient detection system based on contrast learning provided by the present application, the computing and control unit is specifically used for: inputting the soil spectrum detection set into the soil nutrient detection model to obtain the soil nutrient content of the unknown plot output by the soil nutrient detection model, wherein the soil nutrient content at least includes one of soil organic matter and total nitrogen.
[0070] In the embodiments of the present application, first, the user cleans the instrument equipment, removes the influence of interference such as crop residues and adhered soil; second, the detection parameter setting is performed through the interaction unit in the soil detection unit to determine the subsequent sampling interval, time and other parameters, and the storage, computing and control unit obtains the operation instruction and then delivers it to the positioning unit and the spectrum detection unit; third, the traction unit and the carrier are started to move forward, when the set conditions (sampling time interval or sampling distance) are met, the spectrum detection unit performs soil spectrum collection and transmits it to the storage, computing and control unit for irrelevant variable elimination of the soil spectrum of the calibration plot and the unknown plot; finally, the detection model constructed based on the calibration plot is used to detect the soil organic matter and total nitrogen of the unknown plot to output the soil nutrient information value, after the determination of the nutrient content in the current location area is completed, the equipment continues to move forward to finally obtain the current farmland soil nutrient distribution map.
[0071] In the embodiment of the present application, the spectral characteristics of soil organic matter and total nitrogen are divided into single spectral characteristics and set spectral characteristics for comparison operation, and irrelevant variable screening between different plots and single plot and small sample data modeling are completed respectively.
[0072] Through the embodiment of the present application, stable spectral characteristics can be obtained in the soil nutrient movement detection task, which is obtained through the first-level comparison operation of the soil spectrum of the calibration plot and the unknown plot and the second-level comparison operation of the single spectral data in the calibration plot. The present application is suitable for the continuous, real-time and rapid on-site detection requirements in the soil organic matter and total nitrogen detection task, and it provides a real-time and effective on-site detection method in the farmland operation scene.
[0073] The vehicle-mounted soil nutrient detection method based on contrast learning provided by the present application is described below, and the vehicle-mounted soil nutrient detection method based on contrast learning described below can be mutually corresponding to the vehicle-mounted soil nutrient detection system based on contrast learning described above.
[0074] Reference Figure 5 , Figure 5 is a flowchart of the vehicle-mounted soil nutrient detection method based on contrast learning provided by the present application.
[0075] The flat soil surface is subjected to spectral detection to obtain the soil nutrient content, wherein the flat soil surface is subjected to spectral detection to obtain the soil spectrum signal. Step 501, the flat soil surface is subjected to spectral detection to obtain the soil spectrum signal. Step 502, stable feature extraction is performed on the soil spectrum signal to obtain the to-be-detected spectrum of the unknown plot. Step 503, multi-level comparison is performed on the to-be-detected spectrum of the unknown plot and the pre-stored standard spectrum of the calibration plot to determine the soil nutrient content of the unknown plot.
[0076] Specifically, the vehicle-mounted soil nutrient method based on contrast learning provided by the present application can realize all method steps of the vehicle-mounted soil nutrient detection system based on contrast learning provided by the present application, and can achieve the same technical effects. The same parts and beneficial effects in the embodiment and the method embodiment are not described in detail.
[0077] Figure 6 is a schematic diagram of the physical structure of the electronic device provided by the present application, such as Figure 6As shown, the electronic device can include a processor 610, a communications interface 620, a memory 630, and a communications bus 640, wherein the processor 610, the communications interface 620, and the memory 630 complete mutual communication through the communications bus 640. The processor 610 can invoke a logic instruction in the memory 630 to execute the vehicle-mounted soil nutrient detection method based on contrast learning, which includes: performing spectral detection on a flat soil surface to obtain soil nutrient content, including: performing spectral detection on a flat soil surface to obtain a soil spectrum signal; performing stable feature extraction on the soil spectrum signal to obtain a to-be-detected spectrum of an unknown plot; and performing multi-level comparison between the to-be-detected spectrum of the unknown plot and a pre-stored standard spectrum of a calibration plot to determine soil nutrient content of the unknown plot.
[0078] In addition, the logic instruction in the memory 630 described above can be implemented in the form of a software function unit and sold or used as an independent product, which can be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0079] On the other hand, the present application also provides a computer program product, which includes a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program is executed by a processor, and the computer can execute the vehicle-mounted soil nutrient detection method based on contrast learning provided by the above-mentioned methods, which includes: performing spectral detection on a flat soil surface to obtain soil nutrient content, including: performing spectral detection on a flat soil surface to obtain a soil spectrum signal; performing stable feature extraction on the soil spectrum signal to obtain a to-be-detected spectrum of an unknown plot; and performing multi-level comparison between the to-be-detected spectrum of the unknown plot and a pre-stored standard spectrum of a calibration plot to determine soil nutrient content of the unknown plot.
[0080] In yet another aspect, the present application also provides a non-transitory computer-readable storage medium having stored thereon a computer program, which, when executed by a processor, implements a vehicle-mounted soil nutrient detection method based on contrast learning provided by each of the above methods, the method comprising: performing spectral detection on a flat soil surface to obtain soil nutrient content, wherein the method comprises: performing spectral detection on a flat soil surface to obtain a soil spectrum signal; performing stable feature extraction on the soil spectrum signal to obtain a to-be-detected spectrum of an unknown plot; and performing multi-level comparison between the to-be-detected spectrum of the unknown plot and a pre-stored standard spectrum of a calibration plot to determine the soil nutrient content of the unknown plot.
[0081] The device embodiments described above are merely illustrative, wherein the units illustrated as separate components can or can not be physically separated, and the components illustrated as units can or can not be physical units, i.e., can be located in one place or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the present embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0082] From the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be realized by means of software and the necessary general hardware platform, and of course, can also be realized by hardware. Based on such understanding, the above technical solutions, essentially or in the form of software products, can be embodied in a computer software product, which can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0083] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to some technical features thereof; and these modifications or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A vehicle-mounted soil nutrient detection system based on contrast learning, characterized in that, The method comprises the following steps: a traction module is used to provide traction to pull the detection equipment to move in an unknown land and to transmit power to an auxiliary detection module; the auxiliary detection module is electrically connected with the traction module, and is used to receive the power and crush and flatten the soil sample collected by the detection equipment in the unknown land to obtain a flattened soil surface; a soil detection module comprises a spectrum detection unit and a calculation and control unit, and is used to perform spectrum detection on the flattened soil surface to obtain soil nutrient content, wherein the spectrum detection unit is used to perform spectrum detection on the flattened soil surface to obtain soil spectrum signals; the calculation and control unit is in communication connection with the spectrum detection unit, and is used to extract stable features from the soil spectrum signals to obtain a to-be-detected spectrum of the unknown land; the calculation and control unit is further used to perform multi-level comparison between the to-be-detected spectrum of the unknown land and a standard spectrum of a calibration land pre-stored to determine the soil nutrient content of the unknown land. The calculation and control unit is specifically used to:
2. The contrast learning based in-vehicle soil nutrient detection system of claim 1, wherein, perform first-level comparison operation on the to-be-detected spectrum of the unknown land and the standard spectrum of the calibration land based on principal component analysis to obtain a soil spectrum detection set, wherein the first-level comparison operation is used for spectrum difference elimination. The first-level comparison operation comprises:
3. The contrast learning based in-vehicle soil nutrient detection system of claim 2, wherein, The calculation and control unit is specifically used to: wherein, denotes a target feature direction, denotes a spectral feature dimension, denotes a unit vector constraint, denotes a real number space, denotes a projection of a to-be-detected spectrum of an unknown plot in a target feature direction, denotes a projection of a standard spectrum of a calibrated plot in a target feature direction, denotes a contrast intensity, denotes a soil spectral feature.
4. The contrast learning based in-vehicle soil nutrient detection system of claim 2, wherein, obtain a first soil spectrum and a second soil spectrum of the calibration land; input the first soil spectrum and the second soil spectrum into soil feature extraction networks with the same structure respectively to add Gaussian noise to obtain first soil feature variables and second soil feature variables; perform second-level comparison operation on the first soil feature variables and the second soil feature variables based on a joint loss function to obtain a to-be-detected feature set with the same shape and similar structure; construct a soil nutrient detection model based on the to-be-detected feature set. The calculation and control unit is specifically used to:
5. The contrast learning based in-vehicle soil nutrient detection system of claim 4, wherein, input the soil spectrum detection set into the soil nutrient detection model to obtain soil nutrient content of the unknown land output by the soil nutrient detection model, wherein the soil nutrient content at least includes one of soil organic matter and total nitrogen. The joint loss function comprises:
6. The contrast learning based in-vehicle soil nutrient detection system of claim 4, wherein, The method comprises the following steps: wherein, is a loss function based on cosine similarity, is a loss function based on a Gaussian kernel function and a squared Euclidean distance matrix, denotes the contrast intensity.
7. A vehicle-mounted soil nutrient detection method based on contrast learning, characterized in that, perform spectrum detection on the flattened soil surface to obtain soil nutrient content, wherein the spectrum detection on the flattened soil surface comprises: perform spectrum detection on the flattened soil surface to obtain soil spectrum signals; extract stable features from the soil spectrum signals to obtain a to-be-detected spectrum of the unknown land; perform multi-level comparison between the to-be-detected spectrum of the unknown land and a standard spectrum of a calibration land pre-stored to determine the soil nutrient content of the unknown land. The processor executes the computer program to implement the vehicle-mounted soil nutrient detection method based on contrast learning as claimed in claim 7.
8. An electronic device comprising a memory, a processor, and a computer program stored on the memory and running on the processor, characterized in that, The computer program is executed by the processor to implement the vehicle-mounted soil nutrient detection method based on contrast learning as claimed in claim 7. 9.A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, 10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to realize the vehicle-mounted soil nutrient detection method based on contrast learning as claimed in claim 7.