CN117475233A - Method, device, equipment and computer storage medium for detecting abnormal state of gland - Google Patents

Method, device, equipment and computer storage medium for detecting abnormal state of gland Download PDF

Info

Publication number
CN117475233A
CN117475233A CN202311502504.9A CN202311502504A CN117475233A CN 117475233 A CN117475233 A CN 117475233A CN 202311502504 A CN202311502504 A CN 202311502504A CN 117475233 A CN117475233 A CN 117475233A
Authority
CN
China
Prior art keywords
gland
detected
detection result
state
bottle cap
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311502504.9A
Other languages
Chinese (zh)
Inventor
唐尚华
林义闽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China United Network Communications Group Co Ltd
Unicom Digital Technology Co Ltd
Original Assignee
China United Network Communications Group Co Ltd
Unicom Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China United Network Communications Group Co Ltd, Unicom Digital Technology Co Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN202311502504.9A priority Critical patent/CN117475233A/en
Publication of CN117475233A publication Critical patent/CN117475233A/en
Pending legal-status Critical Current

Links

Landscapes

  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

The application provides a method, a device, equipment and a computer storage medium for detecting abnormal states of a gland, and particularly relates to the technical field of detection. The method comprises the steps of obtaining a gland image of an object to be detected through a shooting device. Inputting the gland image into a gland detection model to obtain a first detection result of an object to be detected, wherein the first detection result comprises: abnormal state, normal state, blank drawing and no cover state, the gland detection model is trained according to the historical gland image set and the corresponding gland state. When the first detection result is in an abnormal state, an empty chart or a non-cover state, generating alarm information, wherein the alarm information is used for indicating that the object to be detected is abnormal. The method has the advantages that the original production line is changed minimally, at least one shooting device is newly added at the left and right of the production line, and the image acquisition is automatically triggered when the bottle passes. The whole process realizes full-automatic processing, utilizes the original production line, improves the effect of the algorithm and reduces manual intervention.

Description

