Cloth defect detection system and method
Patent Information
- Application Number
- CN202510840054.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-20
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2045-06-20
AI Technical Summary
[0005]本申请实施例提供了一种布料瑕疵检测系统及方法,以至少解决传统的基于二维图像进行布料瑕疵识别的方案难以识别隆起、凹陷等三维瑕疵的技术问题
Smart Images

Figure CN120761379B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of fabric quality inspection technology, and more specifically, to a fabric defect detection system and method. Background Technology
[0002] In the field of textile quality control, fabric defect detection has always been a crucial step in ensuring product quality. Traditional manual inspection methods are not only inefficient but also susceptible to subjective factors, making it difficult to meet the high precision and speed requirements of modern large-scale production. In recent years, with the development of artificial intelligence technology, especially the advancements in image processing and deep learning algorithms, automated fabric defect detection systems have emerged, significantly improving detection efficiency and accuracy.
[0003] However, existing detection systems primarily rely on two-dimensional image analysis, limiting their ability to detect three-dimensional defects on fabric surfaces, such as localized bulges, depressions, or complex twists of yarn in space caused by textile processes. These three-dimensional defects may appear blurry or easily confused with other defects in two-dimensional images, making accurate differentiation difficult, especially at high production rates where precision requirements are even more stringent. Furthermore, while traditional structured light detection methods can acquire three-dimensional information about fabrics, their high hardware costs, complex maintenance, and insufficient pattern refresh rate make them unsuitable for production lines requiring high-frequency image acquisition, such as line scan camera scenarios. Simultaneously, the annotation of 3D data based on structured light images is complex and prone to errors, further impacting the performance of subsequent model training.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This application provides a fabric defect detection system and method to at least solve the technical problem that traditional fabric defect identification schemes based on two-dimensional images are difficult to identify three-dimensional defects such as bulges and depressions.
[0006] According to another aspect of the embodiments of this application, a fabric defect detection system is provided, including: a fabric inspection machine, a line scan camera, a first ordinary light source, a structured light generation unit, a control unit, and a detection unit. The fabric inspection machine is used to control the fabric to be inspected to move in a first direction at a first preset speed. The control unit is used to control the first ordinary light source and the structured light generation unit to alternately illuminate the fabric to be inspected at a preset switching frequency, and to control the line scan camera to acquire a first image of the fabric to be inspected under alternating illumination by the first ordinary light source and the structured light generation unit. The time for the line scan camera to capture one line of data is no greater than the duration of one turn of the first ordinary light source and the structured light generation unit, and the line direction corresponding to the line scan camera is perpendicular to the first direction. The detection unit is used to reconstruct the first image into a second image corresponding to ordinary light illumination and a third image corresponding to structured light illumination, analyze the second image using a pre-trained two-dimensional defect detection model to obtain a first detection result, analyze the third image using a pre-trained three-dimensional defect detection model to obtain a second detection result, and determine the defect state of the fabric to be inspected based on the first and second detection results.
[0007] Optionally, the illumination area of the first ordinary light source, the illumination area of the structured light generation unit, and the shooting field of view of the line scan camera are all preset target areas on the fabric inspection machine.
[0008] Optionally, the structured light generation unit includes: a second ordinary light source, a light shield, and a reciprocating motion mechanism, wherein the light shield is located below the second ordinary light source and has multiple evenly distributed light-transmitting holes, and the reciprocating motion mechanism is connected to the light shield; the control unit is used to control the reciprocating motion mechanism to drive the light shield to reciprocate in a second direction at a second preset speed, the second direction being perpendicular to the first direction.
[0009] Optionally, the light-shielding plate is a rectangular plate based on a semi-transparent material; the light-shielding plate is provided with a row of light-transmitting holes of the same shape and size that are evenly distributed.
[0010] Optionally, the control unit is configured to acquire pulse signals output by the encoder on the rotating shaft of the fabric inspection machine that controls the movement of the fabric to be inspected, and to perform the following control operations during the duration of each pulse signal: after the current pulse signal begins for a first preset duration, the control unit controls the first ordinary light source to turn on, the structured light generation unit to turn off, and the control unit controls the line scan camera to start one line exposure; after a second preset duration, the control unit controls the first ordinary light source to turn off, the structured light generation unit to turn on, and the control unit controls the line scan camera to start the next line exposure; after a third preset duration, the control unit controls the structured light generation unit to turn off; wherein the sum of the first preset duration, the second preset duration, and the third preset duration is not greater than the duration of the pulse signal, and the time required for the line scan camera to expose one line is not greater than the smaller value of the second preset duration and the third preset duration; or, after the current pulse signal begins for a first preset duration, the control unit controls the structured light generation unit to turn on, the first ordinary light source to turn off, and the control unit controls the line scan camera to start one line exposure; after a second preset duration, the control unit controls the structured light generation unit to turn off, the first ordinary light source to turn on, and the control unit controls the line scan camera to start the next line exposure; after a third preset duration, the control unit controls the first ordinary light source to turn off.
[0011] Optionally, the detection unit is used to split the first image line by line; when the first ordinary light source is turned on during the duration of each pulse signal, all odd-numbered rows of data are sequentially stitched into a second image, and all even-numbered rows of data are sequentially stitched into a third image; when the structured light generation unit is turned on during the duration of each pulse signal, all even-numbered rows of data are sequentially stitched into a second image, and all odd-numbered rows of data are sequentially stitched into a third image.
[0012] Optionally, the system further includes a model training module, which trains the two-dimensional defect detection model and the three-dimensional defect detection model in the following manner: constructing a first target detection model and a second target detection model respectively; acquiring multiple fourth images corresponding to multiple pieces of fabric captured by a line scan camera, wherein the acquisition method of each fourth image is the same as that of the first image; for each fourth image, recombining the fourth image into a fifth image corresponding to ordinary light illumination and a sixth image corresponding to structured light illumination; labeling the fabric defect areas and types in the fifth image and adding the labeling information to the same location area in the sixth image, and simultaneously labeling the fabric defect areas and types in the sixth image and adding the labeling information to the same location area in the fifth image; using each labeled fifth image as a first training sample and each labeled sixth image as a second training sample; iteratively training the first target detection model using multiple first training samples to obtain a two-dimensional defect detection model, and iteratively training the second target detection model using multiple second training samples to obtain a three-dimensional defect detection model.
[0013] Optionally, the detection unit is configured to determine each first candidate defect frame and its corresponding defect type in the first detection result, and to determine each second candidate defect frame and its corresponding defect type in the second detection result; determine a first candidate defect frame whose position does not overlap with any of the second candidate defect frames as a first target defect frame; determine a second candidate defect frame whose position does not overlap with any of the first candidate defect frames as a second target defect frame; for first candidate defect frames and second candidate defect frames that overlap, determine the priority between the defect type corresponding to the first candidate defect frame and the defect type corresponding to the second candidate defect frame based on a preset priority relationship table, and determine the candidate defect frame corresponding to the defect type with higher priority as a third target defect frame; and determine the defect state of the fabric to be inspected based on each first target defect frame, second target defect frame, third target defect frame and its corresponding defect type.
[0014] According to another aspect of the embodiments of this application, a fabric defect detection method is also provided, comprising: acquiring a first image of a fabric to be inspected on a fabric inspection machine captured by a line scan camera under alternating illumination by a first ordinary light source and a structured light generation unit, wherein the fabric inspection machine is used to control the fabric to be inspected to move in a first direction at a first preset speed, the time for the line scan camera to capture one line of data is not greater than the duration of the first ordinary light source and the structured light generation unit being turned on once, and the line direction corresponding to the line scan camera is perpendicular to the first direction; reconstructing the first image into a second image corresponding to ordinary light illumination and a third image corresponding to structured light illumination; analyzing the second image using a pre-trained two-dimensional defect detection model to obtain a first detection result, and analyzing the third image using a pre-trained three-dimensional defect detection model to obtain a second detection result; and determining the defect state of the fabric to be inspected based on the first detection result and the second detection result.
[0015] Optionally, determining the defect status of the fabric to be inspected based on the first and second inspection results includes: determining each first candidate defect frame and its corresponding defect type in the first inspection results, and determining each second candidate defect frame and its corresponding defect type in the second inspection results; determining a first candidate defect frame whose position does not overlap with any of the second candidate defect frames as a first target defect frame; determining a second candidate defect frame whose position does not overlap with any of the first candidate defect frames as a second target defect frame; for first and second candidate defect frames that overlap, determining the priority between the defect type corresponding to the first candidate defect frame and the defect type corresponding to the second candidate defect frame based on a preset priority relationship table, and determining the candidate defect frame corresponding to the defect type with higher priority as a third target defect frame; and determining the defect status of the fabric to be inspected based on each first target defect frame, second target defect frame, third target defect frame and its corresponding defect type.
[0016] According to another aspect of the embodiments of this application, a computer program product is also provided, the computer program product comprising: a computer program, wherein the computer program, when executed by a processor, implements the above-described fabric defect detection method.
[0017] According to another aspect of the embodiments of this application, an electronic device is also provided, the electronic device including: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-described fabric defect detection method through the computer program.
[0018] In this embodiment, the provided fabric defect detection system includes: a fabric inspection machine, a line scan camera, a first ordinary light source, a structured light generation unit, a control unit, and a detection unit. The fabric inspection machine controls the fabric to be inspected to move at a first preset speed in a first direction. The control unit controls the first ordinary light source and the structured light generation unit to alternately illuminate the fabric to be inspected at a preset switching frequency, and controls the line scan camera to acquire a first image of the fabric under alternating illumination by the first ordinary light source and the structured light generation unit. The time for the line scan camera to capture one line of data is the same as the duration of one activation of the first ordinary light source and the structured light generation unit, and the line direction corresponding to the line scan camera is perpendicular to the first direction. The detection unit reconstructs the first image into a second image corresponding to ordinary light illumination and a third image corresponding to structured light illumination. It analyzes the second image using a pre-trained two-dimensional defect detection model to obtain a first detection result, and analyzes the third image using a pre-trained three-dimensional defect detection model to obtain a second detection result. Based on the first and second detection results, it determines the defect state of the fabric to be inspected. By introducing a structured light generation unit, the three-dimensional features of the fabric surface can be captured, which is crucial for identifying defects that are not obvious in two-dimensional images. Through an alternating illumination strategy, the system can simultaneously acquire two images: one reflecting the two-dimensional characteristics of the fabric and the other reflecting its three-dimensional information. This ensures the high fidelity of the original two-dimensional defect detection while enhancing the recognition of three-dimensional defects. The acquired first image is split and recombined, and a complementary annotation method is used on the basis of group storage, which reduces the annotation difficulty. Thus, it solves the technical problem that traditional two-dimensional image-based fabric defect recognition schemes are unable to identify three-dimensional defects such as bulges and depressions. Attached Figure Description
[0019] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0020] Figure 1 This is a schematic diagram of an optional fabric defect detection system according to an embodiment of this application;
[0021] Figure 2 This is a schematic diagram of an optional structured light generation unit according to an embodiment of this application;
[0022] Figure 3 This is a flowchart illustrating an optional fabric defect detection method according to an embodiment of this application;
[0023] Figure 4 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of this application. Detailed Implementation
[0024] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0025] It should be noted that the terms "first," "second," etc., used in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0026] To better understand the embodiments of this application, the following is a translation and explanation of some nouns or terms that appear in the description of the embodiments of this application:
[0027] Fabric inspection machine: A mechanical device used in textile production that can automatically or manually unfold, convey, and wind fabric, allowing it to move smoothly during inspection and facilitating full-width defect detection. Fabric inspection machines are typically equipped with lighting systems and adjustable conveyor speeds to accommodate different types of fabrics and inspection needs.
[0028] Structured light is an active vision technology widely used in 3D shape measurement, object recognition, and robot navigation. Its basic principle is to project a light field with specific structural features, such as stripes, grids, dot patterns, or other coded patterns, onto the observed object. A camera then captures the reflection or scattering images of these structured light fields after the object's surface deforms. Because the undulations or structural characteristics of the object's surface cause changes in the position, size, and intensity of the light spot, the object's 3D geometric information can be reconstructed by comparing these changes with the original projected structured light pattern.
[0029] Defect Conditions: There are various types of defects, the most common of which include stains, holes, yarn breaks, uneven weaving, color differences, and three-dimensional defects. Uneven weaving typically refers to localized bumps, depressions, or discontinuous textures on the fabric surface, usually caused by improper tension control or equipment malfunction during the weaving process. Three-dimensional defects, on the other hand, generally refer to highly variable defects formed on or within the fabric surface, such as surface bulges, depressions, or complex spatial twists of yarns caused by the weaving process. These defects may not be easily detected in two-dimensional images.
[0030] Example 1
[0031] According to an embodiment of this application, a fabric defect detection system is provided. Figure 1 A schematic diagram of a fabric defect detection system is shown, as follows: Figure 1 As shown, the fabric defect detection system includes at least: a fabric inspection machine 11, a line scan camera 12, a first ordinary light source 13, a structured light generation unit 14, a control unit 15, and a detection unit 16, wherein:
[0032] The fabric inspection machine can control the fabric to be inspected to move in a first direction at a first preset speed.
[0033] As a crucial component of fabric defect detection, the fabric inspection machine's control system must possess the ability to precisely regulate the fabric's movement on the production line. This includes the ability to control the continuous movement of the fabric along the inspection path according to a preset inspection speed (first preset speed), ensuring that every inch of the fabric surface is fully displayed in front of the vision inspection system. The first direction specifically refers to the direction in which the fabric moves along the production line, i.e., the unwinding to rewinding direction of the fabric inspection machine. During actual inspection, the fabric's movement speed in this direction can be set as needed. An encoder is connected to the rotating shaft on the fabric inspection machine that controls the movement of the fabric to be inspected. The frequency of the encoder's output pulse signal changes with the first preset speed.
[0034] The control unit can control the first ordinary light source and the structured light generation unit to alternately illuminate the fabric to be tested according to a preset switching frequency, and control the line scan camera to collect the first image of the fabric to be tested under the alternating illumination of the first ordinary light source and the structured light generation unit. The time for the line scan camera to capture one line of data is no greater than the duration of the first ordinary light source and the structured light generation unit being turned on once. The line direction corresponding to the line scan camera is perpendicular to the first direction.
[0035] The control unit is the core of the entire fabric defect detection system. It is responsible for precisely controlling the alternating on and off of the first ordinary light source and the structured light generation unit, ensuring that they switch at a preset switching frequency. The preset switching frequency and the first preset speed satisfy a certain constant relationship. The setting of this frequency needs to take into account the movement speed of the fabric on the inspection machine (the first preset speed) and the image acquisition frequency of the line scan camera, so that the duration of the light source being on is not less than the time required for the camera to capture one line of data.
[0036] Under the command of the control unit, the line scan camera captures only one line of data per exposure. The direction of this line of data (line direction) is perpendicular to the direction of fabric movement on the inspection machine (first direction). This design allows the line scan camera to work continuously on high-speed production lines without delay or blurring caused by capturing full-width images. Due to the continuous movement of the fabric and the alternating illumination of the light source, the line scan camera can seamlessly capture images of the fabric under different lighting conditions, i.e., images acquired alternately under ordinary light sources and structured light sources.
[0037] The detection unit can reconstruct the first image into a second image corresponding to ordinary light illumination and a third image corresponding to structured light illumination. It analyzes the second image using a pre-trained two-dimensional defect detection model to obtain a first detection result, and analyzes the third image using a pre-trained three-dimensional defect detection model to obtain a second detection result. Based on the first and second detection results, it determines the defect status of the fabric to be detected.
[0038] The first image was recombined to form two datasets, each corresponding to an image under a different lighting condition, providing rich and complementary information for subsequent defect detection.
[0039] The following section explains the functions of each module of the fabric defect detection system in conjunction with the specific implementation process.
[0040] As an optional implementation, the illumination area of the first ordinary light source, the illumination area of the structured light generation unit, and the field of view of the line scan camera are all preset target areas on the fabric inspection machine. Specifically, the layout of the camera and light source is not limited to a single mode, but can be flexibly adjusted according to actual production needs and fabric characteristics to optimize the inspection effect. Common layout schemes mainly include the following.
[0041] Front inspection layout: The first ordinary light source, structured light generation unit and line scan camera are all installed above the fabric inspection machine to directly photograph the front of the fabric, which is suitable for scenarios where it is necessary to clearly see fabric defects.
[0042] Backside inspection layout: All components are installed below the fabric inspection machine. It detects potential defects by irradiating the back of the fabric. It is suitable for situations where it is necessary to inspect the back of the fabric or internal defects such as perforations and yarn breaks.
[0043] Backlight detection layout: The light source (including the first ordinary light source and the structured light generation unit) is placed below the fabric, and the line scan camera is located above it. The fabric is illuminated by backlight, so that the defects form shadows or brightness changes on the front, thereby improving the detection rate of certain types of defects.
[0044] Dual-sided inspection layout: Ordinary light source and structured light generation unit are installed on both sides of the fabric respectively, and line scan camera takes pictures of the fabric on the same side. By alternating illumination of front and back light, the inspection range is expanded, which can more comprehensively check the defects on the surface and inside of the fabric. It is suitable for complex environments that require comprehensive evaluation of fabric quality.
[0045] Regardless of the layout chosen, the key is to ensure that the area illuminated by the light source matches the field of view of the line scan camera, covering the same pre-defined target area to achieve accurate capture and analysis of fabric defects. This flexible layout design allows the system to adapt to the inspection needs of different types of fabrics, improving the applicability and efficiency of the inspection. Furthermore, by adjusting the illumination angle and intensity of the light source, image quality can be further optimized, enhancing the ability to identify specific types of defects, thereby improving the overall performance of the inspection system.
[0046] As an optional implementation, the structured light generation unit includes: a second ordinary light source, a light shield, and a reciprocating motion mechanism. The light shield is located below the second ordinary light source and has multiple evenly distributed light-transmitting holes. The reciprocating motion mechanism is connected to the light shield. The control unit can control the reciprocating motion mechanism to drive the light shield to reciprocate in a second direction at a second preset speed. The second direction is perpendicular to the first direction.
[0047] Figure 2 A schematic diagram of a structured light generation unit is shown. Figure 2 As can be seen, the light-blocking plate is a rectangular plate, and a row of evenly distributed light-transmitting holes are arranged along its length on the light-blocking plate.
[0048] As an optional implementation, the light-shielding plate is a rectangular plate based on a semi-transparent material; the light-shielding plate is provided with a row of light-transmitting holes of the same shape and size that are evenly distributed.
[0049] Specifically, the light-blocking plate is primarily made of a semi-transparent material. This material allows a certain amount of light to pass through even in the parts that block light, preserving the texture and color information of the fabric surface. This is crucial for detecting two-dimensional defects in structured light mode. The shape and size of the light-transmitting holes must be uniform to ensure consistent light intensity and distribution patterns across all holes, thus forming a standardized structured light pattern that facilitates subsequent image analysis and deep learning model training.
[0050] For uniformly distributed light-transmitting holes, the distance between holes and the size of the holes are precisely calculated to accommodate the line scanning characteristics of the line scan camera. The presence of the light-transmitting holes allows the light emitted from the light source to form a series of bright areas on the fabric, while the light-blocking areas between the holes create shadows. This series of alternating light and dark stripes, with the reciprocating movement of the light-blocking plate, generates dynamic structured light on the fabric surface, such as sinusoidal shadow patterns, which contain rich three-dimensional information about the fabric surface.
[0051] By combining a conventional light source with a light-shielding plate, the expensive projector in traditional structured light systems is replaced, significantly reducing costs and simplifying maintenance. The dynamic movement of the light-shielding plate combined with the high-speed imaging capability of the line scan camera generates clear structured light images even in high-speed production environments, providing strong support for real-time detection of fabric defects. Furthermore, due to the design of the light-shielding plate and its apertures, structured light not only provides three-dimensional information but also preserves the texture and color features of two-dimensional images, enabling the detection system to simultaneously identify and distinguish between two-dimensional and three-dimensional defects, thus improving the overall accuracy and reliability of the detection.
[0052] As an optional implementation, the control unit can acquire the pulse signal output by the encoder on the rotating shaft of the fabric inspection machine that controls the movement of the fabric to be inspected, and perform the following control operations during the duration of each pulse signal: after the current pulse signal begins for a first preset duration, control the first ordinary light source to turn on, the structured light generation unit to turn off, and control the line scan camera to start one line exposure; after a second preset duration, control the first ordinary light source to turn off, the structured light generation unit to turn on, and control the line scan camera to start the next line exposure; after a third preset duration, control the structured light generation unit to turn off; wherein, the sum of the first preset duration, the second preset duration, and the third preset duration is not greater than the duration of the pulse signal, and the time required for the line scan camera to expose one line is not greater than the smaller value of the second preset duration and the third preset duration; or, after the current pulse signal begins for a first preset duration, control the structured light generation unit to turn on, the first ordinary light source to turn off, and control the line scan camera to start one line exposure; after a second preset duration, control the structured light generation unit to turn off, the first ordinary light source to turn on, and control the line scan camera to start the next line exposure; after a third preset duration, control the first ordinary light source to turn off.
[0053] The control unit acts as the central hub connecting and coordinating the fabric inspection machine, the light source, and the line scan camera. Its core function lies in its ability to accurately analyze the pulse signals output by the encoder, reflecting the fabric's movement at a first preset speed. Using each pulse signal, the control unit executes a series of complex control operations to ensure precise switching of the light source and efficient image acquisition by the camera on the high-speed production line.
[0054] The following explanation, using the standard light source-first mode as an example, details the specific control process of the control unit. When the encoder outputs a pulse signal, the system responds and initiates a control cycle T, which includes two start-up switches of the light source state and two camera shooting events.
[0055] Upon receiving a pulse signal, the control unit can send instructions to the light source and camera after a first preset duration t1. t1 can be set manually; when set to 0, it indicates that instructions are sent immediately upon receiving the signal. Specifically, the control unit can first control the first ordinary light source to turn on for a second preset duration t2, during which the structured light generation unit remains off, while simultaneously controlling the line scan camera to complete one line of shooting. Afterward, the control unit can continue to control the structured light generation unit to turn on for a third preset duration t3, during which the first ordinary light source remains off, while simultaneously controlling the line scan camera to complete one line of shooting. Afterward, all light sources and cameras are turned off, waiting for the next pulse signal to arrive.
[0056] Let the duration of a pulse signal be T, then T = t1 + t2 + t3 + t4. The reason for reserving t4 here is that T may be too long, while the time t for the line scan camera to complete a line of shooting is relatively short. In order to save the energy consumption of the light source, it is only necessary to ensure that t2 ≥ t and t3 ≥ t, so as to achieve a stable and continuous image acquisition process and provide reliable data support for fabric defect detection.
[0057] For the acquisition process within one pulse cycle, one line of data can be acquired first while keeping the ordinary light source on and the structured light generation unit off, and then the next line of data can be acquired while keeping the ordinary light source off and the structured light generation unit on; alternatively, one line of data can be acquired first while keeping the structured light generation unit on and the ordinary light source off, and then the next line of data can be acquired while keeping the structured light generation unit off and the ordinary light source on. In other words, the alternating acquisition order within one pulse cycle can be determined and selected according to the actual situation, as long as the alternating acquisition order is consistent across all pulse cycles.
[0058] In summary, the control unit plays a crucial role in the fabric defect detection system. By precisely controlling the switching of light source states, the generation of structured light patterns, and the triggering of camera image acquisition, it achieves comprehensive capture of fabric surface features.
[0059] Specifically, to output a uniform and regular structured light pattern, the first preset speed of the fabric, the second preset speed of the light-shielding plate, the encoder pulse frequency, and the preset switching frequency should follow a certain coordination relationship. For example, the frequency of the pulse signal output by the encoder reflects the first preset speed of the fabric. When the first preset speed is constant, the frequency of the corresponding pulse signal is also determined, and there is a direct proportional relationship between the two. Furthermore, it is necessary to ensure that the frequency of the periodic movement of the light-shielding plate is proportional to the pulse frequency of the encoder, thereby ensuring that the frequency of the periodic movement of the light-shielding plate is proportional to the first preset speed of the fabric, so as to achieve synchronization between the change of the structured light pattern and the distance the fabric moves forward. In order to obtain a uniform sine curve, the light-shielding plate can perform periodic movement at the corresponding second preset speed in a regular acceleration or deceleration mode. By superimposing the periodic movement of the light-shielding plate in the second direction with the movement of the fabric in the first direction, the structured light pattern forms a continuous and orderly sine curve shadow on the fabric surface, which enhances the visualization effect of the three-dimensional features and is conducive to the accurate identification of three-dimensional defects in the future.
[0060] As an optional implementation, the detection unit can split the first image line by line; while controlling the first ordinary light source to be turned on during the duration of each pulse signal, all odd-numbered rows of data are sequentially stitched together to form the second image, and all even-numbered rows of data are sequentially stitched together to form the third image; while controlling the structured light generation unit to be turned on during the duration of each pulse signal, all even-numbered rows of data are sequentially stitched together to form the second image, and all odd-numbered rows of data are sequentially stitched together to form the third image.
[0061] When using a line scan camera for image acquisition, the alternating on / off mode of the light source results in the original acquired image actually containing alternating rows of structured light image data and ordinary light source image data. This unique image acquisition method requires the post-processing process to be integrated and highly intelligent and flexible in order to accurately distinguish and reassemble these data to form independent structured light images and ordinary light source images.
[0062] After the online scanning camera completes the row data acquisition for the first image, the image needs to be split row by row. This splitting process must be strictly synchronized with the light source control and camera shooting cycle to ensure that the image rows acquired under each pulse signal can be correctly classified into structured light images or conventional light source images. During the duration of each pulse signal, if the first conventional light source is activated first, all odd-numbered rows of data will be identified as conventional light source image data and sequentially stitched into the second image; while all even-numbered rows of data will be classified as structured light image data and stitched into the third image. Conversely, if the structured light generation unit is activated first, all even-numbered rows of data will form the second image (conventional light source image), while odd-numbered rows of data will form the third image (structured light source image). This precise image reconstruction logic ensures that even in complex environments with high-speed acquisition, image data can be correctly distinguished and reconstructed, laying the foundation for subsequent analysis and processing.
[0063] After splitting the row data, the specific row data needs to be stored in the corresponding image dataset. This process must ensure data integrity and correct row data sorting to avoid errors during image reconstruction.
[0064] After collecting sufficient row image data from both the ordinary light source image set and the structured light image set, the images will be reconstructed. This involves stitching together multiple row data images in sequence to form complete second and third images. This reconstruction process may also include steps such as image correction and stitching optimization to improve image quality and reduce errors caused by jitter or uneven lighting during image acquisition.
[0065] The process of splitting the first image line by line and sequentially stitching it into the second image (ordinary light source image) and the third image (structured light image) is a crucial step in ensuring that the fabric defect detection system can accurately identify and distinguish between two-dimensional and three-dimensional defects. This process not only requires the software to be highly intelligent and flexible, but also emphasizes close cooperation with the hardware control unit to achieve efficient synchronization of image acquisition and reconstruction.
[0066] In the application of fabric defect detection systems, accurate identification of two-dimensional and three-dimensional defects relies on mature and complete target detection models. Therefore, training the target detection model is of great significance for improving the detection and recognition capabilities of the entire system.
[0067] As an optional implementation, the system further includes a model training module. The model training module can train the two-dimensional defect detection model and the three-dimensional defect detection model as follows: Construct a first target detection model and a second target detection model respectively; acquire multiple fourth images corresponding to multiple pieces of fabric captured by a line scan camera, wherein the acquisition method of each fourth image is the same as that of the first image; for each fourth image, reassemble it into a fifth image corresponding to ordinary light illumination and a sixth image corresponding to structured light illumination; label the fabric defect areas and types in the fifth images and add the labeling information to the same location area in the sixth images, and simultaneously label the fabric defect areas and types in the sixth images and add the labeling information to the same location area in the fifth images; use each labeled fifth image as a first training sample and each labeled sixth image as a second training sample; iteratively train the first target detection model using multiple first training samples to obtain a two-dimensional defect detection model, and iteratively train the second target detection model using multiple second training samples to obtain a three-dimensional defect detection model.
[0068] Specifically, training a two-dimensional defect detection model and a three-dimensional defect detection model can include the following steps.
[0069] Step S1, Model Construction and Initialization.
[0070] The model training module first creates two deep learning object detection models: a first object detection model and a second object detection model. For the first object detection model, optimization focuses on the extraction and analysis of two-dimensional features such as texture, color, and shape. It employs a deep learning architecture suitable for two-dimensional image processing, such as depthwise separable convolution and residual connections, to improve the accuracy and speed of two-dimensional defect detection. For the second object detection model, the design emphasizes processing three-dimensional information. It can use model structures such as 3D convolution and Transformer to capture and analyze complex three-dimensional features reflected in structured light images, such as shadows and height variations, thereby improving the accuracy and efficiency of three-dimensional defect recognition. After determining the initial models for the first and second object detection models, they need to be initialized separately to facilitate the adjustment of initial parameters during subsequent iterative training for model optimization.
[0071] Step S2, image acquisition and reconstruction.
[0072] Continuous acquisition by a line-scan camera on the production line generates multiple fourth images. These images contain information from alternating rows of structured light and conventional light source images. Image splitting and recombination are then performed on these fourth images. Odd-numbered rows are stitched together to form a fifth image (ordinary light illumination image), and even-numbered rows are stitched together to form a sixth image (structured light illumination image). This recombination strategy ensures that both image sets are complete and match the original acquisition order, providing a structurally clear and information-rich data source for model training.
[0073] Step S3: Complementary labeling and data preparation.
[0074] After image reconstruction, the annotation process begins. The annotation tool reads and simultaneously displays the fifth and sixth images, allowing annotators to select one image for annotation based on the visibility of defects under different lighting conditions. Once a defect area and its type are annotated on the fifth image (normal light source image), this annotation information is automatically copied to the corresponding position in the sixth image (structured light image), and vice versa. This complementary annotation method fully utilizes the advantages of both structured light and normal light source images, improving annotation efficiency and accuracy. In particular, three-dimensional defects that are difficult to distinguish in normal light source images can be clearly seen in structured light images, facilitating annotation; while two-dimensional defects that are easily confused in structured light images can be clearly annotated in normal light source images.
[0075] Step S4: Generation of training samples and model training. Through the above annotation process, each pair of fifth and sixth images is transformed into a pair of training samples—the fifth image becomes the first training sample, used for training the 2D defect detection model; the sixth image serves as the second training sample, used for training the 3D defect detection model. After collecting a large number of first and second training samples, the model training module begins iterative training of these two models. The iterative training process involves continuously adjusting the model parameters until the model can accurately identify and classify fabric defects on new, unseen images. This training process may also include steps such as data augmentation, loss function optimization, and hyperparameter tuning to further improve the model's generalization ability and detection accuracy.
[0076] Step S5: Model fusion and optimization.
[0077] After training, the two models will detect 2D and 3D defects respectively. However, since the two types of defects may have overlapping or similar features in some cases, the model training module also needs to design a mechanism to integrate the detection results of the two models. This mechanism may include post-processing algorithms, such as voting mechanisms, threshold adjustment, or fusion algorithms, to ensure that the model can provide the most comprehensive and accurate detection results in practical applications. Furthermore, the model training module can periodically receive feedback data from the detection unit, enabling continuous optimization and upgrading of the model to adapt to the ever-changing fabric production environment and inspection needs.
[0078] In summary, the model training module constructs and trains two deep learning models, providing specialized recognition capabilities for 2D and 3D defect detection, respectively. Simultaneously, complementary annotation and data preparation processes ensure the quality and diversity of the model training data, effectively improving the model's detection performance and robustness.
[0079] As an optional implementation, the detection unit can determine each first candidate defect frame and its corresponding defect type in the first detection result, and determine each second candidate defect frame and its corresponding defect type in the second detection result; determine the first candidate defect frame whose position does not overlap with each of the second candidate defect frames as the first target defect frame; determine the second candidate defect frame whose position does not overlap with each of the first candidate defect frames as the second target defect frame; for first candidate defect frames and second candidate defect frames that overlap, determine the priority between the defect type corresponding to the first candidate defect frame and the defect type corresponding to the second candidate defect frame based on a preset priority relationship table, and determine the candidate defect frame corresponding to the defect type with higher priority as the third target defect frame; determine the defect state of the fabric to be detected based on each first target defect frame, second target defect frame, third target defect frame and its corresponding defect type.
[0080] When determining the defect status of the fabric to be inspected, the detection unit may specifically include the following steps.
[0081] Step S1: Preliminary acquisition of detection results.
[0082] The detection unit first processes the acquired images, including image segmentation, image reconstruction, and image preprocessing, to ensure that the image data is suitable for input into the model for further inference. Subsequently, the image data is fed into two models for detection: a conventional light source model and a structured light model. Each model generates a set of detection results, containing multiple candidate defect boxes and their corresponding defect types.
[0083] Step S2: Classification and filtering of defective frames.
[0084] For the detection results output by the two models, the detection unit needs to classify and filter them. Specifically, the detection unit will identify the "first target defect box," which is the first candidate defect box that does not overlap with either the first detection result (normal light source model detection result) or the second detection result (structured light model detection result). Similarly, the detection unit identifies the second target defect box to identify those second candidate defect boxes that do not overlap with either the first detection result (normal light source model detection result) or the second detection result (structured light model detection result). When processing detection boxes with overlapping positions, the detection unit will determine the final defect type based on a preset priority relationship. The priority relationship table defines the priority of different defect types in the detection process. For example, the priority of three-dimensional defects may be higher than that of two-dimensional defects because three-dimensional defects have a more direct impact on the quality of the fabric and subsequent processing performance. Based on this principle, for each overlapping first and second candidate defect boxes, the detection unit determines which defect type has a higher priority and selects the candidate defect box corresponding to the higher-priority defect type as the "third target defect box". This process ensures that the defect information most likely to affect the fabric quality is retained in the overlapping detection results.
[0085] Step S3: Determining the final defect state.
[0086] Finally, the inspection unit determines the overall defect status of the fabric to be inspected based on all identified first, second, and third target defect frames and their corresponding defect types. This status reflects the distribution of all types of defects on the fabric surface, including two-dimensional and three-dimensional defects, and provides this information to subsequent processing units on the production line, such as defect marking and fabric sorting, for further quality control and management.
[0087] Prioritizing images with poor detection performance—that is, images where the model's output detection results have low reliability or fail to detect any defects—the detection unit executes a data feedback mechanism. These images are resubmitted to the annotation unit for manual review and annotation, and then sent back to the model training unit for targeted optimization and training. This mechanism ensures continuous model improvement, enabling it to better adapt to changes and challenges on the production line and enhancing the overall accuracy and reliability of the detection system.
[0088] The detection unit achieves comprehensive and accurate detection of two-dimensional and three-dimensional defects on the fabric surface through a sophisticated defect box classification, screening, and priority judgment process.
[0089] In this embodiment, the provided fabric defect detection system includes: a fabric inspection machine, a line scan camera, a first ordinary light source, a structured light generation unit, a control unit, and a detection unit. The fabric inspection machine controls the fabric to be inspected to move at a first preset speed in a first direction. The control unit controls the first ordinary light source and the structured light generation unit to alternately illuminate the fabric to be inspected at a preset switching frequency, and controls the line scan camera to acquire a first image of the fabric under alternating illumination by the first ordinary light source and the structured light generation unit. The time for the line scan camera to capture one line of data is the same as the duration of one activation of the first ordinary light source and the structured light generation unit, and the line direction corresponding to the line scan camera is perpendicular to the first direction. The detection unit can reconstruct the first image into a second image corresponding to ordinary light illumination and a third image corresponding to structured light illumination. It analyzes the second image using a pre-trained two-dimensional defect detection model to obtain a first detection result, and analyzes the third image using a pre-trained three-dimensional defect detection model to obtain a second detection result. Based on the first and second detection results, it determines the defect state of the fabric to be inspected. By introducing a structured light generation unit, the three-dimensional features of the fabric surface can be captured, which is crucial for identifying defects that are not obvious in two-dimensional images. Through an alternating illumination strategy, the system can simultaneously acquire two images: one reflecting the two-dimensional characteristics of the fabric and the other reflecting its three-dimensional information. This ensures the high fidelity of the original two-dimensional defect detection while enhancing the recognition of three-dimensional defects. The acquired first image is split and recombined, and a complementary annotation method is used on the basis of group storage, which reduces the annotation difficulty. Thus, it solves the technical problem that traditional two-dimensional image-based fabric defect recognition schemes are unable to identify three-dimensional defects such as bulges and depressions.
[0090] Example 2
[0091] Based on the fabric defect detection system in Embodiment 1, this application also provides a fabric defect detection method. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0092] Figure 3 This is a flowchart illustrating a fabric defect detection method according to an embodiment of this application, as shown below. Figure 3 As shown, the method includes the following steps:
[0093] Step S302: Acquire the first image of the fabric to be inspected on the fabric inspection machine captured by the line scan camera under alternating illumination by the first ordinary light source and the structured light generation unit. The fabric inspection machine can control the fabric to be inspected to move in the first direction at a first preset speed. The time for the line scan camera to capture one line of data is no greater than the duration of the first ordinary light source and the structured light generation unit being turned on once. The line direction corresponding to the line scan camera is perpendicular to the first direction.
[0094] Step S304: Reconstruct the first image into a second image corresponding to ordinary light illumination and a third image corresponding to structured light illumination;
[0095] Step S306: Analyze the second image using a pre-trained two-dimensional defect detection model to obtain a first detection result, and analyze the third image using a pre-trained three-dimensional defect detection model to obtain a second detection result;
[0096] Step S308: Determine the defect status of the fabric to be inspected based on the first and second inspection results.
[0097] The following describes each step of the fabric defect detection method in conjunction with the specific implementation process.
[0098] As an optional implementation, the illumination area of the first ordinary light source, the illumination area of the structured light generation unit, and the shooting field of view of the line scan camera are all preset target areas on the fabric inspection machine.
[0099] As an optional implementation, the structured light generation unit includes: a second ordinary light source, a light shield, and a reciprocating motion mechanism. The light shield is located below the second ordinary light source and has multiple evenly distributed light-transmitting holes. The reciprocating motion mechanism is connected to the light shield. The control unit can control the reciprocating motion mechanism to drive the light shield to reciprocate in a second direction at a second preset speed. The second direction is perpendicular to the first direction.
[0100] As an optional implementation, the light-shielding plate is a rectangular plate based on a semi-transparent material; the light-shielding plate is provided with a row of light-transmitting holes of the same shape and size that are evenly distributed.
[0101] As an optional implementation, the control unit can acquire the pulse signal output by the encoder on the rotating shaft of the fabric inspection machine that controls the movement of the fabric to be inspected, and perform the following control operations during the duration of each pulse signal: after the current pulse signal begins for a first preset duration, control the first ordinary light source to turn on, the structured light generation unit to turn off, and control the line scan camera to start one line exposure; after a second preset duration, control the first ordinary light source to turn off, the structured light generation unit to turn on, and control the line scan camera to start the next line exposure; after a third preset duration, control the structured light generation unit to turn off; wherein, the sum of the first preset duration, the second preset duration, and the third preset duration is not greater than the duration of the pulse signal, and the time required for the line scan camera to expose one line is not greater than the smaller value of the second preset duration and the third preset duration; or, after the current pulse signal begins for a first preset duration, control the structured light generation unit to turn on, the first ordinary light source to turn off, and control the line scan camera to start one line exposure; after a second preset duration, control the structured light generation unit to turn off, the first ordinary light source to turn on, and control the line scan camera to start the next line exposure; after a third preset duration, control the first ordinary light source to turn off.
[0102] As an optional implementation, the detection unit can split the first image line by line; while controlling the first ordinary light source to be turned on during the duration of each pulse signal, all odd-numbered rows of data are sequentially stitched together to form the second image, and all even-numbered rows of data are sequentially stitched together to form the third image; while controlling the structured light generation unit to be turned on during the duration of each pulse signal, all even-numbered rows of data are sequentially stitched together to form the second image, and all odd-numbered rows of data are sequentially stitched together to form the third image.
[0103] In the process of implementing fabric defect detection methods, accurate identification of two-dimensional and three-dimensional defects relies on a mature and complete target detection model. Therefore, training the target detection model is of great significance for improving the detection and recognition capabilities of the entire system.
[0104] As an optional implementation, the two-dimensional defect detection model and the three-dimensional defect detection model can be trained as follows: A first target detection model and a second target detection model are constructed respectively; multiple fourth images corresponding to multiple pieces of fabric are acquired by a line scan camera, wherein the acquisition method of each fourth image is the same as that of the first image; for each fourth image, the fourth image is recombined into a fifth image corresponding to ordinary light illumination and a sixth image corresponding to structured light illumination; the fabric defect areas and types in the fifth image are labeled, and the labeling information is added to the same location area in the sixth image; simultaneously, the fabric defect areas and types in the sixth image are labeled, and the labeling information is added to the same location area in the fifth image; each labeled fifth image is used as a first training sample, and each labeled sixth image is used as a second training sample; the first target detection model is iteratively trained using multiple first training samples to obtain a two-dimensional defect detection model, and the second target detection model is iteratively trained using multiple second training samples to obtain a three-dimensional defect detection model.
[0105] As an optional implementation, the detection unit determines the defect state of the fabric to be inspected based on the first detection result and the second detection result. Specifically, this can be achieved in the following way: determining each first candidate defect frame and its corresponding defect type in the first detection result, and determining each second candidate defect frame and its corresponding defect type in the second detection result; determining the first candidate defect frame whose position does not overlap with each of the second candidate defect frames as the first target defect frame; determining the second candidate defect frame whose position does not overlap with each of the first candidate defect frames as the second target defect frame; for first candidate defect frames and second candidate defect frames that overlap, determining the priority between the defect type corresponding to the first candidate defect frame and the defect type corresponding to the second candidate defect frame based on a preset priority relationship table, and determining the candidate defect frame corresponding to the defect type with higher priority as the third target defect frame; determining the defect state of the fabric to be inspected based on each first target defect frame, second target defect frame, third target defect frame and its corresponding defect type.
[0106] It should be noted that each implementation step of the fabric defect detection method in this application corresponds one-to-one with each module in the fabric defect detection system in Example 1. Since Example 1 has been described in detail, some details not shown in this embodiment can be referred to Example 1, and will not be elaborated further here.
[0107] Example 3
[0108] According to an embodiment of this application, a computer program product is also provided, which includes a computer program, wherein when the computer program is executed by a processor, it implements the fabric defect detection method in Embodiment 2.
[0109] According to an embodiment of this application, a non-volatile storage medium is also provided, which includes a stored computer program, wherein the device containing the non-volatile storage medium executes the fabric defect detection method in Embodiment 2 by running the computer program.
[0110] According to an embodiment of this application, a processor is also provided for running a computer program, wherein the computer program executes the fabric defect detection method of embodiment 2 when running.
[0111] According to an embodiment of this application, an electronic device is also provided, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the fabric defect detection method of embodiment 2 through the computer program.
[0112] Specifically, the computer program executes the following steps during runtime: acquiring a first image of the fabric to be inspected on the fabric inspection machine, captured by a line scan camera, under alternating illumination from a first ordinary light source and a structured light generation unit. The fabric inspection machine controls the fabric to be inspected to move in a first direction at a first preset speed. The time taken by the line scan camera to capture one line of data is no greater than the duration of one activation of the first ordinary light source and the structured light generation unit. The line direction corresponding to the line scan camera is perpendicular to the first direction. The first image is reconstructed into a second image corresponding to ordinary light illumination and a third image corresponding to structured light illumination. A pre-trained two-dimensional defect detection model is used to analyze the second image to obtain a first detection result, and a pre-trained three-dimensional defect detection model is used to analyze the third image to obtain a second detection result. The defect status of the fabric to be inspected is determined based on the first and second detection results.
[0113] As an alternative implementation, the above-mentioned electronic device may exist in the form of a mobile terminal, a computer terminal, or a similar computing device. Figure 4 A hardware block diagram of an electronic device for implementing a fabric defect detection method is shown. Figure 4 As shown, the electronic device 40 may include one or more processors 402 (shown as 402a, 402b, ..., 402n in the figure) 402 (processor 402 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 404 for storing data, and a transmission device 406 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 4 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, electronic device 40 may also include... Figure 4 The more or fewer components shown, or having the same Figure 4 The different configurations shown.
[0114] It should be noted that the aforementioned one or more processors 402 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element of the electronic device 40. As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0115] The memory 404 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the fabric defect detection method in this embodiment. The processor 402 executes various functional applications and data processing by running the software programs and modules stored in the memory 404, thereby implementing the aforementioned application vulnerability detection method. The memory 404 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 404 may further include memory remotely located relative to the processor 402, and these remote memories can be connected to the electronic device 40 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0116] The transmission device 406 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the electronic device 40. In one example, the transmission device 406 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 406 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0117] The display can be, for example, a touchscreen liquid crystal display (LCD), which allows the user to interact with the user interface of the electronic device 40.
[0118] The sequence numbers of the above embodiments are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0119] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0120] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.
[0121] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0122] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0123] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0124] The above are merely preferred embodiments of this application. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A fabric defect detection system, characterized in that, include: The system includes a fabric inspection machine, a line scan camera, a first ordinary light source, a structured light generation unit, a control unit, and a detection unit. The fabric inspection machine is used to control the fabric to be inspected to move in a first direction at a first preset speed; The control unit is used to control the first ordinary light source and the structured light generating unit to alternately illuminate the fabric to be tested according to a preset switching frequency, and to control the line scan camera to acquire the first image of the fabric to be tested under the alternating illumination of the first ordinary light source and the structured light generating unit, wherein the time for the line scan camera to capture one line of data is not greater than the duration of the first ordinary light source and the structured light generating unit being turned on once, and the line direction corresponding to the line scan camera is perpendicular to the first direction; The detection unit is used to reconstruct the first image into a second image corresponding to ordinary light illumination and a third image corresponding to structured light illumination, analyze the second image using a pre-trained two-dimensional defect detection model to obtain a first detection result, and analyze the third image using a pre-trained three-dimensional defect detection model to obtain a second detection result, and determine the defect status of the fabric to be detected based on the first detection result and the second detection result. The structured light generation unit includes: a second ordinary light source, a light shield, and a reciprocating motion mechanism. The light shield is a rectangular plate based on a semi-transparent material, and a row of light-transmitting holes of the same shape and size are provided on the light shield. The light shield is located below the second ordinary light source, and the reciprocating motion mechanism is connected to the light shield. The control unit is used to control the reciprocating motion mechanism to drive the light-shielding plate to reciprocate in a second direction at a second preset speed, wherein the second direction is perpendicular to the first direction.
2. The system according to claim 1, characterized in that, The illumination area of the first ordinary light source, the illumination area of the structured light generation unit, and the field of view of the line scan camera are all preset target areas on the fabric inspection machine.
3. The system according to claim 1, characterized in that, The control unit is configured to acquire the pulse signal output by the encoder on the rotating shaft of the fabric inspection machine that controls the movement of the fabric to be inspected, and to perform the following control operations during the duration of each pulse signal: After the current pulse signal begins for a first preset duration, the first ordinary light source is turned on, the structured light generation unit is turned off, and the line scan camera begins one line of exposure; after a second preset duration, the first ordinary light source is turned off, the structured light generation unit is turned on, and the line scan camera begins the next line of exposure; after a third preset duration, the structured light generation unit is turned off; wherein, the sum of the first preset duration, the second preset duration, and the third preset duration is not greater than the duration of the pulse signal, and the time required for the line scan camera to expose one line is not greater than the smaller value of the second preset duration and the third preset duration; or, After the current pulse signal starts for a first preset duration, the structured light generation unit is turned on, the first ordinary light source is turned off, and the line scan camera is controlled to start one line exposure; after a second preset duration, the structured light generation unit is turned off, the first ordinary light source is turned on, and the line scan camera is controlled to start the next line exposure; after a third preset duration, the first ordinary light source is turned off.
4. The system according to claim 3, characterized in that, The detection unit is used to split the first image line by line; when the first ordinary light source is turned on during the duration of each pulse signal, all odd-numbered rows of data are sequentially stitched into the second image, and all even-numbered rows of data are sequentially stitched into the third image; when the structured light generation unit is turned on during the duration of each pulse signal, all even-numbered rows of data are sequentially stitched into the second image, and all odd-numbered rows of data are sequentially stitched into the third image.
5. The system according to claim 1, characterized in that, The system also includes a model training module, which is used to train the two-dimensional defect detection model and the three-dimensional defect detection model in the following manner: Construct a first target detection model and a second target detection model respectively; Multiple fourth images corresponding to multiple pieces of fabric captured by the line scan camera are obtained, wherein the acquisition method of each fourth image is the same as the acquisition method of the first image; For each fourth image, the fourth image is reconstructed into a fifth image corresponding to ordinary light illumination and a sixth image corresponding to structured light illumination; the fabric defect areas and types in the fifth image are marked, and the marking information is added to the same area in the sixth image; at the same time, the fabric defect areas and types in the sixth image are marked, and the marking information is added to the same area in the fifth image. Each labeled fifth image is used as a first training sample, and each labeled sixth image is used as a second training sample; The first target detection model is iteratively trained using multiple first training samples to obtain the two-dimensional defect detection model, and the second target detection model is iteratively trained using multiple second training samples to obtain the three-dimensional defect detection model.
6. The system according to claim 1, characterized in that, The detection unit is configured to: determine each first candidate defect frame and its corresponding defect type in the first detection result; determine each second candidate defect frame and its corresponding defect type in the second detection result; determine a first candidate defect frame whose position does not overlap with any of the second candidate defect frames as a first target defect frame; determine a second candidate defect frame whose position does not overlap with any of the first candidate defect frames as a second target defect frame; for first candidate defect frames and second candidate defect frames that overlap, determine the priority between the defect type corresponding to the first candidate defect frame and the defect type corresponding to the second candidate defect frame based on a preset priority relationship table, and determine the candidate defect frame corresponding to the defect type with higher priority as a third target defect frame; and determine the defect state of the fabric to be tested based on each first target defect frame, second target defect frame, third target defect frame and its corresponding defect type.
7. A method for detecting fabric defects, characterized in that, include: The system acquires a first image of the fabric to be inspected on a fabric inspection machine, captured by a line scan camera, under alternating illumination from a first ordinary light source and a structured light generating unit controlled by a control unit. The fabric inspection machine controls the fabric to be inspected to move in a first direction at a first preset speed. The time taken by the line scan camera to capture one line of data is no greater than the duration of one activation of the first ordinary light source and the structured light generating unit. The line direction corresponding to the line scan camera is perpendicular to the first direction. The structured light generating unit includes a second ordinary light source, a light-shielding plate, and a reciprocating motion mechanism. The light-shielding plate is a rectangular plate based on a semi-transparent material, and it has a row of uniformly distributed light-transmitting holes of the same shape and size. The light-shielding plate is located below the second ordinary light source. The reciprocating motion mechanism is connected to the light-shielding plate. The control unit controls the reciprocating motion mechanism to drive the light-shielding plate to reciprocate in a second direction at a second preset speed. The second direction is perpendicular to the first direction. The first image is reconstructed into a second image corresponding to ordinary light illumination and a third image corresponding to structured light illumination; The second image is analyzed using a pre-trained two-dimensional defect detection model to obtain a first detection result, and the third image is analyzed using a pre-trained three-dimensional defect detection model to obtain a second detection result. The defect status of the fabric to be tested is determined based on the first test result and the second test result.
8. The method according to claim 7, characterized in that, Determining the defect status of the fabric to be tested based on the first detection result and the second detection result includes: Determine each first candidate defect box and its corresponding defect type in the first detection result, and determine each second candidate defect box and its corresponding defect type in the second detection result; The first candidate defect box, which has no overlap with the positions of each of the second candidate defect boxes, is determined as the first target defect box. The second candidate defect box, which has no overlap with the positions of each of the first candidate defect boxes, is identified as the second target defect box. For first and second candidate defect frames that overlap in position, the priority between the defect type corresponding to the first candidate defect frame and the defect type corresponding to the second candidate defect frame is determined based on a preset priority relationship table, and the candidate defect frame corresponding to the defect type with higher priority is determined as the third target defect frame. The defect status of the fabric to be inspected is determined based on each of the first target defect frames, the second target defect frames, the third target defect frames, and the corresponding defect types.
9. A computer program product, characterized in that, include: A computer program, wherein when executed by a processor, the computer program implements the fabric defect detection method of claim 7 or 8.
10. An electronic device, characterized in that, include: A memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the fabric defect detection method of claim 7 or 8 through the computer program.
Citation Information
Patent Citations
Optical detection equipment
CN111721782A
Method and device for enhancing defect imaging contrast ratio of transparent material
CN115901777A