Corn ear quality detection method, device, system and medium
By using the object detection model to calculate the size and quality information of corn ears in corn quality detection, the problem of human experience dependence in the existing technology is solved, the objective accuracy and efficiency of the detection are improved, and the rapid compensation of agricultural insurance is promoted.
Patent Information
- Application Number
- CN202411193763.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-13
Smart Images

Figure CN119131481A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial technology, and in particular to a method, device, system and medium for detecting the quality of corn ears. Background Art
[0002] Agricultural insurance is an insurance product that provides risk protection for agricultural production. It aims to help farmers reduce economic losses caused by unforeseen factors such as natural disasters, accidents, pests and diseases, thereby stabilizing agricultural production and farmers' income.
[0003] Corn is the world's largest food crop. It is a multi-purpose crop that integrates food, feed, food processing and bioenergy applications. As an important food crop, corn is also one of the important objects of agricultural insurance. Judging the yield, quality grade, and degree of disaster during the corn harvest period is the basis for agricultural insurance compensation. At present, the quality grade and degree of disaster of corn are usually judged based on the experience of staff. Not only is it highly dependent on human experience, making the results of investigation and evaluation not objective, but it also consumes a lot of time and energy of surveyors when agricultural disasters occur, and will also delay the time limit for compensation to farmers. Therefore, evaluating corn quality based solely on human experience reduces the objective accuracy and efficiency of the evaluation, which is not conducive to achieving efficient, accurate and rapid compensation. Summary of the invention
[0004] In view of the above-mentioned deficiencies in the prior art, the object of the present invention is to provide a corn cob quality detection method, device, system and medium that can be applied to financial technology or other related fields. Its main purpose is to improve the objective accuracy and efficiency of corn cob quality detection, save manpower and material resources for investigation, and improve compensation efficiency.
[0005] The technical solution of the present invention is as follows:
[0006] A first aspect of the present invention provides a method for detecting corn ear quality, comprising:
[0007] Collecting images of a corn ear and a preset reference object to be identified, wherein the corn ear and the preset reference object are placed parallel to each other;
[0008] Inputting the image to be identified into a trained target detection model, detecting and outputting the minimum circumscribed rectangle of the corn ear and a preset reference object;
[0009] Calculating the size of the corn ear according to the minimum circumscribed rectangle of the corn ear and the preset reference object and the actual size of the preset reference object;
[0010] The variety parameter information of the corn ear is obtained, and the quality information of the corn ear is obtained by matching the size of the corn ear with the variety parameter information.
[0011] In one embodiment, before collecting the image of the corn ear and the preset reference object to be identified and placing the corn ear and the preset reference object in parallel, the method further includes:
[0012] The collection prompt information is displayed, and the collection prompt information is used to prompt the user to place the corn ears at different guiding angles to collect a plurality of images to be identified.
[0013] In one embodiment, before inputting the image to be identified into a trained target detection model and detecting and outputting the minimum circumscribed rectangle of the corn ear and a preset reference object, the method further includes:
[0014] A target detection model is constructed, and the target detection model is trained according to pre-collected training sample images with labeled contours until a preset convergence condition is met to obtain a trained target detection model.
[0015] In one embodiment, the calculating the size of the corn ear according to the minimum circumscribed rectangle of the corn ear and a preset reference object and the actual size of the preset reference object includes:
[0016] Establishing a basic coordinate axis according to the position of the minimum circumscribed rectangle of the preset reference object in the image to be identified;
[0017] Dividing the minimum circumscribed rectangle of the corn ear into a plurality of fine points, and projecting each fine point onto the basic coordinate axis, and obtaining the actual length of each projection point by scaling according to the actual size of the preset reference object;
[0018] The length of the corresponding fine point is calculated according to the actual length of each projection point and then integrated to obtain the actual length and actual width of the corn ear.
[0019] In one embodiment, before obtaining the variety parameter information of the corn ear and obtaining the quality information of the corn ear according to the size of the corn ear and the variety parameter information, the method further includes:
[0020] In response to the corn coefficient setting instruction, the corn variety and corn status input by the user are received.
[0021] In one embodiment, the acquiring the variety parameter information of the corn ear and obtaining the quality information of the corn ear according to the size of the corn ear and the matching of the variety parameter information include:
[0022] Acquire a corresponding size-quality mapping table according to the corn variety and corn state;
[0023] The size of the corn ear is matched with the size-quality mapping table to determine the quality grade of the corn ear.
[0024] In one embodiment, the target detection model is a YOLOv8 model.
[0025] A second aspect of the present invention provides a corn ear quality detection device, comprising:
[0026] A collection module, used for collecting images to be identified of corn ears and preset reference objects, wherein the corn ears and the preset reference objects are placed parallel to each other;
[0027] A target detection module, used for inputting the image to be identified into a trained target detection model, detecting and outputting the minimum circumscribed rectangle of the corn ear and a preset reference object;
[0028] A size calculation module, used for calculating the size of the corn ear according to the minimum circumscribed rectangle of the corn ear and a preset reference object and the actual size of the preset reference object;
[0029] The quality determination module is used to obtain the variety parameter information of the corn ear, and obtain the quality information of the corn ear according to the size of the corn ear and the variety parameter information.
[0030] A third aspect of the present invention provides a corn ear quality detection system, the system comprising at least one processor; and
[0031] a memory communicatively connected to the at least one processor; wherein,
[0032] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned corn ear quality detection method.
[0033] A fourth aspect of the present invention provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the one or more processors can execute the above-mentioned corn ear quality detection method.
[0034] Beneficial effects: The present invention discloses a method, device, system and medium for detecting the quality of corn cobs. Compared with the prior art, the embodiments of the present invention collect images of corn cobs and preset reference objects to be identified, and the corn cobs and the preset reference objects are placed in parallel; the images to be identified are input into a trained target detection model, and the minimum circumscribed rectangle of the corn cobs and the preset reference objects is detected and output; the size of the corn cobs is calculated based on the minimum circumscribed rectangle of the corn cobs and the preset reference objects and the actual size of the preset reference objects; the variety parameter information of the corn cobs is obtained, and the quality information of the corn cobs is obtained by matching the size of the corn cobs with the variety parameter information. The size of the corn is calculated by collecting and automatically detecting the rectangular frame of the corn cobs and the preset reference objects in the image, and then the quality information of the corn cobs is objectively evaluated in combination with the variety parameter information, which effectively improves the objective accuracy and efficiency of corn quality detection, saves manpower and material resources for investigation, and improves the efficiency of compensation. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:
[0036] Figure 1 A flow chart of a corn ear quality detection method provided by an embodiment of the present invention;
[0037] Figure 2 A flow chart of step S103 in the corn ear quality detection method provided in an embodiment of the present invention;
[0038] Figure 3 A flow chart of step S104 in the corn ear quality detection method provided by an embodiment of the present invention;
[0039] Figure 4 A schematic diagram of the functional modules of a corn ear quality detection device provided by an embodiment of the present invention;
[0040] Figure 5 A schematic diagram of the hardware structure of a corn ear quality detection system provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail below. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. The embodiments of the present invention are described below in conjunction with the accompanying drawings.
[0042] Agricultural insurance is an insurance product that provides risk protection for agricultural production. It aims to help farmers reduce economic losses caused by unforeseen factors such as natural disasters, accidents, pests and diseases, thereby stabilizing agricultural production and farmers' income.
[0043] Corn is the world's largest food crop. It is a multi-purpose crop that integrates food, feed, food processing and bioenergy applications. As an important food crop, corn is also one of the important objects of agricultural insurance. Judging the yield, quality grade, and degree of disaster during the corn harvest period is the basis for agricultural insurance compensation. At present, the quality grade and degree of disaster of corn are usually judged based on the experience of staff. Not only is it highly dependent on human experience, making the results of investigation and evaluation not objective, but it also consumes a lot of time and energy of surveyors when agricultural disasters occur, and will also delay the time limit for compensation to farmers. Therefore, evaluating corn quality based solely on human experience reduces the objective accuracy and efficiency of the evaluation, which is not conducive to achieving efficient, accurate and rapid compensation.
[0044] In order to solve the above problems, the present invention proposes a method for detecting corn ear quality. Figure 1 , Figure 1 A flowchart of an embodiment of a corn ear quality detection method provided by the present invention. The system architecture of the corn ear quality detection method provided in this embodiment may include a first terminal device, a second terminal device, a third terminal device, a network and a server. The network is used to provide a medium for a communication link between the first terminal device, the second terminal device, the third terminal device and the server. The network may include various connection types, such as wired and / or wireless communication links, etc.
[0045] The user may use the first terminal device, the second terminal device, and the third terminal device to interact with the server through the network to receive or send messages, etc. Various communication client applications may be installed on the first terminal device, the second terminal device, and the third terminal device, such as knowledge reading applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software, etc. (only as examples).
[0046] The first terminal device, the second terminal device, and the third terminal device may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0047] The server may be a server that provides various services, such as a background management server that provides support for the content browsed by the user using the first terminal device, the second terminal device, and the third terminal device (for example only). The background management server may analyze and process the received data such as the user request, and feed back the processing results (such as web pages, information, or data obtained or generated according to the user request) to the terminal device. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server for a distributed system, or a server combined with a blockchain.
[0048] It should be noted that the corn ear quality detection method provided in the embodiment of the present invention can generally be executed by the first terminal device, the second terminal device or the third terminal device. Correspondingly, the corn ear quality detection device provided in the embodiment of the present invention can also be set in the first terminal device, the second terminal device or the third terminal device.
[0049] Alternatively, the corn ear quality detection method provided by the embodiment of the present invention can also be generally performed by a server. Accordingly, the corn ear quality detection device provided by the embodiment of the present invention can generally be arranged in a server. The corn ear quality detection method provided by the embodiment of the present invention can also be performed by a server or server cluster that is different from the server and can communicate with the first terminal device, the second terminal device, the third terminal device and / or the server. Correspondingly, the corn ear quality detection device provided by the embodiment of the present invention can also be arranged in a server or server cluster that is different from the server and can communicate with the first terminal device, the second terminal device, the third terminal device and / or the server.
[0050] It should be understood that the numbers of the above terminal devices, networks and servers are only illustrative. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0051] like Figure 1 As shown, the corn ear quality detection method provided in this embodiment specifically includes the following steps:
[0052] S101, collecting images of a corn ear and a preset reference object to be identified, wherein the corn ear and the preset reference object are placed parallel to each other.
[0053] In this embodiment, the surveyor can collect an image to be identified that includes the corn ears to be detected and a preset reference object through a mobile terminal such as a smart phone. The specific preset reference object is a rectangular object with a uniform and known size, such as an ID card or other easily obtained and easily detected objects, which is not limited in this embodiment. Taking the ID card as the preset reference object as an example, the surveyor places the corn ears to be detected and the ID card in parallel on a stable plane, turns on the camera of the mobile terminal, and takes a complete photo of the corn ears and the ID card in one picture, and then collects the image to be identified. The pixel size of the mutually parallel corn ears and the preset reference object in the image to be identified is used for the subsequent corn ear size estimation. Specifically, one image to be identified can be collected to achieve rapid detection, or multiple images to be identified can be collected to improve detection accuracy, which is not limited in this embodiment.
[0054] In one embodiment, before collecting the image of the corn ear and the preset reference object to be identified and placing the corn ear and the preset reference object in parallel, the method further includes:
[0055] The collection prompt information is displayed, and the collection prompt information is used to prompt the user to place the corn ears at different guiding angles to collect a plurality of images to be identified.
[0056] In this embodiment, before shooting the image to be identified, corresponding collection prompt information is also displayed on the display interface of the mobile terminal. The collection prompt information is used to prompt the user to place the corn cob at different guiding angles to collect several images to be identified. The collection prompt information can be displayed all at once or in steps according to the collection process. For example, when the surveyor calls the camera for collection through the APP of the mobile terminal, the collection prompt information of "Please take a complete photo of the corn at any angle" can be displayed first, so that the surveyor can turn any side of the corn cob upwards and place the corn cob parallel to the ID card, and take a complete photo of the corn cob and the ID card in one picture to collect an image to be identified. Then, the collection prompt information of "Please turn the side of the corn close to the ground upwards and take a complete photo of the corn again" is output, so that the surveyor can turn the side of the corn cob close to the ground upwards, and take a complete photo of the corn cob and the ID card again in one picture, and collect another image to be identified at a different angle. The specific collection prompt information can be flexibly set according to needs. For example, it can also prompt to collect a cross-sectional image of the corn cob, etc. This embodiment is not limited to this.
[0057] Preferably, during the collection process of the surveyors, the shooting status can be automatically checked and prompted, for example, whether the mobile terminal is kept level. If it is not kept level, the collection prompt message of "Please keep it level" is displayed; if the deviation angle of the mobile terminal is too large, for example, greater than 15°, the collection prompt message of "The angle deviation is too large and cannot be photographed" can be further displayed; at the same time, the parallelism between the corn ear and the preset reference object in the picture can be detected. If the parallelism exceeds the preset range, it indicates that the position between the two needs to be adjusted at this time, and try to keep them parallel to improve the detection accuracy. Therefore, the collection prompt message of "Please adjust the position of the corn to keep it parallel to the reference object" can be displayed. Through real-time detection and output of the collection prompt information, it is ensured that the collected image to be identified meets the requirements required for detection, thereby improving the accuracy and reliability of corn ear quality detection.
[0058] S102, inputting the image to be identified into a trained target detection model, detecting and outputting the minimum circumscribed rectangle of the corn ear and a preset reference object;
[0059] In this embodiment, the image to be identified is subjected to computer vision instance segmentation and detection by a pre-trained target detection model, each individual instance in the image is identified, and a category label and a pixel-level mask are assigned to each of them, so as to determine the position and outline of corn and a preset reference object in the image to be identified, and output the minimum circumscribed rectangle of corn ears and preset reference objects in the image to be identified. Specifically, after the image to be identified is input into the target detection model, the model first determines the area in the image that may contain the target object, and then for each candidate area, a deep learning model (such as a convolutional neural network, CNN) is used to extract features. These features will then be used for classification and mask prediction; the model classifies each candidate area to determine whether it contains a specific category, i.e., corn and a preset reference object; if the candidate area contains an object of a specific category, the model further predicts the bounding box of the object, performs minimum circumscribed rectangle segmentation, and then determines the precise position of corn and the preset reference object in the image, and provides a reliable reference basis for the subsequent automatic estimation of the size of corn based on the rectangular frame outline of the automatically marked corn ear and the rectangular frame outline of the preset reference object.
[0060] Specifically, the target detection model is a YOLOv8 model, which is a deep learning model for target detection. In this embodiment, it is used to detect corn ears and preset reference objects and perform minimum circumscribed rectangle segmentation. It adopts an Anchor-Free detection method, which improves detection accuracy and speed compared to the traditional Anchor-Based detection method. The main features and improvements of YOLOv8 include:
[0061] 1. The feature extraction network uses a network structure called CSPDarknet and adopts the Cross Stage Partial Network (CSP) structure. It is divided into two parts, each of which contains multiple residual blocks, which effectively reduces the number of parameters and calculations of the model while improving the efficiency of feature extraction.
[0062] 2. The target detection head adopts the YOLOv4-Head detection head structure, which contains multiple convolutional layers and pooling layers to process and compress feature maps, and then converts them into target detection results through multiple convolutional layers and fully connected layers;
[0063] 3. Loss function, use BCE loss (binary cross entropy loss) for classification, and DFLLoss (Distribution Focal Loss) + CIoU Loss (Complete Intersection-over-Union Loss) for regression loss;
[0064] 4. Label allocation, using Task-Aligned Assigner matching method, abandoning the previous IOU matching or unilateral ratio allocation method;
[0065] 5. Mode diversity, YOLOv8 is not limited to the YOLO series models, but can also support non-YOLO models and tasks such as classification, segmentation, and pose estimation. It supports multiple modes, including training mode, verification mode, prediction mode, export mode, tracking mode, and benchmark mode, which are suitable for the entire machine learning model life cycle from data reception, model training to verification, deployment, and real-world tracking.
[0066] In one embodiment, before inputting the image to be identified into a trained target detection model and detecting and outputting the minimum circumscribed rectangle of the corn ear and a preset reference object, the method further includes:
[0067] A target detection model is constructed, and the target detection model is trained according to pre-collected training sample images with labeled contours until a preset convergence condition is met to obtain a trained target detection model.
[0068] In this embodiment, a target detection model, namely a YOLOv8 model, is pre-constructed and deep learning training is performed. Specifically, the deep learning model is trained by a large number of training samples collected in advance. For example, images of corn ears and preset reference objects of different varieties and states are collected, and the contours of objects in the images are annotated in advance. For example, the SAM model can be used to automatically annotate the rectangular frame contours of the corn ears and the contours of the preset reference objects in the images. The training sample images with the annotated information are input into the target detection model, and training is performed under the supervision of a loss function. The model weight parameters are adjusted by back propagation based on the model output until preset convergence conditions are met, such as the value of the loss function is less than a preset value, or the number of training times is greater than a preset number, etc. The current weight parameters are saved as the final trained target detection model for target contour detection in corn ear quality detection.
[0069] S103, calculating the size of the corn ear according to the minimum circumscribed rectangle of the corn ear and a preset reference object and the actual size of the preset reference object.
[0070] In this embodiment, after the minimum circumscribed rectangle of the corn ear and the preset reference object in the image to be identified is detected by the target detection model, since the actual size of the preset reference object is known, for example, the actual size of the reference object is measured in advance, or a preset reference object of standard size is used, etc., based on the minimum circumscribed rectangle of the corn ear and the preset reference object and the actual size of the preset reference object, the size of the corn ear can be calculated by scale conversion, so that the reliable and accurate size of the corn ear can be automatically calculated by simply collecting the image, providing a reliable data basis for evaluating the quality of corn ears.
[0071] In one embodiment, Figure 2 As shown, the size of the corn ear is calculated based on the minimum circumscribed rectangle of the corn ear and the preset reference object and the actual size of the preset reference object, including:
[0072] S201, establishing a basic coordinate axis according to the position of the minimum circumscribed rectangle of the preset reference object in the image to be identified;
[0073] S202, dividing the minimum circumscribed rectangle of the corn ear into a plurality of fine points, and projecting each fine point onto the basic coordinate axis, and obtaining the actual length of each projection point by scaling according to the actual size of the preset reference object;
[0074] S203, calculating the length of the corresponding fine point according to the actual length of each projection point and integrating the calculated length to obtain the actual length and the actual width of the corn ear.
[0075] In this embodiment, due to certain distortion when taking images with a mobile phone, parallel lines will have an intersection at infinity, and two sets of opposite sides of a preset reference object will have an intersection at infinity. In order to improve the accuracy of size calculation, the length requirement is relaxed by using Riemann integral to calculate the length. When the corn ear and the preset reference object are not completely parallel or there is distortion, the size of the corn ear can be estimated as accurately as possible.
[0076] Specifically, a basic coordinate axis is established according to the position of the minimum circumscribed rectangle of the preset reference object in the image to be identified. For example, the left and bottom sides are recorded as the ordinate du and the abscissa dv, respectively, and this is used as the basic coordinate axis. Based on the established basic coordinate axis, for each pixel point in the image, the pixel length of each pixel point projected onto the basic coordinate axis can be estimated by using the parallel and proportional method, thereby estimating the ordinate projection corresponding to each pixel point. and the actual length of the horizontal axis projection Therefore, for the length and width of the corn ear, the minimum circumscribed rectangle on the minimum circumscribed rectangle of the corn ear can be divided into multiple fine points, and each fine point is projected onto the above-mentioned basic coordinate axis. The actual length of each fine point on the basic coordinate axis is obtained by scale transformation according to the actual size of the preset reference object. Specifically, only each fine point on the length and width of the minimum circumscribed rectangle can be projected to save calculation amount, and then the actual length of each fine point is calculated according to the actual length of the two projection points corresponding to each fine point. The actual length of the fine point is integrated By setting the corresponding integration range according to the projection area of the length and width of the corn ear on the basic coordinate axis, the actual length and actual width of the corn ear can be calculated. Calculating the actual length and actual width of the corn ear by integration can effectively eliminate the errors in size calculation caused by factors such as parallelism and camera distortion, and improve the accuracy of corn ear calculation.
[0077] S104, obtaining the variety parameter information of the corn ear, and obtaining the quality information of the corn ear by matching the size of the corn ear with the variety parameter information.
[0078] In this embodiment, after the size of the corn ear is automatically calculated, the quality parameter information of the corn ear currently being evaluated, such as variety name, variety shape, variety standard size and other parameters, is obtained, and the size of the corn ear automatically and objectively detected is matched with the corresponding variety parameter information. By objectively comparing the actual size of the corn ear and the variety parameter information, the quality information of the corn ear is evaluated, such as whether the quality of the corn ear currently being evaluated is qualified, whether it is of excellent quality, etc., so that the quality of the corn ear can be automatically and objectively detected by collecting images, which effectively improves the objective accuracy and efficiency of corn quality detection, saves manpower and material resources for investigation, and improves compensation efficiency.
[0079] In one embodiment, before obtaining the variety parameter information of the corn ear and obtaining the quality information of the corn ear according to the size of the corn ear and the variety parameter information, the method further includes:
[0080] In response to the corn coefficient setting instruction, the corn variety and corn status input by the user are received.
[0081] In this embodiment, after collecting the image to be identified, the surveyor can click the preset variety setting button on the page to trigger the corn coefficient setting instruction. After entering the corn coefficient setting page, the surveyor can select or enter coefficients such as corn variety and corn state, where corn state includes fresh corn and stored corn. Fresh corn is corn just broken off the corn plant, and stored corn is corn with a lower moisture content after harvesting and drying. Different corn varieties will have different sizes in the same state, and the same variety will also have different sizes in different states. Therefore, by collecting coefficients such as corn variety and state, reliable reference information is provided for subsequent quality evaluation to maximize the objectivity and accuracy of the evaluation.
[0082] In one embodiment, Figure 3 As shown, the obtaining of the variety parameter information of the corn ear and obtaining the quality information of the corn ear according to the size of the corn ear and the matching of the variety parameter information include:
[0083] Acquire a corresponding size-quality mapping table according to the corn variety and corn state;
[0084] The size of the corn ear is matched with the size-quality mapping table to determine the quality grade of the corn ear.
[0085] In this embodiment, a corresponding size-quality mapping table is obtained based on the received corn variety and corn state. The size-quality mapping table stores the corresponding relationship between the size and quality of a certain corn variety in the corresponding corn state. For example, for corn variety A in the fresh corn state, when the size falls within range 1, it corresponds to low quality, when the size falls within range 2, it corresponds to medium quality, when the size falls within range 3, it corresponds to high quality, and so on. For example, the Dongdan 1331 variety has short conical ears, with an ear length of 20.6 cm and an ear thickness of 4.9 cm. If the photographed corn ear is 20 cm long and 5 cm wide (thick), it indicates that the corn cob is of high quality. If the photographed corn ear is 10 cm long and 3 cm wide (thick), it indicates that the corn cob is of poor quality, thereby converting the quality evaluation into quantitative information associated with the variety and state. After the size of the corn ear is automatically detected and calculated, it can be matched with the retrieved size-quality mapping table to output the quality grade of the corn ear efficiently, quickly and objectively.
[0086] The corn cob quality detection method provided by the embodiment of the present invention can accurately calculate the length and width of the corn cob based on the instance segmentation model of computer vision by simply taking pictures, quickly identify the length and width of a single corn cob in milliseconds, and calculate the fullness and quality grade of corn according to the corn variety and corn state (fresh corn, stored corn). Compared with the original reliance on human subjective judgment, the operation is simple, convenient and objective, saving a lot of manpower and material resources. Through the built-in corn variety characteristic data, the quality state of corn can be easily obtained, which is convenient for subsequent yield estimation and measurement, providing an efficient and convenient assessment method for disaster investigation.
[0087] It should be noted that there is not necessarily a certain order between the above-mentioned steps. A person skilled in the art can understand, based on the description of the embodiments of the present invention, that in different embodiments, the above-mentioned steps may have different execution orders, that is, they may be executed in parallel, may be executed interchangeably, and so on.
[0088] Another embodiment of the present invention provides a corn ear quality detection device, such as Figure 4 As shown, the device 1 comprises:
[0089] A collection module 11 is used to collect images of corn ears and preset reference objects to be identified, wherein the corn ears and the preset reference objects are placed parallel to each other;
[0090] The target detection module 12 is used to input the image to be identified into a trained target detection model, detect and output the minimum circumscribed rectangle of the corn ear and a preset reference object;
[0091] A size calculation module 13, configured to calculate the size of the corn ear according to the minimum circumscribed rectangle of the corn ear and a preset reference object and the actual size of the preset reference object;
[0092] The quality determination module 14 is used to obtain the variety parameter information of the corn ear, and obtain the quality information of the corn ear according to the size of the corn ear and the variety parameter information.
[0093] The module referred to in the present invention refers to a series of computer program instruction segments that can perform specific functions, which are more suitable for describing the execution process of corn cob quality detection than programs. For the specific implementation methods of each module, please refer to the corresponding method embodiments above, which will not be repeated here.
[0094] In one embodiment, the device 1 further comprises:
[0095] The display module is used to display collection prompt information, wherein the collection prompt information is used to prompt the user to place the corn ears at different guiding angles to collect a number of images to be identified.
[0096] In one embodiment, the device 1 further comprises:
[0097] The model training module is used to build a target detection model, and train the target detection model according to the training sample images that have been collected in advance and have their contours annotated, until a trained target detection model is obtained after a preset convergence condition is met.
[0098] In one embodiment, the size calculation module 13 includes:
[0099] A coordinate axis establishing unit, used to establish a basic coordinate axis according to the position of the minimum circumscribed rectangle of the preset reference object in the image to be identified;
[0100] A projection unit, used for dividing the minimum circumscribed rectangle of the corn ear into a plurality of fine points, and projecting each fine point onto the basic coordinate axis, and obtaining the actual length of each projection point through a scale transformation according to the actual size of the preset reference object;
[0101] The size calculation unit is used to calculate the length of the corresponding fine point according to the actual length of each projection point and then integrate it to obtain the actual length and actual width of the corn ear.
[0102] In one embodiment, the device 1 further comprises:
[0103] The parameter setting module is used to respond to the corn coefficient setting instruction and receive the corn variety and corn status input by the user.
[0104] In one embodiment, the quality determination module 14 includes:
[0105] An acquisition unit, used for acquiring a corresponding size-quality mapping table according to the corn variety and corn state;
[0106] The quality matching unit is used to match the size of the corn ear with the size-quality mapping table to determine the quality grade of the corn ear.
[0107] In one embodiment, the target detection model is a YOLOv8 model.
[0108] Another embodiment of the present invention provides a corn ear quality detection system. Figure 5 As shown, the system 10 includes:
[0109] One or more processors 110 and memory 120, Figure 5 A processor 110 is used as an example for description. The processor 110 and the memory 120 may be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.
[0110] The processor 110 is used to complete various control logics of the system 10, and it can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISC Machine) or other programmable logic device, a discrete gate or transistor logic, a discrete hardware component, or any combination of these components. In addition, the processor 110 can also be any traditional processor, microprocessor or state machine. The processor 110 can also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a DSP and / or any other such configuration.
[0111] The memory 120 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions corresponding to the corn ear quality detection method in the embodiment of the present invention. The processor 110 executes various functional applications and data processing of the system 10 by running the non-volatile software programs, instructions and units stored in the memory 120, that is, the corn ear quality detection method in the above method embodiment is implemented.
[0112] The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function; the data storage area may store data created according to the use of the system 10, etc. In addition, the memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 120 may optionally include a memory remotely arranged relative to the processor 110, and these remote memories may be connected to the system 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0113] One or more units are stored in the memory 120, and when executed by one or more processors 110, the corn ear quality detection method in any of the above method embodiments is executed, for example, the following steps are executed:
[0114] Collecting images of a corn ear and a preset reference object to be identified, wherein the corn ear and the preset reference object are placed parallel to each other;
[0115] Inputting the image to be identified into a trained target detection model, detecting and outputting the minimum circumscribed rectangle of the corn ear and a preset reference object;
[0116] Calculating the size of the corn ear according to the minimum circumscribed rectangle of the corn ear and the preset reference object and the actual size of the preset reference object;
[0117] The variety parameter information of the corn ear is obtained, and the quality information of the corn ear is obtained by matching the size of the corn ear with the variety parameter information.
[0118] In one embodiment, before collecting the image of the corn ear and the preset reference object to be identified and placing the corn ear and the preset reference object in parallel, the method further includes:
[0119] The collection prompt information is displayed, and the collection prompt information is used to prompt the user to place the corn ears at different guiding angles to collect a plurality of images to be identified.
[0120] In one embodiment, before inputting the image to be identified into a trained target detection model and detecting and outputting the minimum circumscribed rectangle of the corn ear and a preset reference object, the method further includes:
[0121] A target detection model is constructed, and the target detection model is trained according to pre-collected training sample images with labeled contours until a preset convergence condition is met to obtain a trained target detection model.
[0122] In one embodiment, the calculating the size of the corn ear according to the minimum circumscribed rectangle of the corn ear and a preset reference object and the actual size of the preset reference object includes:
[0123] Establishing a basic coordinate axis according to the position of the minimum circumscribed rectangle of the preset reference object in the image to be identified;
[0124] Dividing the minimum circumscribed rectangle of the corn ear into a plurality of fine points, and projecting each fine point onto the basic coordinate axis, and obtaining the actual length of each projection point by scaling according to the actual size of the preset reference object;
[0125] The length of the corresponding fine point is calculated according to the actual length of each projection point and then integrated to obtain the actual length and actual width of the corn ear.
[0126] In one embodiment, before obtaining the variety parameter information of the corn ear and obtaining the quality information of the corn ear according to the size of the corn ear and the variety parameter information, the method further includes:
[0127] In response to the corn coefficient setting instruction, the corn variety and corn status input by the user are received.
[0128] In one embodiment, the acquiring the variety parameter information of the corn ear and obtaining the quality information of the corn ear according to the size of the corn ear and the matching of the variety parameter information include:
[0129] Acquire a corresponding size-quality mapping table according to the corn variety and corn state;
[0130] The size of the corn ear is matched with the size-quality mapping table to determine the quality grade of the corn ear.
[0131] In one embodiment, the target detection model is a YOLOv8 model.
[0132] An embodiment of the present invention provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the corn ear quality detection method in any of the above method embodiments is executed, for example, the following steps are performed:
[0133] Collecting images of a corn ear and a preset reference object to be identified, wherein the corn ear and the preset reference object are placed parallel to each other;
[0134] Inputting the image to be identified into a trained target detection model, detecting and outputting the minimum circumscribed rectangle of the corn ear and a preset reference object;
[0135] Calculating the size of the corn ear according to the minimum circumscribed rectangle of the corn ear and the preset reference object and the actual size of the preset reference object;
[0136] The variety parameter information of the corn ear is obtained, and the quality information of the corn ear is obtained by matching the size of the corn ear with the variety parameter information.
[0137] In one embodiment, before collecting the image of the corn ear and the preset reference object to be identified and placing the corn ear and the preset reference object in parallel, the method further includes:
[0138] The collection prompt information is displayed, and the collection prompt information is used to prompt the user to place the corn ears at different guiding angles to collect a plurality of images to be identified.
[0139] In one embodiment, before inputting the image to be identified into a trained target detection model and detecting and outputting the minimum circumscribed rectangle of the corn ear and a preset reference object, the method further includes:
[0140] A target detection model is constructed, and the target detection model is trained according to pre-collected training sample images with labeled contours until a preset convergence condition is met to obtain a trained target detection model.
[0141] In one embodiment, the calculating the size of the corn ear according to the minimum circumscribed rectangle of the corn ear and a preset reference object and the actual size of the preset reference object includes:
[0142] Establishing a basic coordinate axis according to the position of the minimum circumscribed rectangle of the preset reference object in the image to be identified;
[0143] Dividing the minimum circumscribed rectangle of the corn ear into a plurality of fine points, and projecting each fine point onto the basic coordinate axis, and obtaining the actual length of each projection point by scaling according to the actual size of the preset reference object;
[0144] The length of the corresponding fine point is calculated according to the actual length of each projection point and then integrated to obtain the actual length and actual width of the corn ear.
[0145] In one embodiment, before obtaining the variety parameter information of the corn ear and obtaining the quality information of the corn ear according to the size of the corn ear and the variety parameter information, the method further includes:
[0146] In response to the corn coefficient setting instruction, the corn variety and corn status input by the user are received.
[0147] In one embodiment, the acquiring the variety parameter information of the corn ear and obtaining the quality information of the corn ear according to the size of the corn ear and the matching of the variety parameter information include:
[0148] Acquire a corresponding size-quality mapping table according to the corn variety and corn state;
[0149] The size of the corn ear is matched with the size-quality mapping table to determine the quality grade of the corn ear.
[0150] In one embodiment, the target detection model is a YOLOv8 model.
[0151] As an example, non-volatile storage media can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) as external cache memory. By way of illustration and not limitation, RAM can be obtained in many forms such as synchronous RAM (SRAM), dynamic RAM, (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The disclosed memory components or memories of the operating environment described herein are intended to include one or more of these and / or any other suitable types of memory.
[0152] In summary, the present invention discloses a method, device, system and medium for detecting the quality of corn cobs, the method comprising: collecting images of corn cobs and preset reference objects to be identified, the corn cobs and the preset reference objects being placed in parallel; inputting the images to be identified into a trained target detection model, detecting and outputting the minimum circumscribed rectangle of the corn cobs and the preset reference objects; calculating the size of the corn cobs according to the minimum circumscribed rectangle of the corn cobs and the preset reference objects and the actual size of the preset reference objects; obtaining the variety parameter information of the corn cobs, and obtaining the quality information of the corn cobs according to the size of the corn cobs and the variety parameter information. The corn size is calculated by collecting and automatically detecting the rectangular frame of the corn cobs and the preset reference objects in the image, and then objectively evaluating the quality information of the corn cobs in combination with the variety parameter information, which effectively improves the objective accuracy and efficiency of corn quality detection, saves manpower and material resources for investigation, and improves the efficiency of compensation.
[0153] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium, and the computer program can include the processes of the above-mentioned method embodiments when executed. The storage medium can be a memory, a disk, a floppy disk, a flash memory, an optical storage device, etc.
[0154] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.
Claims
1. A method for detecting corn ear quality, characterized in that: include: Collecting images of a corn ear and a preset reference object to be identified, wherein the corn ear and the preset reference object are placed parallel to each other; Inputting the image to be identified into a trained target detection model, detecting and outputting the minimum circumscribed rectangle of the corn ear and a preset reference object; Calculating the size of the corn ear according to the minimum circumscribed rectangle of the corn ear and the preset reference object and the actual size of the preset reference object; The variety parameter information of the corn ear is obtained, and the quality information of the corn ear is obtained by matching the size of the corn ear with the variety parameter information.
2. The corn ear quality detection method according to claim 1, characterized in that: Before collecting the images of the corn ear and the preset reference object to be identified and placing the corn ear and the preset reference object in parallel, the method further includes: The collection prompt information is displayed, and the collection prompt information is used to prompt the user to place the corn ears at different guiding angles to collect a plurality of images to be identified.
3. The corn ear quality detection method according to claim 1, characterized in that: Before inputting the image to be identified into the trained target detection model and detecting and outputting the minimum circumscribed rectangle of the corn ear and the preset reference object, the method further includes: A target detection model is constructed, and the target detection model is trained according to pre-collected training sample images with labeled contours until a preset convergence condition is met to obtain a trained target detection model.
4. The method for detecting corn ear quality according to claim 1, characterized in that: The step of calculating the size of the corn ear according to the minimum circumscribed rectangle of the corn ear and the preset reference object and the actual size of the preset reference object comprises: Establishing a basic coordinate axis according to the position of the minimum circumscribed rectangle of the preset reference object in the image to be identified; Dividing the minimum circumscribed rectangle of the corn ear into a plurality of fine points, and projecting each fine point onto the basic coordinate axis, and obtaining the actual length of each projection point by scaling according to the actual size of the preset reference object; The length of the corresponding fine point is calculated according to the actual length of each projection point and then integrated to obtain the actual length and actual width of the corn ear.
5. The method for detecting corn ear quality according to claim 3, characterized in that: Before obtaining the variety parameter information of the corn ear and obtaining the quality information of the corn ear according to the size of the corn ear and the variety parameter information, the method further includes: In response to the corn coefficient setting instruction, the corn variety and corn status input by the user are received.
6. The method for detecting corn ear quality according to claim 5, characterized in that: The step of obtaining the variety parameter information of the corn ear and obtaining the quality information of the corn ear according to the size of the corn ear and the variety parameter information includes: Acquire a corresponding size-quality mapping table according to the corn variety and corn state; The size of the corn ear is matched with the size-quality mapping table to determine the quality grade of the corn ear.
7. The method for detecting corn ear quality according to any one of claims 1 to 6, characterized in that: The target detection model is the YOLOv8 model.
8. A corn ear quality detection device, characterized in that: include: A collection module, used for collecting images to be identified of corn ears and preset reference objects, wherein the corn ears and the preset reference objects are placed parallel to each other; A target detection module, used for inputting the image to be identified into a trained target detection model, detecting and outputting the minimum circumscribed rectangle of the corn ear and a preset reference object; A size calculation module, used for calculating the size of the corn ear according to the minimum circumscribed rectangle of the corn ear and a preset reference object and the actual size of the preset reference object; The quality determination module is used to obtain the variety parameter information of the corn ear, and obtain the quality information of the corn ear according to the size of the corn ear and the variety parameter information.
9. A corn ear quality detection system, characterized in that: The system includes at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the corn ear quality detection method described in any one of claims 1-7.
10. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, which, when executed by one or more processors, enable the one or more processors to execute the corn ear quality detection method described in any one of claims 1-7.
Citation Information
Cited By
Method and device for detecting appearance quality of fresh corn ears
CN120107956A
A method and apparatus for detecting the appearance quality of fresh corn ears
CN120107956B
