A book binding error detection system based on computer vision
Through a computer vision-based book binding error detection system, deep learning models are used to identify the ladder blocks on the spine side of the book, and combined with affine transformation and template matching, the problem of inability to detect chapters in the prior art is solved. High-accurate binding inspection is achieved and production efficiency is improved.
Patent Information
- Application Number
- CN202110843370.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-26
- Publication Date
- 2024-11-29
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing book binding detection methods cannot effectively detect the outdated, repetitive and missing chapter content, and the accuracy of weighing and thickness measurements is low, so binding errors cannot be accurately judged.
Using a computer vision-based book binding error detection system, the CCD industrial camera collects the spine side images of the book, and the YOLOv4 deep learning model is used to identify the ladder blocks, combine affine transformation and template matching to judge binding errors, and handle the wrong books through the recycling device. .
It significantly improves the accuracy of book binding inspection, can judge the results within 1 second, improves production efficiency, solves problems such as missing chapter content, repetition, and out of order, and does not affect the normal operation of the production line.
Smart Images

Figure CN113487598B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of book binding detection, and in particular to a book binding error detection system based on computer vision. Background Art
[0002] In the book printing industry, book binding has a vital impact on the quality of books produced by the entire production line. Exploring a new and efficient book binding detection system is extremely important to the entire printing industry.
[0003] The Chinese utility model patent with announcement number CN212302509U discloses "a book binding error prevention detection system". This patent only solves the problem of inverted binding of the outer packaging book cover and the book content, but does not solve the problem of disorder, duplication, and missing of book chapter content.
[0004] Existing methods for book binding detection include weighing and thickness measurement. These two methods can only detect duplicate or missing chapters in the sample books being tested. In addition, the dynamic weighing error is large on the production line, and the thickness of the book is also greatly affected by the binding line. Therefore, the accuracy of binding detection in these two methods is relatively low. In addition, both methods cannot detect the disorder of book chapters. Summary of the invention
[0005] The purpose of the present invention is to overcome the defects of the prior art and propose a book binding error detection system based on computer vision.
[0006] In order to achieve the above-mentioned purpose, the present invention proposes a book binding error detection system based on computer vision, which is used for binding detection of books transmitted by a conveyor belt. The system comprises: a pair of through-beam photoelectric switches, a CCD industrial camera, a recycling device and an identification and judgment module arranged on a host computer; wherein,
[0007] The pair of opposite-beam photoelectric switches are respectively fixed on both sides of the conveyor belt drop slot and are turned on when a book is sensed to have fallen;
[0008] The CCD industrial camera is used to start taking pictures when the photoelectric switch is turned on, collect the image of the book spine and send it to the recognition and judgment module;
[0009] The recognition and judgment module is used to recognize the ladder blocks on the book spine image according to the pre-established and trained ladder block recognition model pre-stored in the configuration file, and when the number of ladder blocks recognized is consistent with the number of ladder blocks of the book of this category, the book spine image is subjected to image preprocessing and affine transformation, and then the image after affine transformation is subjected to template matching according to the pre-established template of the book of this category, and the result of whether the binding is wrong is outputted, and if there is a binding error, the recycling device is started to recycle the book;
[0010] The recycling device is used to receive books with binding errors under the control of the identification and judgment module.
[0011] As an improvement of the above system, the configuration file is used to store the pre-established and trained ladder block recognition model, to store the number and threshold of ladders for books in this category, and to store the configuration information for system startup.
[0012] As an improvement of the above system, the ladder block recognition model adopts the YOLOv4 network, the input is the book spine side image collected by the CCD industrial camera, and the output is the number of ladders in the book and the position information of each ladder.
[0013] As an improvement of the above system, the training process of the ladder block recognition model includes:
[0014] Collect photos of the book spines at the scene to establish a sample set;
[0015] The landmark blocks in the photo are labeled according to the type of VOC dataset, and a training set is established from a part of the labeled samples, and a test set is established from another part of the labeled samples;
[0016] Input the training set data into the YOLOv4 network, adjust the network parameters, and obtain a converged ladder block recognition model;
[0017] The test set data is input into the converged ladder block recognition model, and the network parameters are further adjusted until the network further converges to obtain a trained ladder block recognition model.
[0018] As an improvement of the above system, the image preprocessing specifically includes:
[0019] Threshold processing is performed on the image of the book spine, and the pixels below the set threshold are uniformly set to '0', and the pixels above the set threshold are uniformly set to '255'; the bright area in the image is enlarged by dilation processing, and the black area in the image is enlarged by corrosion processing, so as to remove image noise, and then binarization processing is performed to obtain a binary image.
[0020] As an improvement of the above system, the affine transformation specifically includes:
[0021] The coordinates of the upper left corner vertices of the first ladder mark, the middle ladder mark and the last ladder mark are extracted respectively, and the coordinates of the upper left corner vertices of the three ladder marks corresponding to the book template of this category are extracted respectively, and the transformation matrix is calculated. The binary image is affine transformed according to the transformation matrix to obtain the transformed binary image.
[0022] As an improvement of the above system, the process of establishing the book template of this category includes:
[0023] Use marking software to mark each ladder mark position and book outline of the book, and export the XML file; based on the XML file, construct a template binary image, the size of the template binary image is the same as the size of the book outline, the background is black, and the white ladder mark position is drawn on the black background image, thereby completing the establishment of the book template for this category.
[0024] As an improvement of the above system, the CCD industrial camera is fixed on the bracket so that the CCD lens is level with the conveyor belt, and the CCD industrial camera is connected to the host computer via RJ-45.
[0025] As an improvement of the above system, the recovery device is connected to the host computer via RS-232.
[0026] As an improvement to the above system, the GPU computing power of the host computer is not less than 3.0
[0027] Compared with the prior art, the advantages of the present invention are:
[0028] 1. The book detection system of the present invention adopts computer vision to identify book samples, which greatly improves the accuracy of identification and effectively solves the problems of missing, repeated, disordered and other defects in book binding work on the production line;
[0029] 2. In actual production and use, the present invention can judge the book sample and return the result within 1 second, which will not affect the work of the production line, but can judge the result in time, and is pluggable, does not affect the original production line equipment, and effectively improves production efficiency;
[0030] 3. This invention uses a deep learning model to identify book labels for the first time;
[0031] 4. The present invention adds affine transformation so that the detected image and the template image maintain morphological similarity as much as possible, thereby improving the accuracy of template matching. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is a schematic diagram of a book binding error detection system based on computer vision of the present invention;
[0033] Figure 2 It is the data flow of the book binding error detection system based on computer vision of the present invention;
[0034] Figure 3 It is a flow chart of the book binding error detection system based on computer vision of the present invention. DETAILED DESCRIPTION
[0035] In order to overcome the defects of disordered book binding and low accuracy of duplication and missing detection which cannot be solved in the prior art, the present invention provides a book detection system based on computer vision, which uses an industrial CCD camera to collect images of the spine of the book, and uses the deep learning model YOLOv4 to identify landmarks in the image, and compares the identified landmarks with a given template image to obtain the correctness of the book binding.
[0036] The technical solution of the present invention is described in detail below with reference to the accompanying drawings and embodiments.
[0037] Example 1
[0038] like Figure 1 As shown, embodiment 1 of the present invention proposes a book binding error detection system based on computer vision, which is used to detect the binding of books transmitted by a conveyor belt. The system includes: a pair of through-beam photoelectric switches, a CCD industrial camera, a recycling device and an identification and judgment module set in a host computer; wherein,
[0039] A pair of photoelectric switches are fixed on both sides of the conveyor belt drop slot, and they are turned on when they sense a book falling. The photoelectric switches are used to trigger the CCD to take pictures.
[0040] The CCD camera is triggered when the book falls into the conveying mechanism and blocks the photoelectric switch, thereby stimulating the photoelectric switch to output a camera trigger signal. It is used to start taking pictures when the photoelectric switch is turned on, collect the image of the book spine and send it to the recognition and judgment module;
[0041] The recognition and judgment module is used to identify the ladder blocks on the spine image of the book according to the relevant information of the book of this category in the configuration file. When the number of ladder blocks identified is consistent with the number of ladder blocks of the book of this category, the image of the spine of the book is preprocessed and affine transformed. Then, the image after affine transformation is template matched according to the pre-established template of the book of this category, and the result of whether the binding is wrong is output. If there is a binding error, the recycling device is started to recycle the book. This module is deployed on a computer with a GPU computing power of not less than 3.0.
[0042] The recycling device is used to receive books with binding errors under the control of the recognition and judgment module. It also includes a power adapter, a parallel light source, and a production line conveyor. Photoelectric switches are fixed on both sides of the conveyor belt drop slot. The book drop triggers the photoelectric switch, and the photoelectric switch controls the camera to take pictures. The camera is connected to the computer and transmits the data stream obtained by taking pictures to the computer. The recognition and judgment module in the computer recognizes and judges the data stream transmitted by the camera, then obtains the binding result and outputs the binding result to the recycling device.
[0043] In the above-mentioned book detection system, the CCD camera control line is connected to the photoelectric switch control line through PMOS, the CCD camera data line is connected to the computer, and the CCD power line is connected to the power adapter; for CCD industrial cameras, the triggering mode is hardware triggering, and the triggering source is the photoelectric switch, which is triggered by the rising edge. The photoelectric switch power line is connected to the power adapter power supply; the recovery device is connected to the computer through the serial port, and the power supply is connected to the power adapter; the parallel light source power line is connected to the power adapter. The specific data flow is as follows: Figure 2 shown.
[0044] CCD is used to collect images of the book spine, the recycling device is used to recycle books that are judged to be incorrectly bound, the computer is used to process the images taken by the CCD, identify and judge, and output the judgment results to the recycling device function, the photoelectric switch control line, CCD control line and PMOS are connected to ensure that the photoelectric switch can drive the camera to take pictures normally, and the CCD data line is connected to the computer to ensure that the image data can be transmitted to the computer. The recognition and judgment module in the computer uses the YOLO model to recognize the image transmitted back by the CCD, extracts the first, the middle (the total is divided by 2 and rounded up), and the upper left corner of the last ladder mark and the corresponding point in the template to calculate the transformation matrix, and then performs an affine transformation. After the transformation is completed, it is compared with the given template image, and the comparison result is used to determine whether there is a problem with the binding of this book. If there is a problem, the recycling device is driven to recycle the book, otherwise it continues.
[0045] In the above book detection system, the recognition and judgment module consists of two parts: recognition and template matching. Recognition is performed by the deep learning model YOLOv4, and judgment is performed based on the return value of template matching. The specific processing flow chart is as follows Figure 3 shown.
[0046] Preferably, the deep learning model needs to be trained using local samples, which mainly includes the following steps:
[0047] Step S1: Collecting on-site book spine photo data for model training and learning;
[0048] Step S2: mark the landmark blocks in the image, and then mark the samples according to the type of VOC dataset;
[0049] Step S3: Use the YOLOv4 pre-trained model to train and learn the labeled images to obtain a converged model;
[0050] Step S4: Use the learned model to test the sample images in the test set, adjust the parameters according to the results, and retrain the model, repeating S3 and S4 until a better model is obtained;
[0051] Step S5: Use the obtained model to identify and detect books on the production line.
[0052] Preferably, in step S2, the software used to label the sample images is LabelImg. After all samples are labeled, the samples are sorted according to the format of the VOC dataset and divided into two parts: a training set and a validation set.
[0053] The working process and principle of the present invention are as follows: the present invention uses the YOLOv4 model to learn the characteristic information of the marker block on the side of the book spine that is manually collected and marked, and obtains a model that can identify the marker block. Then, the model is used in a book binding detection system, and the image collected by a real-time CCD camera is used to identify the ladder marker block on the side of the book in real time. Affine transformation is performed on the identified image according to the vertex information of the identified ladder marker block and the vertex information in the template. After the transformation, template matching is performed, and finally the binding result is returned, and a recovery device is driven according to the returned result.
[0054] When the thickness of each chapter of the book being tested is relatively uniform and each marker block is relatively uniform, the existing model can be used directly to test the sample. The specific steps are as follows:
[0055] Step S0: When the software starts, it will first read the information in the configuration file, load the model, read the default threshold parameters, etc. If the configuration file does not exist, create a configuration file, initialize the information in the configuration file, and display a pop-up window to prompt the user to manually change the relevant information. The configuration file stores the path information of the YOLOv4.weight and YOLOv4.cfg files, serial port, static file path information, path information of the external executable file *.exe, threshold range, etc.
[0056] Step S1: Use the developed software LabelImg to label a template, then export the xml file, and generate a binary template file with the suffix bmp based on the xml file.
[0057] Step S2: Open the book detection software, import the template first, then click to open the camera, the interface displays the real-time image captured by the camera, then click to start recognition, and change the camera streaming mode to external trigger mode.
[0058] Step S3: The book falls, triggering the light spot switch, the camera takes a photo, and transmits it back to the computer for identification and judgment. The computer returns the judgment result and displays the result on the interface.
[0059] Step S4: If the returned result is true, continue to execute step S3; if the returned result is false, drive the recycling device to recycle and execute S3. According to the judgment effect, you can choose to modify the threshold parameters to increase the accuracy; or further train the model to improve the model recognition accuracy.
[0060] Step S5: When the recognition is finished, click the software's "End Recognition" button, and the recognition stops; click the "Close Camera" button, and the camera turns off.
[0061] When the detected book spine marker block has an irregular shape, it is necessary to add samples to continue learning and training the existing model. The specific steps are as follows:
[0062] Step S0: When the software starts, it will first read the information in the configuration file, load the model, read the default threshold parameters, etc. If the configuration file does not exist, it will create a configuration file, initialize the information in the configuration file, and display a pop-up window to prompt the user to manually change the relevant information.
[0063] Step S1: Capture images. Use a camera to sample new samples, and sampling requires different lighting and different samples of the same book.
[0064] Step S2: Target labeling. After the samples are collected, they need to be labeled. Click the label button in the software to call out the LabelImg software. After the labeling is completed, the software will organize the data and labeling files according to the format of the VOC dataset and divide them into three parts: training set, validation set and test set.
[0065] Step S3: Model training. After clicking the model training in the software, the software automatically calls the last trained model and further trains the model. After the training is completed, the file configuration will be automatically modified, old samples will be deleted, etc.
[0066] Step S4: Sample detection. Click Start Recognition in the software, and the entire system starts recognition. When a book falls, the light spot switch is triggered, and the camera takes a photo, which is transmitted back to the computer for recognition and judgment. The computer returns the judgment result and displays the result on the interface. According to the judgment effect, you can choose to modify the threshold parameter to increase the accuracy; or further train the model to improve the model recognition accuracy.
[0067] Step S5: If the returned result is true, continue to execute step S3; if the returned result is false, drive the recycling device to recycle and execute S4.
[0068] Step S6: When the recognition is finished, click the software's "End Recognition" button, and the recognition stops; click the "Close Camera" button, and the camera turns off.
[0069] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention is described in detail with reference to the embodiments, it should be understood by those skilled in the art that any modification or equivalent replacement of the technical solutions of the present invention does not depart from the spirit and scope of the technical solutions of the present invention and should be included in the scope of the claims of the present invention.
Claims
1. A book binding error detection system based on computer vision, used for binding detection of books transmitted by a conveyor belt, characterized in that: The system includes: a pair of through-beam photoelectric switches, a CCD industrial camera, a recovery device and an identification and judgment module arranged on a host computer; wherein, The pair of opposite-beam photoelectric switches are respectively fixed on both sides of the conveyor belt drop slot and are turned on when a book is sensed to have fallen; The CCD industrial camera is used to start taking pictures when the photoelectric switch is turned on, collect the image of the book spine and send it to the recognition and judgment module; The recognition and judgment module is used to recognize the ladder blocks on the book spine image according to the pre-established and trained ladder block recognition model pre-stored in the configuration file, and when the number of ladder blocks recognized is consistent with the number of ladder blocks of the book of this category, the book spine image is subjected to image preprocessing and affine transformation, and then the image after affine transformation is subjected to template matching according to the pre-established template of the book of this category, and the result of whether the binding is wrong is outputted, and if there is a binding error, the recycling device is started to recycle the book; The recycling device is used to receive books with binding errors under the control of the identification and judgment module; The configuration file is used to store the pre-established and trained ladder block recognition model, the number and threshold of ladders for books in this category, and the configuration information for system startup; The ladder block recognition model adopts the YOLOv4 network, the input is the book spine side image collected by the CCD industrial camera, and the output is the number of ladder blocks of the book and the position information of each ladder block; The affine transformation specifically includes: The coordinates of the upper left corner vertices of the first ladder mark, the middle ladder mark and the last ladder mark are extracted respectively, and the coordinates of the upper left corner vertices of the three ladder marks corresponding to the book template of this category are extracted respectively, and the transformation matrix is calculated. The binary image is affine transformed according to the transformation matrix to obtain the transformed binary image.
2. The computer vision-based book binding error detection system according to claim 1, characterized in that: The training process of the ladder block recognition model includes: Collect photos of the book spines at the scene to establish a sample set; The landmark blocks in the photo are labeled according to the type of VOC dataset, and a training set is established from a part of the labeled samples, and a test set is established from another part of the labeled samples; Input the training set data into the YOLOv4 network, adjust the network parameters, and obtain a converged ladder block recognition model; The test set data is input into the converged ladder block recognition model, and the network parameters are further adjusted until the network further converges to obtain a trained ladder block recognition model.
3. The computer vision-based book binding error detection system according to claim 1, characterized in that: The image preprocessing specifically includes: Threshold processing is performed on the image of the book spine, and the pixels below the set threshold are uniformly set to '0', and the pixels above the set threshold are uniformly set to '255'; the bright area in the image is enlarged by dilation processing, and the black area in the image is enlarged by corrosion processing, so as to remove image noise, and then binarization processing is performed to obtain a binary image.
4. The computer vision-based book binding error detection system according to claim 2, characterized in that: The process of establishing the book template of this category includes: Use marking software to mark each ladder mark position and book outline of the book, and export the XML file; based on the XML file, construct a template binary image, the size of the template binary image is the same as the size of the book outline, the background is black, and the white ladder mark position is drawn on the black background image, thereby completing the establishment of the book template for this category.
5. The computer vision-based book binding error detection system according to claim 1, characterized in that: The CCD industrial camera is fixed on the bracket so that the CCD lens is level with the conveyor belt, and the CCD industrial camera is connected to the host computer via RJ-45.
6. The computer vision-based book binding error detection system according to claim 1, characterized in that: The recovery device is connected to the host computer via RS-232.
7. The computer vision-based book binding error detection system according to claim 1, characterized in that: The GPU computing power of the host computer is not less than 3.0.
Citation Information
Patent Citations
Book binding mistake-proofing detection system
CN212302509U
Small part sorting method based on deep learning and sorting system thereof
CN112170233A
Book identification method and system based on spine visual information
CN112560902A