Method, device, equipment and computer storage medium for detecting abnormal state of gland
Technical Field
The present disclosure relates to the field of detection technologies, and in particular, to a method, an apparatus, a device, and a computer storage medium for detecting an abnormal state of a gland.
Background
The gland state detection is a process of automatically detecting the bottle cap on a production line and is used for ensuring the quality and the safety of the bottle cap. In the food industry, poor tightness of the bottle cap may cause external pollution to the food, so that the food is damaged and cannot be eaten; in the pharmaceutical industry, the tightness of the drug is critical to ensure efficacy of the drug and to avoid contamination, and effective capping state detection can avoid volatilization of the drug.
In the canning industry, partial quality inspection of the gland state is completed manually, a quality inspector is positioned around a production line, detects the gland state by means of eyes, and manually eliminates canning objects with abnormal gland. Part of enterprises realize gland abnormality detection and rejection by improving a production line and adding hardware rejection equipment, and the equipment for detecting the gland state and the rejection equipment are added on the basis of the original production line, so that the requirements on production technology are high.
In the existing method technology, a part of enterprises adopt a mode of manually detecting and judging hardware rejection, the mode has high concentration requirements on workers, and has requirements on production line speed, and workers are not too fast and easy to miss after fatigue. The other part of enterprises adopts a gland defect detection device, which is realized by a hardware mode and aims at screening and rejecting different gland locking conditions, thereby improving the overall detection precision. This approach requires a partial modification of the production line and the screening is relatively single. For example, the function of detecting and removing images with different sizes and heights of bottle caps or other middle parts with normal heights and breakage and the like cannot be achieved.
Disclosure of Invention
The application provides a detection method, a detection device, detection equipment and a computer storage medium for detecting abnormal gland states, which are used for solving the problems that the detection omission and false detection easily occur in the gland state judging process of bottled objects on a production line.
In a first aspect, the present application provides a method for detecting an abnormal state of a gland, including:
acquiring a gland image of an object to be detected through a shooting device;
inputting the gland image to a gland detection model to obtain a first detection result of the object to be detected, wherein the first detection result comprises: the gland detection model is trained according to a historical gland image set and a corresponding gland state;
and when the first detection result is in an abnormal state, an empty chart or a non-cover state, generating alarm information, wherein the alarm information is used for indicating that the object to be detected is abnormal.
Optionally, before the capturing device obtains the capping image of the object to be detected, the method further includes:
acquiring a historical capping image set shot by the shooting device and a real capping state corresponding to each historical capping image;
And training the deep learning pre-training model according to the historical gland image set and the real gland state corresponding to each historical gland image to obtain the gland detection model.
Optionally, the method further comprises:
when the first detection result is in a normal state, extracting a target area from the gland image, wherein the target area comprises a cover edge and a cover of the object to be detected;
performing color segmentation processing, morphological processing and contour detection processing on the target area to obtain a bottle cap contour and a cap edge contour of the object to be detected, wherein the bottle cap contour is the maximum circumscribed rectangular contour of the bottle cap;
determining a second detection result of the object to be detected according to the bottle cap outline and the cap edge outline, wherein the second detection result comprises: normal and abnormal states;
and when the second detection result is in an abnormal state, generating the alarm information, wherein the alarm information is used for indicating that the object to be detected is abnormal.
Optionally, the determining, according to the bottle cap profile and the cap edge profile, the second detection result of the object to be detected includes:
Determining the top coordinate of the bottle cap according to the bottle cap profile, wherein the top coordinate is the coordinate with the highest ordinate value in the bottle cap profile;
taking the central points of two cover edges in the cover edge profile as the bottom coordinates of the bottle cap;
determining the pixel height of the object to be detected according to the top coordinate and the bottom coordinate;
determining the pixel width of the bottle cap according to the positions of two bottle cap edges in the bottle cap outline;
obtaining a pixel aspect ratio according to the pixel height and the pixel width;
and determining a second detection result of the object to be detected according to the pixel aspect ratio and a preset aspect ratio.
Optionally, the determining the second detection result of the object to be detected according to the pixel aspect ratio and the preset aspect ratio includes:
judging whether the pixel aspect ratio is matched with the preset aspect ratio;
determining that the second detection result is in a normal state when the pixel aspect ratio is matched with the preset aspect ratio;
and when the pixel aspect ratio is not matched with the preset aspect ratio, determining that the second detection result is in an abnormal state.
Optionally, the determining, according to the bottle cap profile and the cap edge profile, the second detection result of the object to be detected includes:
If the cover edge and the cover of the cover image of the object to be detected are incomplete, the outline of the cover cannot be determined, and the second detection result is determined to be in an abnormal state.
In a second aspect, the present application provides a device for detecting an abnormal state of a gland, the device comprising:
the acquisition module is used for acquiring a gland image of the object to be detected through the shooting device;
the input module is used for inputting the gland image to a gland detection model to obtain a first detection result of the object to be detected, and the first detection result comprises: the gland detection model is trained according to a historical gland image set and a corresponding gland state;
the generation module is used for generating alarm information when the first detection result is in an abnormal state, an empty diagram or a non-cover state, wherein the alarm information is used for indicating that the object to be detected is abnormal.
Optionally, the apparatus further includes: a processing module;
the acquisition module is also used for acquiring a historical gland image set shot by the shooting device and a real gland state corresponding to each historical gland image;
and the processing module is used for training the deep learning pre-training model according to the historical gland image set and the real gland state corresponding to each historical gland image to obtain the gland detection model.
Optionally, the apparatus further includes: the device comprises an extraction module and a determination module;
the extraction module is used for extracting a target area from the gland image when the first detection result is in a normal state, wherein the target area comprises a cover edge and a cover of the object to be detected;
the processing module is used for carrying out color segmentation processing, morphological processing and contour detection processing on the target area to obtain a bottle cap contour and a cap edge contour of the object to be detected, wherein the bottle cap contour is the maximum circumscribed rectangular contour of the bottle cap;
the determining module is configured to determine a second detection result of the object to be detected according to the bottle cap contour and the cap edge contour, where the second detection result includes: normal and abnormal states;
the generating module is further configured to generate the alarm information when the second detection result is in an abnormal state, where the alarm information is used to indicate that the object to be detected is abnormal.
Optionally, the determining module is configured to determine, according to the bottle cap profile, a top coordinate of the bottle cap, where the top coordinate is a coordinate with a highest ordinate value in the bottle cap profile;
The determining module is further used for taking the center points of the two cover edges in the cover edge profile as the bottom coordinates of the bottle cap;
the determining module is used for determining the pixel height of the object to be detected according to the top coordinate and the bottom coordinate;
the determining module is further used for determining the pixel width of the bottle cap according to the positions of the two bottle cap edges in the bottle cap outline;
the determining module is used for obtaining the pixel aspect ratio according to the pixel height and the pixel width;
the determining module is further configured to determine a second detection result of the object to be detected according to the pixel aspect ratio and a preset aspect ratio.
Optionally, the apparatus further includes: a judging module;
a judging module, configured to judge whether the pixel aspect ratio matches the preset aspect ratio;
the determining module is further configured to determine that the second detection result is in a normal state when the pixel aspect ratio matches the preset aspect ratio;
the determining module is further configured to determine that the second detection result is in an abnormal state when the pixel aspect ratio does not match the preset aspect ratio.
Optionally, the determining module is configured to determine that the second detection result is in an abnormal state if the capping edge and the capping in the capping image of the object to be detected are incomplete, and the capping profile cannot be determined.
In a third aspect, the present application provides a device for detecting an abnormal state of a gland, the device comprising:
a memory;
a processor;
wherein the memory stores computer-executable instructions;
the processor executes the computer-executable instructions stored in the memory to implement the method for detecting a gland abnormal state according to the first aspect and the various possible implementation manners of the first aspect.
In a fourth aspect, the present application provides a computer readable storage medium having stored thereon a computer program that is executed by a processor to implement a method for detecting a gland abnormal state according to the first aspect and various possible implementations of the first aspect.
The method, the device, the equipment and the computer storage medium for detecting the abnormal state of the gland acquire gland images of the object to be detected through the shooting device. Inputting the gland image into a gland detection model to obtain a first detection result of an object to be detected, wherein the first detection result comprises: abnormal state, normal state, blank drawing and no cover state, the gland detection model is trained according to the historical gland image set and the corresponding gland state. When the first detection result is in an abnormal state, an empty chart or a non-cover state, generating alarm information, wherein the alarm information is used for indicating that the object to be detected is abnormal. The method has the advantages that the original production line is changed minimally, at least one shooting device is newly added at the left and right of the production line, and the image acquisition is automatically triggered when the bottle passes. The whole process realizes full-automatic processing, utilizes the original production line, improves the effect of the algorithm, reduces manual intervention and simultaneously reduces missed detection and false detection caused by manual production.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
Fig. 1 is a schematic view of a scenario of a method for detecting an abnormal state of a gland provided in the present application;
fig. 2 is a schematic flow chart of a method for detecting an abnormal state of a gland provided in the present application;
fig. 3 is a second flow chart of a method for detecting an abnormal state of a gland provided in the present application;
fig. 4a is a schematic diagram of a normal gland image of a method for detecting a gland abnormal state provided in the present application;
fig. 4b is an abnormal gland image schematic diagram of the method for detecting abnormal gland state provided in the present application;
fig. 5a is a schematic diagram of a normal capping image after color segmentation processing in the method for detecting a capping abnormal state provided in the present application;
fig. 5b is a schematic view of an abnormal capping image after color segmentation processing in the method for detecting a capping abnormal state provided in the present application;
fig. 6a is a schematic diagram of a normal gland image after contour detection processing in the method for detecting abnormal gland state provided in the present application;
fig. 6b is a schematic diagram ii of an abnormal gland image after contour detection processing in the method for detecting abnormal gland state provided in the present application;
Fig. 7a is a schematic diagram III of a normal gland image after contour detection processing in the method for detecting abnormal gland state provided in the present application;
fig. 7b is a schematic diagram of an abnormal gland image after contour detection processing in the method for detecting abnormal gland state provided in the present application;
fig. 8 is a schematic structural diagram of a device for detecting abnormal state of a gland provided in the present application;
fig. 9 is a schematic structural diagram of a gland abnormal state detection device provided by the present application.
Specific embodiments thereof have been shown by way of example in the drawings and will herein be described in more detail. These drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application, as detailed in the accompanying claims, rather than all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented, for example, in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, article, or apparatus.
In the embodiments of the present application, words such as "exemplary" or "such as" are used to mean examples, illustrations, or descriptions. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
The gland state detection is a process of automatically detecting the bottle cap on a production line and is used for ensuring the quality and the safety of the bottle cap. In the food industry, poor tightness of the bottle cap may cause external pollution to the food, so that the food is damaged and cannot be eaten; in the pharmaceutical industry, the tightness of the drug is critical to ensure efficacy of the drug and to avoid contamination, and effective capping state detection can avoid volatilization of the drug.
In the canning industry, partial quality inspection of the gland state is completed manually, a quality inspector is positioned around a production line, detects the gland state by means of eyes, and manually eliminates canning objects with abnormal gland. Part of enterprises realize gland abnormality detection and rejection by improving a production line and adding hardware rejection equipment, and the equipment for detecting the gland state and the rejection equipment are added on the basis of the original production line, so that the requirements on production technology are high.
In the existing method technology, a part of enterprises adopt a mode of manually detecting and judging hardware rejection, the mode has high concentration requirements on workers, and has requirements on production line speed, and workers are not too fast and easy to miss after fatigue. The other part of enterprises adopts a gland defect detection device, which is realized by a hardware mode and aims at screening and rejecting different gland locking conditions, thereby improving the overall detection precision. This approach requires a partial modification of the production line and the screening is relatively single. For example, the function of detecting and removing images with different sizes and heights of bottle caps or other middle parts with normal heights and breakage and the like cannot be achieved.
In view of the above problems, the present application proposes a method for detecting an abnormal state of a gland. The method is particularly applied to a production line of bottled articles, and mainly comprises a specific process of detecting whether the capping state of the bottled articles is normal or not.
Fig. 1 is a schematic view of a scenario of a method for detecting an abnormal state of a gland provided in the present application. As shown in fig. 1, two photographing devices 2 and 3 are provided on the left and right sides of the bottled object 1 to be detected, and the above devices can be used to detect the capping state. The bottled object 1 in fig. 1 is an object to be detected on a production line, and when the bottled object 1 passes through the photographing devices 2 and 3, the photographing devices 2 and 3 will photograph the images of the bottle cap 11 and the cap edge 12 of the bottled object 1 for subsequent judgment of the capping state. The photographed image may be acquired by the photographing device 2 or may be acquired by the photographing device 3. The purpose of the two shooting devices is to detect the capping state of the bottle cap in an omnibearing way and prevent the capping state from being detected incorrectly.
According to the method, at least one shooting device is added on the left side and the right side of the production line, the capping condition image of each bottle passing through the production line is collected, and the complete capping detection flow is realized by combining real-time algorithm analysis and judgment and an alarm device. The whole process realizes full-automatic processing, and utilizes the original production line to input the gland image into the gland detection model, and generates alarm information when the detection result is in an abnormal state, an empty diagram or a no-diagram state.
The following describes the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 2 is a flowchart illustrating a method for detecting an abnormal state of a gland according to an embodiment of the present application. As shown in fig. 2, the method includes:
s101: and acquiring a gland image of the object to be detected through the shooting device.
The photographing devices are located at two sides of the object to be detected as shown in fig. 1, and the photographing devices may be, for example, industrial trigger cameras. The capping image refers to the image of the bottle cap and the cap edge of the bottle body shot by the shooting device, and the positions of the bottle cap and the cap edge are shown as 11 and 12 in fig. 1.
It can be understood that two fixed shooting devices are added on the left side and the right side of the conventional production line, gland images of each bottle passing through the production line are acquired, and one or zero gland states are included in the gland images to be judged, namely only one bottled object is included in the gland images or no bottled object is included in the gland images. If there are a plurality of bottle objects in the photographed image, this image cannot be called a capping image.
S102: inputting the gland image to a gland detection model to obtain a first detection result of the object to be detected, wherein the first detection result comprises: the gland detection model is trained according to the historical gland image set and the corresponding gland state.
The abnormal state is an abnormal image of the bottle cap in the capping image, and the bottle cap is not pressed and is distorted by an example. The blank image refers to that no bottled object to be detected exists in the gland image. The uncapped state refers to the presence of a bottle in the capped image, but the bottle does not have a cap.
Optionally, acquiring a historical capping image set shot by the shooting device and a real capping state corresponding to each historical capping image;
and training the deep learning pre-training model according to the historical gland image set and the real gland state corresponding to each historical gland image to obtain the gland detection model.
It can be understood that before the gland detection model is used on line, the real gland image on the production line and the corresponding gland state thereof are acquired through the shooting device, the real image comprises normal gland, abnormal gland and no gland, the image data are marked, and the deep learning pre-training model is selected for training, so that the gland detection model is obtained. The gland detection model can obtain a first detection result after detecting the gland image.
S103: and when the first detection result is in an abnormal state, an empty chart or a non-cover state, generating alarm information, wherein the alarm information is used for indicating that the object to be detected is abnormal.
It can be understood that if the detection result is in a normal state, the capping image enters the next link to perform secondary inspection, so as to prevent false detection. If the detection result is in an abnormal state, generating alarm information and eliminating the bottled object. If the detection result is an empty graph, generating alarm information to remind a worker to check whether the shooting device is normal. If the detection result is that the cover is not covered, generating alarm information to remind workers whether the production line is abnormal or not.
According to the detection method for the abnormal state of the gland, the gland image of the object to be detected is obtained through the shooting device. Inputting the gland image into a gland detection model to obtain a first detection result of an object to be detected, wherein the first detection result comprises: abnormal state, normal state, blank drawing and no cover state, the gland detection model is trained according to the historical gland image set and the corresponding gland state. When the first detection result is in an abnormal state, an empty chart or a non-cover state, generating alarm information, wherein the alarm information is used for indicating that the object to be detected is abnormal. The method has the advantages that the original production line is changed minimally, at least one shooting device is newly added at the left and right sides of the production line, and the image acquisition is automatically triggered when the bottle passes. The whole process realizes full-automatic processing, utilizes the original production line, improves the effect of the algorithm and reduces manual intervention.
Fig. 3 is a second flow chart of a method for detecting an abnormal state of a gland according to an embodiment of the present application. As shown in fig. 3, the method includes:
s201: and acquiring a gland image of the object to be detected through the shooting device.
Step S201 is similar to step S101, and will not be described here.
S202: inputting the gland image to a gland detection model to obtain a first detection result of the object to be detected, wherein the first detection result comprises: the gland detection model is trained according to the historical gland image set and the corresponding gland state.
Step S202 is similar to step S102, and will not be described here.
S203: and judging whether the first detection result is in a normal state or not.
S204: and when the first detection result is in an abnormal state, an empty chart or a non-cover state, generating alarm information, wherein the alarm information is used for indicating that the object to be detected is abnormal.
Step S204 is similar to step S103, and will not be described here.
S205: and when the first detection result is in a normal state, extracting a target area from the gland image, wherein the target area comprises a cover edge and a cover of the object to be detected.
It can be understood that the detection result of the gland detection model is in a normal state at this time, but the gland detection model cannot detect the condition that the gland gap in the gland process is lower than two millimeters or other damage exists on the bottle cap, and the gland detection model may also have the condition of false detection and missing detection, so that on the basis that the first detection result is in the normal state, the gland image in the normal state is detected for the second time, and the condition of missing detection or incomplete detection is prevented.
It can be understood that fig. 4a is a schematic diagram of a normal gland image of the method for detecting abnormal gland state provided in the present application. Fig. 4b is an abnormal capping image schematic diagram of the method for detecting a capping abnormal state provided in the present application. The capping edge and the bottle cap of the object to be detected are extracted from the capping image, and the capping edge and the bottle cap are target areas, as shown in fig. 4a and 4b, fig. 4a is a capping image in a normal state, and a block 41 in fig. 4a is a target area to be extracted, and no gap exists between the bottle cap and the bottle edge. Fig. 4b is a capping image in an abnormal state, and block 42 in fig. 4b is a target area to be extracted, and a gap exists between the bottle cap and the bottle rim.
S206: and performing color segmentation processing, morphological processing and contour detection processing on the target area to obtain a bottle cap contour and a cap edge contour of the object to be detected, wherein the bottle cap contour is the maximum circumscribed rectangular contour of the bottle cap.
The color segmentation process is to classify images according to the positions of pixels in a color space, and gather pixel points with similar colors to form a region to realize color segmentation. The morphological processing can change the shape and structure of the image, and realize the functions of shape analysis, feature extraction, image enhancement and the like of the image. The contour detection process may ignore the effects of texture and noise disturbances inside the background and the object.
It can be understood that fig. 5a is a schematic diagram of a normal capping image after color segmentation processing in the method for detecting a capping abnormal state provided in the present application. Fig. 5b is a schematic view of an abnormal capping image after color segmentation processing in the method for detecting a capping abnormal state provided in the present application. Fig. 6a is a schematic diagram of a normal gland image after contour detection processing in the method for detecting abnormal gland state provided in the present application. Fig. 6b is a schematic diagram ii of an abnormal gland image after contour detection processing in the method for detecting abnormal gland state provided in the present application. Firstly, extracting a bottle cap part image, carrying out color segmentation on the extracted image, segmenting and extracting a bottle cap and a cap edge area in an rgb space and an hsv space according to the color characteristics of the bottle cap, secondly, carrying out morphological processing on a mask area after color segmentation, and removing other factors influencing a judgment result, wherein as shown in fig. 5a and 5b, fig. 5a is a result obtained by carrying out color segmentation processing on a normal-state capping image, and fig. 5b is a result obtained by carrying out color segmentation processing on an abnormal-state capping image. After the color extraction process protrudes the cap portion, the portion is subjected to a contour detection process, and the contour with the largest area is selected as the cap contour, as shown by a rectangular box 65 in fig. 6 b. The lid profile is shown as rectangular box 66 in fig. 6 b.
S207: and determining the top coordinate of the bottle cap according to the bottle cap profile, wherein the top coordinate is the coordinate with the highest ordinate value in the bottle cap profile.
It can be appreciated that the rectangular shape of the cap is advantageous for later finding the height of the cap. The highest point of the bottle cap is determined, namely, a coordinate system is established in a rectangular mode, and the coordinate with the highest ordinate value of the rectangle is the top coordinate, as shown in fig. 6a and 6 b. The coordinates of the point 61 in fig. 6a are the top coordinates of the capping image in the normal state. The coordinates of the point 63 in fig. 6b are the top coordinates of the capping image in the abnormal state.
S208: and taking the central points of the two cover edges in the cover edge profile as the bottom coordinates of the bottle cap.
It can be understood that if the bottle cap is normal, there is no gap between the bottle cap and the cap edge, the height from the cap edge to the bottle cap is a fixed value, if the bottle cap is abnormal, there is a gap between the bottle cap and the cap edge, and the distance from the cap edge to the bottle cap is greater than the fixed value, so the center point of the cap edge in the profile of the cap edge is taken as the bottom coordinate of the bottle cap, as shown in fig. 6a and 6 b. The coordinates of the point 62 in fig. 6a are the bottom coordinates of the capping image in the normal state. The coordinates of the point 64 in fig. 6b are the bottom coordinates of the capping image in the abnormal state.
Optionally, fig. 7a is a schematic diagram three of a normal gland image after contour detection processing in the method for detecting a gland abnormal state provided in the present application. Fig. 7b is a schematic diagram of an abnormal gland image after contour detection processing in the method for detecting abnormal gland state provided in the present application. If the bottle cap image in the capping image is in the vertical direction, the top coordinate and the bottom coordinate of the bottle cap will be changed, as shown in fig. 7a and 7 b:
it will be appreciated that if the fixed orientation of the photographing device is different, the bottle cap in the photographed image may be vertically placed, and the coordinate with the highest ordinate value in the outline of the bottle cap is taken as the top coordinate of the bottle cap, as shown in fig. 7a and 7 b. The coordinates of the point 71 in fig. 7a are the top coordinates of the capping image in the normal state. The coordinates of the point 73 in fig. 7b are the top coordinates of the capping image in the abnormal state. Meanwhile, the bottom coordinate is the coordinate with the lowest ordinate value in the outline of the bottle cap, as shown in fig. 7a and 7 b. The coordinates of the point 72 in fig. 7a are the bottom coordinates of the capping image in the normal state. The coordinates of the point 74 in fig. 7b are the bottom coordinates of the capping image in the abnormal state.
S209: and determining the pixel height of the object to be detected according to the top coordinate and the bottom coordinate.
S210: and determining the pixel width of the bottle cap according to the positions of the two bottle cap edges in the bottle cap outline.
It can be understood that the top coordinate is the highest point of the target area, the bottom coordinate is the lowest point of the target area, and the pixel height of the object to be detected can be obtained by connecting the lowest point and the highest point. The distance between the two heights of the bottle cap outline is the pixel width of the bottle cap, namely the height of the bottle cap edge. And comparing and judging the capping image through the pixel height and the pixel width, so as to ensure the correctness of the detection result.
S211: and obtaining the pixel aspect ratio according to the pixel height and the pixel width.
It can be understood that, since the pixel height and the pixel width of the image measurement will change along with the distance between the bottle cap and the camera, the judgment of the pixel height and the pixel width only will cause a larger error in the detection result, but the aspect ratio of the bottle itself will not change, so the pixel aspect ratio is obtained by using the pixel height and the pixel width, and the error problem caused by the distance between the bottle and the camera can be reduced by comparing the pixel aspect ratio.
S212: and judging whether the pixel aspect ratio is matched with the preset aspect ratio.
The preset aspect ratio is calculated according to real detection data of the bottle cap, and the preset aspect ratio is a fixed value.
It will be appreciated that the pixel aspect ratio of the bottle cap may be obtained from the capping image, and the difference between the pixel aspect ratio and the preset aspect ratio should be within a preset range and the preset range should be small, so that the capping is guaranteed to be in a normal state.
S213: and when the pixel aspect ratio is matched with the preset aspect ratio, determining that the second detection result is in a normal state.
S214: and when the pixel aspect ratio is not matched with the preset aspect ratio, determining that the second detection result is in an abnormal state.
It can be understood that the second detection result is obtained by comparing the aspect ratios of the pixels according to the capping image after the image processing, and the second detection result is obtained by detecting again when the first detection result is in the capping normal state. If the pixel aspect ratio is compared to the preset aspect ratio, the pixel aspect ratio is not within the preset aspect ratio interval, and the capping state is in an abnormal state.
For example, if the pixel aspect ratio is smaller than the preset aspect ratio, the bottle cap may not be compressed at this time; if the aspect ratio of the pixel is larger than the preset aspect ratio, the bottle cap may be flattened at this time, and the second detection results are all abnormal states.
S215: and when the second detection result is in an abnormal state, generating the alarm information, wherein the alarm information is used for indicating that the object to be detected is abnormal.
Step S215 is similar to step S103, and will not be described here.
Optionally, if the capping edge and the cap in the capping image of the object to be detected are incomplete, the cap profile cannot be determined, and the second detection result is determined to be in an abnormal state.
It can be understood that in the running process of the production line, the image shot by the shooting device may appear shooting blurring, and an incomplete capping image is shot, based on the capping image, the image detection algorithm cannot detect the capping edges on the left and right sides of the bottle cap at the same time, so that the incomplete image is not judged, and the anomaly is directly reported.
According to the detection method for the abnormal state of the gland, the gland image of the object to be detected is obtained through the shooting device. Inputting the gland image into a gland detection model to obtain a first detection result of an object to be detected, extracting a target area from the gland image if the first detection result is in a normal state, wherein the target area comprises a cover edge and a cover of the object to be detected, and performing color segmentation processing, morphological processing and contour detection processing on the target area to obtain the cover contour and the cover edge contour of the object to be detected. The pixel aspect ratio of the cap is determined based on the cap profile. Judging whether the pixel aspect ratio is matched with the preset aspect ratio, and determining that the second detection result is in a normal state when the pixel aspect ratio is matched with the preset aspect ratio. The method combines the gland detection model with the gland state result calculated by the traditional method, can judge the conditions of distortion of some of the pressure or damage of other parts of the bottle cap, enhances the robustness of the bottle cap abnormality detection method, improves the accuracy of the algorithm, and achieves the aims of no missing detection and high accuracy of the detection result.
Fig. 8 is a schematic structural diagram of a device for detecting abnormal state of a gland provided in the present application. As shown in fig. 8, a device 800 for detecting abnormal state of a gland provided in the present application includes:
an acquiring module 801, configured to acquire a capping image of an object to be detected through a capturing device;
the input module 802 is configured to input the capping image to a capping detection model, and obtain a first detection result of the object to be detected, where the first detection result includes: the gland detection model is trained according to a historical gland image set and a corresponding gland state;
and the generating module 803 is configured to generate alarm information when the first detection result is in an abnormal state, an empty diagram or a non-cover state, where the alarm information is used to indicate that the object to be detected is abnormal.
Optionally, the apparatus further includes: a processing module 804;
the acquiring module 801 is further configured to acquire a set of historical capping images captured by the capturing device and a real capping state corresponding to each historical capping image;
the processing module 804 is configured to perform training processing on the deep learning pre-training model according to the historical capping image set and the real capping state corresponding to each historical capping image, so as to obtain the capping detection model.
Optionally, the apparatus further includes: an extraction module 805, a determination module 806;
an extracting module 805, configured to extract a target area from the capping image when the first detection result is in a normal state, where the target area includes a capping edge and a bottle cap of the object to be detected;
the processing module 804 is configured to perform color segmentation processing, morphological processing, and contour detection processing on the target area to obtain a bottle cap contour and a cap edge contour of the object to be detected, where the bottle cap contour is a maximum circumscribed rectangular contour of the bottle cap;
a determining module 806, configured to determine a second detection result of the object to be detected according to the bottle cap contour and the cap edge contour, where the second detection result includes: normal and abnormal states;
the generating module 803 is further configured to generate the alarm information when the second detection result is in an abnormal state, where the alarm information is used to indicate that the object to be detected is abnormal.
Optionally, the determining module 806 is configured to determine, according to the bottle cap profile, a top coordinate of the bottle cap, where the top coordinate is a coordinate with a highest ordinate value in the bottle cap profile;
The determining module 806 is further configured to take a center point of two of the cap edges in the profile as a bottom coordinate of the bottle cap;
the determining module 806 is configured to determine a pixel height of the object to be detected according to the top coordinate and the bottom coordinate;
the determining module 806 is further configured to determine a pixel width of the bottle cap according to positions of two bottle cap edges in the bottle cap profile;
the determining module 806 is configured to obtain a pixel aspect ratio according to the pixel height and the pixel width;
the determining module 806 is further configured to determine a second detection result of the object to be detected according to the pixel aspect ratio and a preset aspect ratio.
Optionally, the apparatus further includes: a judgment module 807;
a determining module 807 configured to determine whether the pixel aspect ratio matches the preset aspect ratio;
the determining module 806 is further configured to determine that the second detection result is in a normal state when the pixel aspect ratio matches the preset aspect ratio;
the determining module 806 is further configured to determine that the second detection result is an abnormal state when the pixel aspect ratio does not match the preset aspect ratio.
Optionally, the determining module 806 is configured to determine that the second detection result is an abnormal state if the capping edge and the capping in the capping image of the object to be detected are incomplete, and the capping profile cannot be determined.
Fig. 9 is a schematic structural diagram of a gland abnormal state detection device provided by the present application. As shown in fig. 9, the present application provides a detection apparatus for a gland abnormal state, the detection apparatus 900 for a gland abnormal state including: a receiver 901, a transmitter 902, a processor 903, and a memory 904.
A receiver 901 for receiving instructions and data;
a transmitter 902 for transmitting instructions and data;
a memory 904 for storing computer-executable instructions;
the processor 903 is configured to execute computer-executable instructions stored in the memory 904 to implement the steps executed by the method for detecting a capping abnormal state in the above embodiment. The specific reference may be made to the description related to the foregoing embodiment of the method for detecting an abnormal state of the gland.
Alternatively, the memory 904 may be separate or integrated with the processor 903.
When the memory 904 is provided separately, the electronic device further comprises a bus for connecting the memory 904 and the processor 903.
The application also provides a computer readable storage medium, in which computer executable instructions are stored, and when the processor executes the computer executable instructions, the method for detecting the abnormal state of the gland executed by the device for detecting abnormal state of the gland is implemented.
Those of ordinary skill in the art will appreciate that all or some of the steps, systems, functional modules/units in the apparatus, and methods disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. In a hardware implementation, the division between the functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed cooperatively by several physical components. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as known to those skilled in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by a computer. Furthermore, as is well known to those of ordinary skill in the art, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the present application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. The method for detecting the abnormal state of the gland is characterized by comprising the following steps:
acquiring a gland image of an object to be detected through a shooting device;
inputting the gland image to a gland detection model to obtain a first detection result of the object to be detected, wherein the first detection result comprises: the gland detection model is trained according to a historical gland image set and a corresponding gland state;
And when the first detection result is in an abnormal state, an empty chart or a non-cover state, generating alarm information, wherein the alarm information is used for indicating that the object to be detected is abnormal.
2. The method of claim 1, wherein prior to acquiring the gland image of the object to be detected by the camera, the method further comprises:
acquiring a historical capping image set shot by the shooting device and a real capping state corresponding to each historical capping image;
and training the deep learning pre-training model according to the historical gland image set and the real gland state corresponding to each historical gland image to obtain the gland detection model.
3. The method according to claim 1, wherein the method further comprises:
when the first detection result is in a normal state, extracting a target area from the gland image, wherein the target area comprises a cover edge and a cover of the object to be detected;
performing color segmentation processing, morphological processing and contour detection processing on the target area to obtain a bottle cap contour and a cap edge contour of the object to be detected, wherein the bottle cap contour is the maximum circumscribed rectangular contour of the bottle cap;
Determining a second detection result of the object to be detected according to the bottle cap outline and the cap edge outline, wherein the second detection result comprises: normal and abnormal states;
and when the second detection result is in an abnormal state, generating the alarm information, wherein the alarm information is used for indicating that the object to be detected is abnormal.
4. A method according to claim 3, wherein said determining a second detection result of said object to be detected based on said cap profile and said cap rim profile comprises:
determining the top coordinate of the bottle cap according to the bottle cap profile, wherein the top coordinate is the coordinate with the highest ordinate value in the bottle cap profile;
taking the central points of two cover edges in the cover edge profile as the bottom coordinates of the bottle cap;
determining the pixel height of the object to be detected according to the top coordinate and the bottom coordinate;
determining the pixel width of the bottle cap according to the positions of two bottle cap edges in the bottle cap outline;
obtaining a pixel aspect ratio according to the pixel height and the pixel width;
and determining a second detection result of the object to be detected according to the pixel aspect ratio and a preset aspect ratio.
5. The method of claim 4, wherein determining the second detection result of the object to be detected according to the pixel aspect ratio and the preset aspect ratio comprises:
judging whether the pixel aspect ratio is matched with the preset aspect ratio;
determining that the second detection result is in a normal state when the pixel aspect ratio is matched with the preset aspect ratio;
and when the pixel aspect ratio is not matched with the preset aspect ratio, determining that the second detection result is in an abnormal state.
6. A method according to claim 3, wherein said determining a second detection result of said object to be detected based on said cap profile and said cap rim profile comprises:
if the cover edge and the cover of the cover image of the object to be detected are incomplete, the outline of the cover cannot be determined, and the second detection result is determined to be in an abnormal state.
7. A gland abnormal state detection device, the device comprising:
the acquisition module is used for acquiring a gland image of the object to be detected through the shooting device;
the input module is used for inputting the gland image to a gland detection model to obtain a first detection result of the object to be detected, and the first detection result comprises: the gland detection model is trained according to a historical gland image set and a corresponding gland state;
The generation module is used for generating alarm information when the first detection result is in an abnormal state, an empty diagram or a non-cover state, wherein the alarm information is used for indicating that the object to be detected is abnormal.
8. The apparatus of claim 7, wherein the apparatus further comprises: extraction module, processing module, determination module:
the extraction module is used for extracting a target area from the gland image when the first detection result is in a normal state, wherein the target area comprises a cover edge and a cover of the object to be detected;
the processing module is used for carrying out color segmentation processing, morphological processing and contour detection processing on the target area to obtain a bottle cap contour and a cap edge contour of the object to be detected, wherein the bottle cap contour is the maximum circumscribed rectangular contour of the bottle cap;
the determining module is configured to determine a second detection result of the object to be detected according to the bottle cap contour and the cap edge contour, where the second detection result includes: normal and abnormal states;
the generation module is further configured to generate the alarm information when the second detection result is in an abnormal state, where the alarm information is used to indicate that the object to be detected is abnormal.
9. A gland abnormal state detection apparatus, characterized by comprising:
a memory;
a processor;
wherein the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement the gland anomaly detection method of any one of claims 1-6.
10. A computer storage medium having stored therein computer-executable instructions which, when executed by a processor, are adapted to carry out the method of detecting a gland anomaly condition according to any one of claims 1 to 6.
CN202311502504.9A 2023-11-10 2023-11-10 Method, device, equipment and computer storage medium for detecting abnormal state of gland Pending CN117475233A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311502504.9A CN117475233A (en) 2023-11-10 2023-11-10 Method, device, equipment and computer storage medium for detecting abnormal state of gland

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311502504.9A CN117475233A (en) 2023-11-10 2023-11-10 Method, device, equipment and computer storage medium for detecting abnormal state of gland

