Disclosure of Invention
In view of the above, the embodiments of the present application provide a method and an apparatus for detecting a sealing defect, so as to solve the problem that a drug with poor sealing property due to the problem of encapsulation thickness or the inherent problem cannot be detected.
A first aspect of an embodiment of the present application provides a method for detecting a seal defect, including:
collecting spectrum data of the medicine through an optical spectrometer; the spectral data includes surface information, thickness information, and internal characteristic information of an encapsulated region of the drug;
converting the spectrum data into image data, inputting the image data into a defect detection model, and detecting the tightness of the encapsulated medicine to obtain a detection result;
and if the detection result is unqualified, screening out the medicine.
In one embodiment, the converting the spectrum data into image data and inputting the image data into a defect detection model to detect encapsulation tightness of the drug to obtain a detection result includes:
after inputting the image data into a defect detection model, extracting a multi-scale characteristic image of the image data;
and carrying out image classification according to the multi-scale characteristic images to obtain detection results.
In one embodiment, before collecting the spectral data of the drug by the optical spectrometer, further comprising:
performing sealing defect detection training on the defect detection model according to training data; the training data includes a drug image sample having external or internal encapsulation defects.
In one embodiment, the converting the spectrum data into image data and inputting the image data into a defect detection model to detect encapsulation tightness of the drug to obtain a detection result includes:
the spectral data is converted into image data by fourier transformation.
In one implementation example, screening the drug if the detection result is failed includes:
if the detection result is unqualified, the medicine is removed from the coating furnace by controlling a motor.
A second aspect of an embodiment of the present application provides a device for detecting a seal defect, including:
the spectrum data acquisition module is used for acquiring spectrum data of the medicine through the optical spectrometer; the spectral data includes surface information, thickness information, and internal characteristic information of an encapsulated region of the drug;
the sealing defect detection module is used for converting the spectrum data into image data, inputting the image data into a defect detection model, and detecting the sealing property of the encapsulated medicine to obtain a detection result;
and the medicine screening module is used for screening the medicines if the detection result is unqualified.
In one implementation example, the seal defect detection module includes:
the multi-scale characteristic image extraction unit is used for extracting multi-scale characteristic images of the image data after the image data are input into a defect detection model;
and the detection unit is used for carrying out image classification according to the multi-scale characteristic images to obtain detection results.
In one implementation example, the apparatus further comprises:
the model training module is used for carrying out sealing defect detection training on the defect detection model according to training data; the training data includes a drug image with external or internal encapsulation defects.
In one implementation example, the medication screening module includes:
and the rejecting unit is used for rejecting the medicine from the coating furnace by controlling the motor if the detection result is unqualified.
A third aspect of an embodiment of the present application provides a device for detecting a seal defect, including: the sealing defect detection device comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the sealing defect detection method in the first aspect when executing the computer program.
According to the method and the device for detecting the sealing defect, provided by the embodiment of the application, spectrum data of a medicine is collected through an optical spectrometer; the spectral data includes surface information, thickness information, and internal characteristic information of an encapsulated region of the drug; converting the spectrum data into image data, inputting the image data into a defect detection model, and detecting the tightness of the encapsulated medicine to obtain a detection result; and if the detection result is unqualified, screening out the medicine. And acquiring surface information, thickness information and internal characteristic information of an encapsulation area of the medicine by using a spectrometer to obtain spectrum data. And converting the obtained spectrum data into image data, inputting the image data into a defect detection model, and detecting the sealing defect of the encapsulation area of the medicine to obtain a detection result. Because the image data obtained through conversion according to the spectrum data also contains the surface information, the thickness information and the internal characteristic information of the encapsulation area of the medicine, the defect detection model can detect the encapsulation thickness and the internal characteristic of the medicine, and the accuracy of detecting the sealing defect of the encapsulated medicine is improved. The medicines with unqualified detection results are timely screened out according to the obtained detection results.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution of an embodiment of the present application will be clearly described below with reference to the accompanying drawings in the embodiment of the present application, and it is apparent that the described embodiment is a part of the embodiment of the present application, but not all the embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
The term "comprising" in the description of the application and the claims and in the above figures and any variants thereof is intended to cover a non-exclusive inclusion. For example, a process, method, or system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed but may optionally include additional steps or elements not listed or inherent to such process, method, article, or apparatus. Furthermore, the terms "first," "second," and "third," etc. are used for distinguishing between different objects and not for describing a particular sequential order.
Example 1
Fig. 1 is a schematic flow chart of a method for detecting a seal defect according to an embodiment of the application. The embodiment is applicable to application scenes of detecting the sealing defect of the encapsulated medicine, the method can be executed by a device for detecting the sealing defect, and the device can be a processor, an intelligent terminal, a tablet or a PC (personal computer) and the like; in the embodiment of the application, a detection device for sealing defects is taken as an execution main body for explanation, and the method specifically comprises the following steps:
s110, collecting spectrum data of the medicine through an optical spectrometer; the spectral data includes surface information, thickness information, and internal characteristic information of an encapsulated region of the drug;
since the tightness of encapsulated drugs is usually detected in the prior art by means of machine vision, the encapsulated areas of the drug are photographed by means of a common photographing device. The scheme can only detect the defects on the surface of the medicine capsule encapsulation, and cannot meet the thickness and internal characteristics of the medicine capsule encapsulation. To solve this problem, the embodiment uses a spectrometer to collect spectrum data of the encapsulated drug (for example, the encapsulated drug capsule at the middle joint) by optical coherence tomography to obtain surface information, thickness information and internal characteristic information of the encapsulated region of the drug. And then converting the spectrum data containing the surface information, thickness information and internal characteristic information of the encapsulated area of the drug into image data and inputting the image data into a defect detection model to detect the tightness of the encapsulated drug.
Specifically, since the encapsulation process of the drug can be performed in the coating furnace, a spectrometer can be provided to collect spectral data for each encapsulated drug produced in the coating furnace. Alternatively, the spectrometer uses Optical Coherence Tomography (OCT) to scan the encapsulated drug. In the spectrometer, light emitted from a broadband SLD light source is split into sample light and reference light by a fiber coupler or a splitting prism. And the reference light emitted by the spectrometer is reflected back to the spectrometer through the reflector, the encapsulated area of the medicine to be detected is irradiated by the sample light emitted by the spectrometer, and the depth information of the encapsulated area of the medicine is acquired. The sample light scattered back to the spectrometer by the drug to be detected and the reference light are interfered at the spectrometer to form an interference spectrum, so that spectrum data containing surface information, thickness information and internal characteristic information of an encapsulated region of the drug is obtained.
S120, converting the spectrum data into image data, and inputting the image data into a defect detection model to detect the tightness of the encapsulated medicine to obtain a detection result;
after the spectrum data containing the surface information, the thickness information and the internal characteristic information of the encapsulated area of the medicine are acquired, the acquired spectrum data are converted into image data, so that the tightness defect detection is carried out according to the surface information, the thickness information and the internal characteristic information of the encapsulated area of the medicine in the spectrum data. And inputting the image data obtained through the spectrum data conversion into a pre-trained defect detection model, so that the defect detection model detects the tightness of the encapsulated medicine according to the input image data to obtain a detection result.
In one implementation example, the specific process of converting the acquired spectral data into image data may be: the spectral data is converted into image data by fourier transformation, thereby obtaining three-dimensional image data containing surface information, thickness information and internal characteristic information of the encapsulated region of the drug.
In one implementation example, the specific process of inputting the image data into the defect detection model to detect the tightness of the encapsulated drug to obtain the detection result may be: after inputting the image data into a defect detection model, extracting a multi-scale characteristic image of the image data; and carrying out image classification according to the multi-scale characteristic images to obtain detection results.
Specifically, in order to adapt to the size specification among different medicines, after the image data is input into a defect detection model, multi-scale characteristic image extraction can be performed on the input image data through a multi-scale characteristic convolution network in the defect detection model. Optionally, the multi-scale feature convolution network in the defect detection model may use an SSD network structure (Single Shot MultiBox Detector) to perform multi-scale convolution on the input image data through prior frames with different scales and aspect ratios to obtain a multi-scale feature image. The resulting large scale profile (the front profile) can be used to detect smaller size medications, while the small scale profile (the rear profile) can be used to detect larger size medications. And the SSD network structure can adopt a VGG16 network as a basic model, and then a plurality of convolution layers are added on the basis of the VGG16 to obtain more characteristic diagrams.
After the input image data is extracted into the multi-scale characteristic image, the extracted multi-scale characteristic image can be subjected to image classification through a classification network of the defect detection model to obtain a detection result. The detection result can be qualified, the encapsulation is too thick, the encapsulation is too thin, encapsulation is not carried out, the encapsulation position is offset, and the like. Optionally, the specific process of performing image classification according to the multi-scale feature image to obtain a detection result may be: and inputting the multi-scale characteristic image into a full-connection layer of the defect detection model for image classification to obtain classification data. And then calculating the probability of the classified data through a classifier to determine a classification result, namely a detection result. Alternatively, the classifier may be a softmax classification function. And converting classification results of detection results such as preset qualification, over-thick encapsulation, over-thin encapsulation, no encapsulation, encapsulation position deviation and the like into probabilities through a softmax classification function, outputting the classification result with the highest probability, and finishing the leak tightness defect detection of the encapsulated medicine.
And S130, screening out the medicine if the detection result is unqualified.
And converting the acquired spectrum data into image data, inputting the image data into a defect detection model to detect the tightness of the encapsulated medicine to obtain a detection result, and detecting the sealing defect of the encapsulated medicine produced by the next coating furnace if the detection result is qualified. If the detection result output by the defect detection model is the detection result of over-thick encapsulation, over-thin encapsulation, no encapsulation, encapsulation position deviation and the like, the detection result of the medicine is judged to be unqualified, and the medicine can be screened out from the production line.
In an implementation example, if the detection result is not qualified, the specific process of screening the drug may be: if the detection result is unqualified, the medicine is removed from the coating furnace by controlling a motor. Optionally, the sealing defect detecting device may be further connected to a motor, and when the detection result output by the defect detecting model is unqualified, the sealing defect detecting device may reject the drug from the coating furnace by controlling the motor.
According to the detection method of the sealing defect, provided by the embodiment of the application, spectrum data of a medicine is collected through an optical spectrometer; the spectral data includes surface information, thickness information, and internal characteristic information of an encapsulated region of the drug; converting the spectrum data into image data, inputting the image data into a defect detection model, and detecting the tightness of the encapsulated medicine to obtain a detection result; and if the detection result is unqualified, screening out the medicine. And acquiring surface information, thickness information and internal characteristic information of an encapsulation area of the medicine by using a spectrometer to obtain spectrum data. And converting the obtained spectrum data into image data, inputting the image data into a defect detection model, and detecting the sealing defect of the encapsulation area of the medicine to obtain a detection result. Because the image data obtained through conversion according to the spectrum data also contains the surface information, the thickness information and the internal characteristic information of the encapsulation area of the medicine, the defect detection model can detect the encapsulation thickness and the internal characteristic of the medicine, and the accuracy of detecting the sealing defect of the encapsulated medicine is improved. The medicines with unqualified detection results are timely screened out according to the obtained detection results.
Example two
Fig. 2 is a schematic flow chart of a method for detecting a seal defect according to a second embodiment of the present application. On the basis of the first embodiment, the present embodiment further provides a training process of the defect detection model, so as to realize accurate detection of the leak tightness defect of the encapsulated drug. The method specifically comprises the following steps:
s210, performing sealing defect detection training on the defect detection model according to training data; the training data includes a drug image sample having external or internal encapsulation defects;
when the defect detection model is trained by training data to build the model, the training data may include a drug image sample with external or internal encapsulated defects. Alternatively, the drug image samples with external or internal encapsulation defects may include drug image samples that are over-thick, over-thin, without encapsulation, and with offset encapsulation positions, etc. The training data also includes image samples of encapsulated qualified drugs. The preset detection results can comprise detection results of qualification, over-thick encapsulation, over-thin encapsulation, no encapsulation, encapsulation position deviation and the like. Therefore, after the defect detection model generated through training of the training data detects the input image data, the output classification result is one detection result of the preset detection results.
Since the pre-trained defect detection model used in the first embodiment may be a convolutional neural network model, it may be generated by training data. If the data volume of the training data is insufficient, the sample data volume can be expanded by a plurality of data online expansion methods such as overturn, horizontal offset, color change and the like. Specifically, the overturn expansion method is to randomly horizontally, vertically or horizontally and vertically overturn the sample picture to generate a new picture; the horizontal offset expansion method is to randomly translate 1-5 pixels leftwards or rightwards on the basis of original pictures of a sample picture to generate a new picture; the color change expansion method is to generate a new picture by changing the brightness (positive and negative deviation 30), contrast (scaling 0.9-1.1), chromaticity (positive and negative deviation 0.2) and saturation (scaling 0.9-1.1) of the sample picture. The data amount of the samples in the training data is equalized after a sufficient amount of sample data is obtained.
S220, collecting spectrum data of the medicine through an optical spectrometer; the spectral data includes surface information, thickness information, and internal characteristic information of an encapsulated region of the drug;
and (3) performing spectrum data acquisition on the encapsulated medicine (for example, the encapsulated medicine capsule at the middle joint) by adopting a spectrometer through an optical coherence tomography technology to obtain the surface information, the thickness information and the internal characteristic information of the encapsulated area of the medicine.
S230, converting the spectrum data into image data, and inputting the image data into a defect detection model to detect the tightness of the encapsulated medicine to obtain a detection result;
after the spectrum data containing the surface information, the thickness information and the internal characteristic information of the encapsulated area of the medicine are acquired, the acquired spectrum data are converted into image data, so that the tightness defect detection is carried out according to the surface information, the thickness information and the internal characteristic information of the encapsulated area of the medicine in the spectrum data. And inputting the image data obtained through the spectrum data conversion into a pre-trained defect detection model, so that the defect detection model detects the tightness of the encapsulated medicine according to the input image data to obtain a detection result.
S240, screening out the medicine if the detection result is unqualified.
And converting the acquired spectrum data into image data, inputting the image data into a defect detection model to detect the tightness of the encapsulated medicine to obtain a detection result, and detecting the sealing defect of the encapsulated medicine produced by the next coating furnace if the detection result is qualified. If the detection result output by the defect detection model is the detection result of over-thick encapsulation, over-thin encapsulation, no encapsulation, encapsulation position deviation and the like, the detection result of the medicine is judged to be unqualified, and the medicine can be screened out from the production line.
Example III
Fig. 3 shows a device for detecting a seal defect according to a third embodiment of the present application. On the basis of the first embodiment, the embodiment of the application also provides a device 3 for detecting a sealing defect, which comprises:
a spectrum data acquisition module 301, configured to acquire spectrum data of a drug through an optical spectrometer; the spectral data includes surface information, thickness information, and internal characteristic information of an encapsulated region of the drug;
the sealing defect detection module 302 is configured to convert the spectrum data into image data, and input the image data into a defect detection model to detect the tightness of the encapsulated drug to obtain a detection result;
and the medicine screening module 303 is configured to screen out the medicine if the detection result is not qualified.
In one implementation example, the seal defect detection module 302 includes:
the multi-scale characteristic image extraction unit is used for extracting multi-scale characteristic images of the image data after the image data are input into a defect detection model;
and the detection unit is used for carrying out image classification according to the multi-scale characteristic images to obtain detection results.
In one implementation example, the apparatus further comprises:
the model training module is used for carrying out sealing defect detection training on the defect detection model according to training data; the training data includes a drug image with external or internal encapsulation defects.
In one implementation example, the drug screening module 303 includes:
and the rejecting unit is used for rejecting the medicine from the coating furnace by controlling the motor if the detection result is unqualified.
According to the detection device for the sealing defect, provided by the embodiment of the application, spectrum data of a medicine is collected through an optical spectrometer; the spectral data includes surface information, thickness information, and internal characteristic information of an encapsulated region of the drug; converting the spectrum data into image data, inputting the image data into a defect detection model, and detecting the tightness of the encapsulated medicine to obtain a detection result; and if the detection result is unqualified, screening out the medicine. And acquiring surface information, thickness information and internal characteristic information of an encapsulation area of the medicine by using a spectrometer to obtain spectrum data. And converting the obtained spectrum data into image data, inputting the image data into a defect detection model, and detecting the sealing defect of the encapsulation area of the medicine to obtain a detection result. Because the image data obtained through conversion according to the spectrum data also contains the surface information, the thickness information and the internal characteristic information of the encapsulation area of the medicine, the defect detection model can detect the encapsulation thickness and the internal characteristic of the medicine, and the accuracy of detecting the sealing defect of the encapsulated medicine is improved. The medicines with unqualified detection results are timely screened out according to the obtained detection results.
Example III
Fig. 4 is a schematic structural diagram of a device for detecting a seal defect according to a third embodiment of the present application. The device for detecting the sealing defect comprises: a processor 41, a memory 42 and a computer program 43 stored in the memory 42 and executable on the processor 41, for example a program for a method of detecting a sealing defect. The processor 41 performs steps in the above-described embodiment of the method for detecting a seal defect, such as steps S110 to S140 shown in fig. 1, when executing the computer program 43.
Illustratively, the computer program 43 may be partitioned into one or more modules that are stored in the memory 42 and executed by the processor 41 to complete the present application. The one or more modules may be a series of computer program instruction segments capable of performing a specific function for describing the execution of the computer program 43 in the means for detecting a seal defect. For example, the computer program 43 may be divided into a spectral data acquisition module, a seal defect detection module and a drug screening module, each of which functions specifically as follows:
the spectrum data acquisition module is used for acquiring spectrum data of the medicine through the optical spectrometer; the spectral data includes surface information, thickness information, and internal characteristic information of an encapsulated region of the drug;
the sealing defect detection module is used for converting the spectrum data into image data, inputting the image data into a defect detection model, and detecting the sealing property of the encapsulated medicine to obtain a detection result;
and the medicine screening module is used for screening the medicines if the detection result is unqualified.
The means for detecting a seal defect may include, but is not limited to, a processor 41, a memory 42, and a computer program 43 stored in the memory 42. It will be appreciated by those skilled in the art that fig. 4 is merely an example of a seal defect detection apparatus, and is not intended to be limiting, and may include more or fewer components than shown, or may be combined with certain components, or different components, e.g., the seal defect detection apparatus may further include an input/output device, a network access device, a bus, etc.
The processor 41 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 42 may be an internal storage unit of the seal defect detecting device, for example, a hard disk or a memory of the seal defect detecting device. The memory 42 may also be an external storage device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card) or the like, which are provided on the detecting device of the seal defect. Further, the memory 42 may also include both an internal memory unit and an external memory device of the seal defect detection device. The memory 42 is used to store the computer program and other programs and data required for the method of detecting a seal defect. The memory 42 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other manners. For example, the apparatus/terminal device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical function division, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.