Defect data storage and query method of visual inspection system
By building a directory structure in the upper-level organization of the visual detection system and storing original images, defect data and judgment basis, the problems of large storage space, inconvenient analysis and inconvenient migration in the visual detection system are solved, and convenient viewing, analysis and migration are achieved.
Patent Information
- Application Number
- CN202411833484.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-05-09
AI Technical Summary
In the prior art, in the visual detection system, the storage space of defect data occupies a large amount, and the statistical analysis of defect data is inconvenient, and it is also inconvenient to migrate defect data.
A directory structure is built at the upper computer of the visual detection system, including the root directory, the first-level directory and the second-level directory. The root directory corresponds to the defect data storage directory, each first-level directory corresponds to the date, and each second-level directory corresponds to the product specifications and models. Store the original images, defect data and judgment basis in the corresponding secondary directory, view and analyze through the picture viewing tool and statistical tool, and use the directory structure to migrate defect data.
It realizes the convenience of viewing original images and defective images, the convenience of statistical analysis of defective data, reduces storage space usage, and makes the migration of defective data more convenient.
Smart Images

Figure CN119961468A_ABST
Abstract
Description
Technical Field
[0001] The method relates to a defect data storage and query technology of a visual inspection system, and in particular to a defect data storage and query method of a visual inspection system. Background Art
[0002] With the development of image processing technology, visual inspection systems based on image processing technology have been widely used in the field of product surface defect detection. During the inspection process, the visual inspection system usually uses a camera to capture the image of the target workpiece, that is, the original image, and then uses the defect detection algorithm to calculate and analyze the original image to obtain three judgment results: normal, defective, and undetectable. After the inspection is completed, the original image with the judgment result of defect, the defect image corresponding to the original image, the defect data, and the judgment basis are stored in the host computer as defect data. By viewing the original image stored in the host computer, it can be determined whether the photo meets the inspection requirements, by viewing the defect image, the defect detection location can be found, the defect category and value can be obtained through the defect data, and the cause of the defect can be known through the judgment basis.
[0003] As the requirements for the detection accuracy of visual inspection systems are getting higher and higher, the requirements for camera pixels are also getting higher and higher. As a result, each original image (i.e. lossless image) taken by the camera occupies more and more storage space on the host computer. Due to the limited storage space of the host computer, these defect data cannot be stored for a long time. In order to be able to trace the history of product defects, it is necessary to regularly migrate the earlier defect data to an external data disk to ensure that the defect data is stored for a longer time.
[0004] In order to analyze the defects of the target workpiece, image viewing tools will be used to view the original images and defect images in the defect data, and statistical tools will also be used to perform statistical analysis on the defect data and judgment basis in the defect data.
[0005] In addition, since the defect image is formed by drawing a frame at the defect detection position on the original image and using text to describe the defect data and judgment basis near the frame, the defect image already contains the defect data and judgment basis. In order to further save storage space, there are currently two main methods for storing defect data. The first method is to store only the original image and the defect image as picture files respectively, without saving the defect data and judgment basis, that is, the defect data includes the original image and the defect image; the second method is to store only the original image as a picture file, store the defect data and judgment basis in the database, and not store the defect image, that is, the defect data includes the original image, defect data and judgment basis.
[0006] In order to analyze the defects of the target workpiece, image viewing tools will be used to view the original images and defect images in the defect data, and statistical tools will also be used to perform statistical analysis on the defect data and judgment basis in the defect data.
[0007] After the defect data is stored using the first method mentioned above, you can directly use the image viewing tool to view the original image and defect image when viewing. However, the defect data and judgment basis are viewed on the defect image, and statistical analysis cannot be directly performed using statistical tools, which makes statistical analysis inconvenient. When migrating defect data, you can directly copy the original image and defect image from the host computer to the external data disk, which is more convenient for defect data migration.
[0008] After the defect data is stored using the second method mentioned above, when it is needed, the original image can be directly viewed using the image viewing tool. When viewing the defect image, first load the original image, then read the defect data and judgment basis in the database and mark them on the original image. In addition, the defect data and judgment basis in the database can be accessed using statistical tools to analyze the defect data. However, when migrating defect data, in addition to directly copying the original image from the host computer to the external data disk, it is also necessary to extract the corresponding defect data and judgment basis from the database one by one according to the original image, and store them in the database corresponding to the external data disk. In addition, a one-to-one correspondence between the original image and the defect data and judgment basis in the database needs to be re-established on the external data disk, so that statistical analysis can be performed on the external data disk later through statistical tools. Defect data migration is relatively inconvenient.
[0009] Therefore, although the first method mentioned above is convenient for viewing original images and defect images, and convenient for migrating defect data, it is inconvenient for statistical analysis of defect data, and since the original images and defect images are large, the defect data occupies more storage space; although the second method mentioned above is convenient for viewing original images and defect images, and convenient for statistical analysis of defect data, and only needs to store original images, the storage space occupied by defect data is small, but it is inconvenient for migrating defect data. Summary of the invention
[0010] The technical problem to be solved by the method is to provide a defect data storage and query method for a visual inspection system that is convenient for viewing original images and defect images, convenient for statistical analysis of defect data, occupies less storage space for defect data, and convenient for migrating defect data.
[0011] The technical solution adopted by the present method to solve the above technical problems is: a defect data storage and query method of a visual inspection system, comprising the following steps:
[0012] Step 1: construct a directory structure at the host computer of the visual inspection system, wherein the directory structure includes a root directory, multiple first-level directories constructed under the root directory, and multiple second-level directories constructed under each first-level directory, wherein the root directory corresponds to the defect data storage directory, each first-level directory corresponds to a date, and each second-level directory corresponds to a product specification model;
[0013] Step 2: When the visual inspection system is running, if the original image is judged as defective by the defect detection algorithm, the three items of defect data, namely the original image, defect data and judgment basis, are stored in the directory structure set by the host computer. The specific storage location is the secondary directory of the corresponding date and product specification model;
[0014] Step 3. When you need to view an original image, use the image viewing tool to directly open the original image in the corresponding secondary directory for viewing;
[0015] When a defect image needs to be viewed, first use the image viewing tool to open the original image in the corresponding secondary directory, then read the defect data and judgment basis, and load the defect data and judgment basis onto the original image to form a defect image;
[0016] When defect data statistics are required, first use the statistical tool to associate with the directory structure set in the host computer, load the root directory, and then filter all the data in the root directory according to the two query conditions of the start and end time period and product specification model to obtain the defect data that meets the filtering conditions, and then analyze and count the defect data, and display the statistical results in the display interface of the host computer;
[0017] When defect data needs to be migrated, the migration tool is associated with the directory structure set in the host computer, the migration date is set, and then all the first-level directories before that date and all the files under these first-level directories are transferred to the external data disk and saved in the root directory of the corresponding defect data storage directory preset in the external data disk. Finally, all the first-level directories that have been transferred and all the files under these first-level directories are deleted from the root directory of the directory structure set in the host computer to complete the migration of the defect data.
[0018] Compared with the prior art, the advantage of the present method is that a directory structure is constructed at the host computer of the visual inspection system, the directory structure includes a root directory, multiple first-level directories constructed under the root directory, and multiple second-level directories constructed under each first-level directory, the root directory corresponds to the defect data storage directory, each first-level directory corresponds to a date, and each second-level directory corresponds to a product specification model. When the visual inspection system is running, when the original image is judged as a defect by the defect detection algorithm, the three items of defect data, namely the original image, defect data and judgment basis, are stored in the directory structure set by the host computer, and the specific storage location is the second-level directory corresponding to the date and the product specification model; when it is necessary to view a certain original image, the image viewing tool can be used to directly open the original image in the corresponding second-level directory for viewing; when it is necessary to view a certain defect image, the image viewing tool can be used to open the original image in the corresponding second-level directory first, and then the defect data and judgment basis are read, and the defect data and judgment basis are loaded onto the original image to form a defect image, so as to realize the viewing of the defect image; when it is necessary to count the defect data, the statistical tool can be used to associate it with the directory structure set in the host computer first, and load the root directory. Directory, then all data in the root directory are screened according to the two query conditions of the start and end time period and the product specification model, and defect data that meets the screening conditions are obtained, and then the defect data is analyzed and counted, and the statistical results are displayed in the display interface of the host computer; when it is necessary to migrate defect data, the migration tool is associated with the directory structure set in the host computer, the migration date is set, and then all the first-level directories before the date and all the files under these first-level directories are transferred to the external data disk, and saved in the root directory of the corresponding defect data storage directory preset in the external data disk, and finally all the first-level directories that have been transferred and all the files under these first-level directories are deleted in the root directory of the directory structure set in the host computer to complete the migration of defect data. Therefore, the present invention only stores the original image, defect data and judgment basis as defect data, which is convenient for viewing the original image and defect image, and convenient for statistical analysis of defect data. There is no need to store defect images, which reduces storage space, and the storage space occupied by defect data is small. Moreover, since the original image and its corresponding defect data and judgment basis are stored in the same second-level directory, when migrating the defect data, the second-level directory can be migrated as a whole, which is convenient for migrating the defect data. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 The figure is a flow chart of the defect data storage and query method of the visual inspection system of the present invention. DETAILED DESCRIPTION
[0020] The method is further described in detail below in conjunction with the accompanying drawings.
[0021] Example: Figure 1As shown, a defect data storage and query method for a visual inspection system includes the following steps:
[0022] Step 1: construct a directory structure at the host computer of the visual inspection system, wherein the directory structure includes a root directory, multiple first-level directories constructed under the root directory, and multiple second-level directories constructed under each first-level directory, wherein the root directory corresponds to the defect data storage directory, each first-level directory corresponds to a date, and each second-level directory corresponds to a product specification model;
[0023] Step 2: When the visual inspection system is running, if the original image is judged as defective by the defect detection algorithm, the three items of defect data, namely the original image, defect data and judgment basis, are stored in the directory structure set by the host computer. The specific storage location is the secondary directory of the corresponding date and product specification model;
[0024] Step 3. When you need to view an original image, use the image viewing tool to directly open the original image in the corresponding secondary directory for viewing;
[0025] When a defect image needs to be viewed, first use the image viewing tool to open the original image in the corresponding secondary directory, then read the defect data and judgment basis, and load the defect data and judgment basis onto the original image to form a defect image;
[0026] When defect data statistics are required, first use the statistical tool to associate with the directory structure set in the host computer, load the root directory, and then filter all the data in the root directory according to the two query conditions of the start and end time period and product specification model to obtain the defect data that meets the filtering conditions, and then analyze and count the defect data, and display the statistical results in the display interface of the host computer;
[0027] When defect data needs to be migrated, the migration tool is associated with the directory structure set in the host computer, the migration date is set, and then all the first-level directories before that date and all the files under these first-level directories are transferred to the external data disk and saved in the root directory of the corresponding defect data storage directory preset in the external data disk. Finally, all the first-level directories that have been transferred and all the files under these first-level directories are deleted from the root directory of the directory structure set in the host computer to complete the migration of the defect data.
[0028] The defect data storage and query method of the visual inspection system of this embodiment is compared with the existing first method (only the original image and the defect image are stored as picture files respectively, and the defect data and the judgment basis are not saved, that is, the defect data includes the original image and the defect image): only the original image, the defect data and the judgment basis are stored as defect data, and the defect image is not stored. When the original image needs to be viewed, it can be viewed directly through the image viewing software. When the defect image needs to be viewed, the defect data and the judgment basis are loaded on the original image to form a defect image for viewing. Both the original image and the defect image are very convenient to view. Since the defect image is not stored, compared with the existing first method, the storage space of the defect image is saved, and the storage space occupied by the defect data is greatly reduced. In addition, since the defect data and the judgment basis are stored, statistical analysis can be performed, which is more convenient than the existing first method. At the same time, since the original image and its corresponding defect data and judgment basis are stored in the same secondary directory, when migrating the defect data, the secondary directory can be migrated as a whole, which is convenient to migrate the defect data.
[0029] The defect data storage and query method of the visual inspection system of this embodiment is compared with the existing second method (only the original image is stored as a picture file, the defect data and the judgment basis are stored in the database, and the defect image is not stored, that is, the defect data includes the original image, defect data and judgment basis): both of them only store the original image, defect data and judgment basis as defect data, which is convenient for viewing the original image and defect image, and the statistical analysis of defect data is also convenient. There is no need to store defect images, which reduces the storage space. The storage space occupied by defect data is small. However, when migrating defect data, the existing second method, in addition to directly copying the original image from the host computer to the external data disk, also needs to copy the original image one by one from the database according to the original image. Corresponding defect data and judgment basis are extracted from the database and stored in the database corresponding to the external data disk. In addition, a one-to-one correspondence between the original image and the defect data and judgment basis in the database needs to be re-established on the external data disk. Since the original image and its corresponding defect data and judgment basis are stored in the same secondary directory in the method of the present invention, when migrating the defect data, it is sufficient to migrate the secondary directory as a whole. That is, the migration of defect data in the present invention is a conventional file operation, and there is no need to decouple and extract the defect data and judgment basis in the database of the host computer. After migrating the defect data, there is no need to reload the defect data and judgment basis in the database of the external data disk. Therefore, it is more convenient to migrate defect data than the existing second method.
[0030] To sum up, the defect data storage and query method of the visual inspection system of the present invention is not only convenient for viewing original images and defect images, but also convenient for statistical analysis of defect data. The storage space occupied by the defect data is small, and the defect data can be easily migrated. It can cooperate with the visual inspection system to realize effective storage and query of defect data, and has broad application prospects.
Claims
1. A defect data storage and query method for a visual inspection system, characterized in that The following steps are involved: Step 1: construct a directory structure at the host computer of the visual inspection system, wherein the directory structure includes a root directory, multiple first-level directories constructed under the root directory, and multiple second-level directories constructed under each first-level directory, wherein the root directory corresponds to the defect data storage directory, each first-level directory corresponds to a date, and each second-level directory corresponds to a product specification model; Step 2: When the visual inspection system is running, if the original image is judged as defective by the defect detection algorithm, the three items of defect data, namely the original image, defect data and judgment basis, are stored in the directory structure set by the host computer. The specific storage location is the secondary directory of the corresponding date and product specification model; Step 3. When you need to view an original image, use the image viewing tool to directly open the original image in the corresponding secondary directory for viewing; When a defect image needs to be viewed, first use the image viewing tool to open the original image in the corresponding secondary directory, then read the defect data and judgment basis, and load the defect data and judgment basis onto the original image to form a defect image; When defect data statistics are required, first use the statistical tool to associate with the directory structure set in the host computer, load the root directory, and then filter all the data in the root directory according to the two query conditions of the start and end time period and product specification model to obtain the defect data that meets the filtering conditions, and then analyze and count the defect data, and display the statistical results in the display interface of the host computer; When defect data needs to be migrated, the migration tool is associated with the directory structure set in the host computer, the migration date is set, and then all the first-level directories before that date and all the files under these first-level directories are transferred to the external data disk and saved in the root directory of the corresponding defect data storage directory preset in the external data disk. Finally, all the first-level directories that have been transferred and all the files under these first-level directories are deleted from the root directory of the directory structure set in the host computer to complete the migration of the defect data.