Publications (1)

Publication Number Publication Date
CN117475233A true CN117475233A (en) 2024-01-30

Family

ID=89629177

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311502504.9A Pending CN117475233A (en) 2023-11-10 2023-11-10 Method, device, equipment and computer storage medium for detecting abnormal state of gland

Country Status (1)

Country Link
CN (1) CN117475233A (en)

Similar Documents

Publication Publication Date Title
CN106934803B (en) method and device for detecting surface defects of electronic device
CN111612781A (en) Screen defect detection method and device and head-mounted display equipment
CN112164050B (en) Method and device for detecting surface defects of products on production line and storage medium
CN105139384B (en) The method and apparatus of defect capsule detection
CN111583202B (en) Method and device for detecting broken filaments
JP2018120445A (en) Car number recognition apparatus
CN106228541A (en) Screen positioning method and device in visual inspection
CN115752969A (en) Method, system and equipment for detecting sealing performance of aluminum foil seal
CN108107611B (en) Self-adaptive defect detection method and device and electronic equipment
CN113569859B (en) Image processing method and device, electronic equipment and storage medium
US10115028B2 (en) Method and device for classifying an object in an image
CN113283439B (en) Intelligent counting method, device and system based on image recognition
WO2022222467A1 (en) Open circular ring workpiece appearance defect detection method and system, and computer storage medium
CN114897881A (en) Crystal grain defect detection method based on edge characteristics
CN114998205A (en) Method for detecting foreign matters in bottle in liquid filling process based on optical means
CN114399518A (en) Method for monitoring tightness of vehicle bottom bolt and electronic equipment
CN110807354A (en) Industrial production line product counting method
CN111008960B (en) Aluminum electrolytic capacitor bottom appearance detection method and device based on machine vision
CN112001336A (en) Pedestrian boundary crossing alarm method, device, equipment and system
CN117475233A (en) Method, device, equipment and computer storage medium for detecting abnormal state of gland
CN108898584B (en) Image analysis-based full-automatic veneered capacitor welding polarity discrimination method
CN116385357A (en) Test tube state judging method, device and system based on image recognition
CN109978879A (en) Case angle based on loading goods train video monitor enters slot condition detection method
CN106778675B (en) A kind of recognition methods of target in video image object and device
CN109448012A (en) A kind of method for detecting image edge and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination