Industrial vision-based automatic shirt sewing detection system
By monitoring mechanical phase signals during the sewing process to generate a static time window, and using multi-zone directional lighting and image acquisition technology to calculate surface normal vector data, the morphological anomaly recognition of homogeneous and color materials during high-speed sewing was achieved, solving the problems of insufficient image alignment accuracy and real-time performance in traditional methods.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- LANZHOU SANMAO TEXTILE CLOTHING CO LTD
- Filing Date
- 2026-03-27
- Publication Date
- 2026-07-14
AI Technical Summary
During high-speed sewing, traditional visual methods based on single-frame grayscale, color contrast, or ordinary continuous image acquisition are difficult to balance image alignment accuracy and stable representation of subtle three-dimensional undulations, resulting in insufficient accuracy and real-time performance in identifying abnormal shapes. This is especially true under periodic fabric feeding and mechanical phase fluctuations.
The motion phase monitoring module monitors the phase signal of the mechanical mechanism, the timing synchronization control module generates a static time window and triggers a time-division signal, the multi-zone directional lighting module activates independent lighting sectors sequentially within the static time, the image acquisition module synchronously performs continuous exposure, the normal vector calculation module calculates the surface normal vector data, and the anomaly detection module performs morphological anomaly detection based on the normal vector data.
It enables the identification of morphological anomalies in homogeneous and color-matched sewing scenarios without stopping the machine, reduces the impact of mechanical phase fluctuations and feeding, ensures image alignment accuracy and real-time performance, and can stably identify anomalies such as broken threads, missing seams, floating threads, and wrinkles.
Smart Images

Figure CN122391088A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of industrial vision inspection and automated garment manufacturing, specifically to an automated shirt sewing inspection system based on industrial vision. Background Technology
[0002] In the automated garment sewing production process, the stitch quality inspection of workstations such as shirt plackets, cuff facings, and collar stands is usually carried out by industrial vision methods to collect images of the sewing area and identify defects. Based on this, it is determined whether there are abnormalities such as broken threads, missing stitches, loose threads, wrinkles, or local bulges. The sewing pattern can be monitored online without stopping the machine. With the continuous increase in the operating speed of automatic sewing equipment, traditional visual methods based on single-frame grayscale, color contrast or ordinary continuous image acquisition are often difficult to balance the image alignment accuracy under high-speed motion and the stable representation of small three-dimensional undulations for the detection of homogeneous and same colored material surfaces. They are easily affected by the periodic feeding of the fabric, mechanical phase fluctuations and surface texture noise, resulting in insufficient accuracy and real-time performance in the recognition of abnormal shapes. Summary of the Invention
[0003] To address the aforementioned technical problems, this invention provides an automated shirt sewing inspection system based on industrial vision. Specifically, the technical solution of this invention includes: The motion phase monitoring module is used to monitor the phase signal of the mechanical mechanism that drives the preset target object to perform periodic motion; The timing synchronization control module is connected in communication with the motion phase monitoring module. It is used to extract the static time window of the target object based on the phase signal and generate a time-division trigger signal within the static time window. The multi-zone directional lighting module includes multiple independent lighting sectors distributed in different spatial orientations around the target object. It is connected to the timing synchronization control module to activate each independent lighting sector in sequence in response to a time-division trigger signal. The image acquisition module is set at a fixed observation angle of the target object and communicates with the timing synchronization control module. It is used to respond to the time-division trigger signal and synchronously perform continuous exposure operation when each independent illumination sector is activated in sequence, so as to obtain multi-directional illumination images of the target object in the same physical observation area in a static state. The normal vector calculation module is connected to the image acquisition module to receive multi-directional illumination images and calculate the surface normal vector data of the target object based on the photometric stereo algorithm. The anomaly detection module communicates with the normal vector calculation module and is used to extract three-dimensional topological features based on surface normal vector data and output the morphological anomaly detection results.
[0004] Optionally, the mechanical mechanism has a rotating shaft; the motion phase monitoring module includes: an incremental rotary encoder; the incremental rotary encoder, connected to the rotating shaft, is used to output rotating shaft angle data; a timing synchronization control module is used to compare the rotating shaft angle data with a preset absolute stationary angle range, and when the rotating shaft angle data falls into the absolute stationary angle range, it determines that it has entered the stationary time window and generates multiple time-division trigger signals sequentially according to a preset beat; and when the rotating shaft angle data does not fall into the absolute stationary angle range, it determines that it is in a motion window and stops generating the time-division trigger signals; when it detects that the rotating shaft angle data is missing or jumps causing timing conflicts, it prioritizes entering a protection state and stops outputting time-division trigger signals; or when it detects that the current stationary time window length is insufficient to complete the generation of all the time-division trigger signals, it executes a degradation strategy to only collect part of the azimuth image and marks the current period as a low-confidence frame.
[0005] Preferably, the multi-zone directional lighting module includes: a ring-shaped strobe light source; the ring-shaped strobe light source is divided into a first lighting sector, a second lighting sector, a third lighting sector, and a fourth lighting sector, each corresponding to a different spatial orientation, wherein the first lighting sector and the second lighting sector constitute opposing lighting in the vertical direction, and the third lighting sector and the fourth lighting sector constitute opposing lighting in the horizontal direction; the time-division trigger signal generated by the timing synchronization control module includes a first trigger pulse, a second trigger pulse, a third trigger pulse, and a fourth trigger pulse output sequentially; the multi-zone directional lighting module is used to sequentially activate the first lighting sector, the second lighting sector, the third lighting sector, and the fourth lighting sector in response to the first to the fourth trigger pulses.
[0006] Optionally, the image acquisition module includes: a global shutter industrial camera; the global shutter industrial camera is used to acquire a first azimuth illumination image, a second azimuth illumination image, a third azimuth illumination image, and a fourth azimuth illumination image respectively in response to a first trigger pulse to a fourth trigger pulse; the multi-azimuth illumination image is composed of the first azimuth illumination image, the second azimuth illumination image, the third azimuth illumination image, and the fourth azimuth illumination image; the first azimuth illumination image to the fourth azimuth illumination image continuously acquired by the image acquisition module within a static time window are in a sub-pixel level aligned state in physical space.
[0007] Optionally, the normal vector calculation module includes: a horizontal gradient calculation unit, used to calculate the pixel intensity difference between the third-position lighting image and the fourth-position lighting image to generate a horizontal normal component; a vertical gradient calculation unit, used to calculate the pixel intensity difference between the first-position lighting image and the second-position lighting image to generate a vertical normal component; and a vector fusion unit, connected to the horizontal gradient calculation unit and the vertical gradient calculation unit, used to use the horizontal and vertical normal components as the horizontal and vertical components of the surface gradient based on the Lambert cosine theorem, and to complete the depth component perpendicular to the image plane through the normal reconstruction formula, and after normalization processing, fuse and reconstruct surface normal vector data with three-dimensional directionality.
[0008] Optionally, the anomaly detection module includes: a low-pass filtering unit, used to perform Gaussian low-pass filtering on the surface normal vector data to filter out high-frequency surface noise and generate smooth normal vector data; a feature mapping unit, connected to the low-pass filtering unit, used to map the smooth normal vector data into a pseudo-color two-dimensional image; and a classification execution unit, connected to the feature mapping unit, used to input the pseudo-color two-dimensional image into a lightweight convolutional network classification model pre-trained with morphological anomaly samples; the lightweight convolutional network contains multiple cascaded depthwise separable convolutional modules, used to extract the three-dimensional topological spatial distribution features mapped in the pseudo-color two-dimensional image, and generate morphological anomaly detection results through a global average pooling layer and a fully connected output layer.
[0009] Optionally, the system is applied to production process inspection scenarios with periodic motion characteristics; the target object includes: material surface with homogeneous and homogeneous characteristics; the mechanical mechanism includes: equipment that drives the target object to perform periodic motion; the morphological anomaly includes: surface micro-structural defects or surface flatness anomalies.
[0010] Optionally, the system also includes: an edge computing module; a normal vector calculation module and an anomaly detection module are deployed in the edge computing module; the edge computing module adopts a multi-threaded asynchronous processing mechanism to establish an asynchronous pipeline and cache queue that includes acquisition, calculation and detection; when the number of cycles to be processed in the cache queue is greater than or equal to a preset threshold of 3 periodic movements of target objects, causing congestion and conflict in the processing threads, a degradation strategy execution instruction is triggered, prioritizing the retention of fine-grained areas with anomaly risk initially determined by the anomaly detection module through surface normal vector data, while enabling rapid screening of normal areas that are not identified as anomaly risk areas, or temporarily reducing the input resolution, in order to dynamically control the single-cycle pipeline throughput time from the acquisition of multi-directional illumination images by the image acquisition module to the output of the anomaly detection module's morphological anomaly detection result to be less than the single-cycle duration of periodic movement, so as to ensure that no image frame loss occurs during continuous high-speed production.
[0011] Compared with the prior art, the present invention has the following beneficial effects: 1. This invention uses a motion phase monitoring module to monitor the phase signal of the mechanical mechanism that drives the target object to perform periodic motion, and a timing synchronization control module extracts a stationary time window based on the phase signal and generates a time-division trigger signal within the stationary time window. This effectively avoids the problem of mis-collecting images during the fabric feeding motion in traditional continuous image acquisition methods, and unifies the originally conflicting requirements of acquiring multiple images and pixel space alignment in high-speed sewing into the same mechanical stationary window. 2. This invention sets up multiple independent lighting sectors distributed in different spatial orientations around the target object, and sequentially activates each independent lighting sector within a static time window. At the same time, the image acquisition module is controlled to perform continuous exposure operation synchronously when each independent lighting sector is activated in sequence. This ensures that the acquired multi-directional lighting images correspond to the same physically identical fabric area, thereby reducing the impact of mechanical phase fluctuations and periodic feeding on the alignment accuracy of multi-frame images. 3. This invention utilizes a global shutter industrial camera to complete continuous exposure under a fixed observation angle, and ensures that the first azimuth illumination image to the fourth azimuth illumination image are in a sub-pixel level aligned state in physical space, effectively suppressing the interference of rolling distortion and motion misalignment on pixel-by-pixel differential operations.
[0012] 4. The normal vector calculation module performs opposing illumination difference on multi-directional lighting images and fuses them to generate surface normal vector data. Then, the anomaly detection module extracts three-dimensional topological features based on the surface normal vector data. This is further combined with Gaussian low-pass filtering, pseudo-color two-dimensional image mapping, and a pre-trained image classification model for discrimination. This effectively weakens the unstable effects caused by similar surface colors of homogeneous and same-color materials, difficulty in separating grayscale edges, and surface texture noise. It transforms the originally inconspicuous small three-dimensional undulations into stable features. Ultimately, it can achieve stable identification of morphological anomalies such as broken threads, missing seams, floating threads, wrinkles, and bulges in homogeneous and same-color sewing scenarios such as white thread sewing white cloth without stopping the machine. Furthermore, with the help of the multi-threaded asynchronous processing mechanism of the edge computing module, the total processing delay from obtaining anomaly detection results from multi-directional lighting images is controlled within the duration of a single running cycle, thus balancing the accuracy and real-time performance of morphological anomaly identification. Attached Figure Description
[0013] The present invention will be further explained below with reference to the accompanying drawings and embodiments: Figure 1 This is a schematic diagram of the modules of the automatic shirt sewing detection system based on industrial vision provided in the embodiments of this application. Detailed Implementation
[0014] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments.
[0015] An industrial vision-based automated shirt sewing inspection system includes: The motion phase monitoring module is used to monitor the phase signal of the mechanical mechanism that drives the preset target object to perform periodic motion; the timing synchronization control module is connected in communication with the motion phase monitoring module and is used to extract the static time window of the target object based on the phase signal and generate a time-division trigger signal within the static time window; The multi-zone directional lighting module includes multiple independent lighting sectors distributed in different spatial orientations around the target object. It is connected to the timing synchronization control module to activate each independent lighting sector in sequence in response to a time-division trigger signal. The image acquisition module is set at a fixed observation angle of the target object and communicates with the timing synchronization control module. It is used to respond to the time-division trigger signal and synchronously perform continuous exposure operation when each independent illumination sector is activated in sequence, so as to obtain multi-directional illumination images of the target object in the same physical observation area in a static state. The normal vector calculation module is connected to the image acquisition module to receive multi-directional illumination images and calculate the surface normal vector data of the target object based on the photometric stereo algorithm. The anomaly detection module communicates with the normal vector calculation module and is used to extract three-dimensional topological features based on surface normal vector data and output the morphological anomaly detection results.
[0016] This embodiment provides a mechanism for online detection at an automated shirt sewing station, such as... Figure 1 As shown; specifically, this embodiment uses the high-speed sewing of a white shirt placket area with white sewing thread as a unified scenario. The sewing machine continuously feeds the fabric, and the fabric has a feeding motion segment and a needle-punching pause segment within a sewing cycle. The system does not continuously acquire images without difference throughout the entire cycle, but first monitors the motion phase of the mechanical mechanism, and then finds the time window in which the fabric is actually stationary within a cycle. Within this window, multi-directional time-division illumination and continuous exposure are completed to obtain multiple images of the same position under different lighting directions. Afterward, the system calculates the surface normal vectors of the fabric and stitches based on the brightness differences between the images, and judges whether there are morphological abnormalities such as broken threads, floating threads, missing seams, wrinkles, or local bulges based on the three-dimensional topological features formed by the normal vectors. In the specific implementation process, the motion phase monitoring module can receive phase information during the mechanical motion of the sewing equipment. This phase information can be any one or a combination of rotation angle, reciprocating position, and trigger pulse sequence. The timing synchronization control module establishes a cycle model based on this phase information. For example, a sewing cycle is divided into ten time periods of equal length, where time periods 1 to 6 correspond to the feeding motion, time periods 7 to 9 correspond to the temporary locking of the fabric after needle punching, and time period 10 corresponds to the mechanism returning to its original position. Based on this, the system defines the 7th to 9th time periods as the static time window; thereafter, the timing synchronization control module no longer outputs a single photo capture command, but generates multiple equally spaced trigger pulses based on the real-time angle value of the encoder within this window; for example, within the absolute static angle range of 180 degrees to 240 degrees when the spindle rotates, the timing synchronization control module issues four trigger pulses in sequence when it reaches 185 degrees, 200 degrees, 215 degrees and 230 degrees, to ensure that the time-sharing exposure time is strictly locked in a physically static state at different mechanical speeds; The multi-zone directional lighting module sets up multiple independent lighting sectors in different directions around the observation area above the needle plate. Each sector illuminates the placket seam area from different directions. The image acquisition module is fixed above the needle plate and does not move with the mechanical movement. It completes the exposure when it receives each trigger pulse. Since each exposure occurs within the same stationary window, the multiple images acquired correspond to the same physical fabric area. The normal vector calculation module treats these images as the brightness response of the same pixel under different incident light directions, and then uses the concept of photometric stereo to recover the tilt trend of the surface near the pixel; the anomaly detection module further converts the entire normal vector field into three-dimensional topological features that can be used for recognition, such as the abrupt change of normal vector at the edge of the line ridge, the gradual change of normal vector in the wrinkled area, and the lack of continuous convex structure in the normal vector of the gap area; based on these features, the detection results such as normal, broken line, skipped stitch, wrinkle, etc. can be output; As a specific application example, the following parameters are set: Assume a 2×2 pixel block is selected in the placket area, where the top left pixel is located at the raised edge of the seam, and the brightness values corresponding to the four illuminations are 60, 140, 120, and 80 respectively; if the brightness difference between two images from opposite directions is large, it indicates that the surface of the pixel is significantly tilted; if the four brightness values are similar, for example, all between 98 and 102, it indicates that the point is approximately flat; further assume that the brightness combinations of adjacent pixels show large differences, large differences, large differences, and large differences respectively, then the normal solution will form a continuous raised band, which can be determined as a complete stitch; if a continuous gap with small differences appears in the middle of this continuous band, it can be used as a candidate area for a broken thread or missing seam; As a fault-tolerant mechanism, if the motion phase monitoring module does not provide a valid phase signal temporarily, the timing synchronization control module can enter a protection state and stop outputting time-division trigger signals to avoid erroneous image acquisition during fabric movement. If the length of a certain static window is insufficient to complete all time-division exposures, for example, if a sudden increase in mechanical speed causes the static window to shorten, the system can execute a degradation strategy, acquiring only partial azimuth images and marking that period as a low-confidence frame, not directly used for the final abnormal alarm, but waiting for joint judgment in one or more subsequent periods. If the image acquisition module fails to expose a certain image, the normal calculation module can perform a validity check on the missing frames. When the number of valid images is lower than a preset lower limit, the result of that period is invalidated to prevent false alarms caused by incomplete data. For example, in the automatic shirt placket sewing station, the equipment runs at 4500 revolutions per minute, and the fabric is periodically fed intermittently as it passes under the presser foot; the system collects four multi-directional illumination images near the same needle position at each needle-punching pause; for scenarios with similar color characteristics, such as white thread sewing white fabric, ordinary grayscale edges cannot effectively separate the stitches from the base fabric, while this embodiment uses normal vector extraction to transform the originally inconspicuous small three-dimensional undulations into stable features, thereby continuously outputting needle position-level morphological anomaly discrimination results without stopping the machine; Furthermore, to maintain consistency in terminology, the aforementioned skipped stitches in this embodiment are used to describe the phenomenon of a local area not forming the expected continuous stitch during the sewing process. When classifying the detection results, they can be included in the category of missed stitches or as one of the specific manifestations of missed stitches. Therefore, the standard anomaly categories output by the anomaly discrimination module to the outside can be uniformly described as normal, broken thread, missed stitch, wrinkle, floating thread, bulge, etc., without changing the way the on-site defect phenomena were exemplified in the aforementioned example. Furthermore, unless otherwise specified, the timing synchronization control module mentioned above refers to the timing synchronization control module itself that performs static time window determination and time-division trigger output, and is an abbreviation of the same technical object in the engineering context; correspondingly, the camera is the specific imaging device in the image acquisition module, and does not change the established data flow and connection relationship between the image acquisition module and the timing synchronization control module, the multi-zone directional illumination module, and the normal calculation module; The purpose of this step is to unify the conflicting requirements of multiple image acquisitions and pixel space alignment during high-speed sewing into a single mechanical static window, thereby achieving high signal-to-noise ratio three-dimensional morphological detection of the sewing area of a shirt of the same color and material.
[0017] Furthermore, the mechanical mechanism has a rotating shaft; the motion phase monitoring module includes: an incremental rotary encoder; the incremental rotary encoder, connected to the rotating shaft, is used to output rotating shaft angle data; a timing synchronization control module is used to compare the rotating shaft angle data with a preset absolute stationary angle range, and when the rotating shaft angle data falls into the absolute stationary angle range, it determines that it has entered the stationary time window and generates multiple time-division trigger signals sequentially according to a preset rhythm, and when the rotating shaft angle data does not fall into the absolute stationary angle range, it determines that it is in a motion window and stops generating the time-division trigger signals; when it detects that the rotating shaft angle data is missing or jumps causing timing conflicts, it prioritizes entering a protection state to stop outputting time-division trigger signals; or when it detects that the current stationary time window length is insufficient to complete the generation of all the time-division trigger signals, it executes a degradation strategy to only collect part of the azimuth image and marks the current period as a low-confidence frame.
[0018] This embodiment provides a mechanism for locking the stationary time window based on the rotation axis angle. Specifically, in the aforementioned shirt placket sewing scenario, simply acquiring the periodic motion characteristics of the equipment cannot meet the high-precision synchronization requirements. If a fixed time interval is used for triggering, slight fluctuations in the mechanical rotation speed may misplace the image capture time to the feeding section, resulting in displacement between multiple images. Therefore, this embodiment further utilizes an incremental rotary encoder connected to the main shaft to directly convert the mechanical cycle into angle data, and uses the absolute stationary angle range to determine when imaging is allowed. In the specific implementation process, the incremental rotary encoder is installed on the sewing machine spindle or the drive shaft synchronized with the spindle to output spindle angle data. The timing synchronization control module is first calibrated to obtain a stationary angle range corresponding to the actual mechanism posture. The calibration method can be: run the equipment at low speed, collect images of the presser foot area at different spindle angles or read the displacement sensor of the feeding mechanism to find the continuous angle segment where the fabric no longer moves. For example, if the system calibration finds that when the spindle rotates to 180 degrees to 240 degrees, the needle has penetrated the fabric, the feed dog is in the descending position, and the fabric is basically stationary in the plane, then this angle segment is written into the timing synchronization control module as the absolute stationary angle range. In actual operation, the timing synchronization control module continuously receives encoder angle data and compares the current angle with the angle range. If the current angle moves from 179 degrees to 180 degrees, it is determined that it has entered the static time window and the output of time-division trigger signals is allowed. If the current angle continues to increase and remains between 180 and 240 degrees, the timing synchronization control module outputs multiple trigger pulses according to a preset rhythm. If the angle exceeds 240 degrees, it is immediately determined that it has exited the static time window and subsequent triggering has stopped. In this way, regardless of whether the equipment speed increases from 4200 rpm to 4800 rpm or the slight phase drift is caused by changes in fabric thickness, the image acquisition always follows the actual mechanical posture rather than relying on an ideal time schedule. A simplified example is provided for illustration. Assume a cycle is divided into 360 angular units by the encoder, and the timing synchronization control module sets 180 to 240 as the effective range. Within a certain cycle, the angle sequence is 176, 182, 196, 212, 238, 244. For 176, the system determines it is still within the motion window and does not trigger. For 182, 196, 212, 238, the system determines it is within the stationary window and can arrange exposures sequentially. For 244, the system determines the stationary window has ended and stops subsequent triggering. If another cycle causes the angle sampling value to change to 178, 181, 205, 239, 243 due to acceleration or deceleration, it can also automatically adapt without needing to reset the fixed millisecond delay. As a fault-tolerant mechanism, if encoder pulse loss causes the current angle to be unreliably resolved, the timing synchronization control module can use the angle velocity of the most recent complete cycle for short-term prediction, but only maintain a preset transition period, such as within one cycle; if a stable angle input is not restored after this transition time, the system enters a safe stop state; if the thickness difference of different batches of shirt materials causes a slight change in the absolute static angle range, the system can perform recalibration when changing styles or materials, or update the window boundary by using a base range plus compensation offset; if residual displacement is detected within the calibration window, the effective range can be automatically shrunk, for example from 180 to 240 to 188 to 232, in exchange for higher static reliability; For example, in the continuous sewing of a shirt placket, the main shaft of the machine completes one revolution, which corresponds to one fabric feeding cycle. The timing synchronization control module reads the quadrature phase signal from the encoder and calculates the real-time angle. When the angle enters 180 to 240 degrees, the system recognizes that the fabric is stably constrained by the needle and presser foot. Only then are four time-division lighting and exposure allowed. In this way, even if the production cycle fluctuates, the image acquisition operation always falls within the same mechanical absolute stillness range. The purpose of this mechanism is to use the rotation axis angle as a unified time base to transform the problem of when to stop, which is originally easily affected by speed changes, into a repeatable and calibrable angle range comparison problem, thereby achieving high-precision synchronization between imaging triggering and mechanical state.
[0019] Furthermore, the multi-zone directional lighting module includes: a ring-shaped strobe light source; the ring-shaped strobe light source is divided into a first lighting sector, a second lighting sector, a third lighting sector, and a fourth lighting sector, each corresponding to a different spatial orientation, wherein the first lighting sector and the second lighting sector constitute opposing lighting in the vertical direction, and the third lighting sector and the fourth lighting sector constitute opposing lighting in the horizontal direction; the time-division trigger signal generated by the timing synchronization control module includes a first trigger pulse, a second trigger pulse, a third trigger pulse, and a fourth trigger pulse output sequentially; the multi-zone directional lighting module is used to sequentially activate the first lighting sector, the second lighting sector, the third lighting sector, and the fourth lighting sector in response to the first to the fourth trigger pulses.
[0020] This embodiment provides a mechanism for four-zone directional stroboscopic illumination. Specifically, in the aforementioned placket sewing inspection, if only a fixed illumination in a single direction is used, although a clear image can be obtained, the slight surface undulations will only produce shadows in one direction, and defects in another direction may be concealed. For example, shallow folds extending along the fabric direction are obvious under front-to-back illumination, but may be nearly flat under left-to-right illumination. Therefore, this embodiment divides the annular stroboscopic light source into four independent illumination sectors, and illuminates the four directions sequentially through four triggers to obtain complete illumination information for normal calculation. In practice, the ring-shaped stroboscopic light source is installed around the camera lens or the detection area, and its four sectors correspond to the four spatial orientations of up, down, left, and right. The timing synchronization control module sequentially sends the first to the fourth trigger pulses within the static time window. After the four sectors respond, they light up individually in sequence, and the other sectors are turned off each time they are lit to avoid light mixing. In this way, on the same piece of fabric at the same needle position, the system first obtains the illumination effect from the first orientation, and then obtains the illumination effects from the second, third, and fourth orientations. Due to the different light source directions, the light-receiving side and the backlight side of the raised surface of the stitch will experience measurable brightness changes, providing a basis for subsequent normal vector recovery. The effect of illumination differences can be illustrated through simplified examples. Suppose a pixel is located on the left slope of a seam. When illuminated from the left, this pixel is brighter, denoted as 130; when illuminated from the right, it is dimmer, denoted as 70. When illuminated from the front and back, the pixel's brightness is close to 100 and 95 respectively. This indicates that the pixel primarily exhibits a left-right tilt. If another pixel is located at the leading edge of a fold, its brightness is 140 when illuminated from above and 60 when illuminated from below, indicating that the pixel primarily exhibits a vertical tilt. Through four-sector illumination, the system can simultaneously perceive topological changes in different directions, rather than being limited to unidirectional shadows. As a fault-tolerance mechanism, if the luminous intensity of one of the four sectors decreases due to aging, the system can measure the actual brightness of that sector during power-on self-test or maintenance calibration, and increase the corresponding pulse drive current or extend the duration of that flash in the timing synchronization control module to compensate for the energy difference; if a sector fails to light up, the system can mark that cycle as incomplete and switch to a bidirectional coarse detection mode, only performing significant anomaly screening and not outputting fine normal vector results; if the edge of the detection area is unevenly illuminated due to the installation angle of the light source, the corresponding image can be normalized in brightness using pre-stored flat field correction parameters to reduce position-related errors. For example, in the inspection of a section of seam near the button edge of a white shirt placket, four lighting sectors can flash sequentially around the presser foot; the first sector illuminates from the front of the seam, the second sector illuminates from the back, the third sector illuminates from the left, and the fourth sector illuminates from the right; for the same stitch position, the raised edge of the stitch will show different light and dark distributions under the four illuminations, thereby distinguishing the originally almost identical white thread from the white fabric. Furthermore, to maintain consistency with the definitions of the vertical and horizontal normal components in the subsequent normal calculation module, this embodiment establishes a fixed correspondence between the illumination sectors and the image coordinate directions as follows: the first and second illumination sectors constitute a set of opposing illuminations, used to characterize the difference in illumination received in the vertical direction of the image; the third and fourth illumination sectors constitute another set of opposing illuminations, used to characterize the difference in illumination received in the horizontal direction of the image; the aforementioned front, back, left, and right are illustrative descriptions of the actual spatial positions of the light source, while horizontal and vertical are calculated descriptions based on the image coordinate system of the camera's imaging plane; after establishing a one-to-one correspondence through installation calibration, the two remain fixed throughout the text; Furthermore, once the above correspondence is determined, the timing synchronization control module outputs the first to the fourth trigger pulses in the same order in each subsequent cycle, without changing the meaning of the sector number due to the change in rotation speed. This ensures that the third-position illumination image and the fourth-position illumination image always correspond to the same set of horizontal opposing illumination, and the first-position illumination image and the second-position illumination image always correspond to the same set of vertical opposing illumination, thus avoiding the situation where the names of the sector physical direction and the normal component are mixed up. The purpose of this mechanism is to establish multi-source brightness observations that can be used for photometric stereoscopic calculations through partitioned, time-divisional, and directional illumination, thereby achieving complete sampling of various directional surface undulations.
[0021] Furthermore, the image acquisition module includes: a global shutter industrial camera; the global shutter industrial camera is used to acquire a first azimuth illumination image, a second azimuth illumination image, a third azimuth illumination image, and a fourth azimuth illumination image respectively in response to the first trigger pulse to the fourth trigger pulse; the multi-azimuth illumination image is composed of the first azimuth illumination image, the second azimuth illumination image, the third azimuth illumination image, and the fourth azimuth illumination image; the first azimuth illumination image to the fourth azimuth illumination image continuously acquired by the image acquisition module within a static time window are in a sub-pixel level aligned state in physical space.
[0022] This embodiment provides a multi-frame sub-pixel level aligned acquisition mechanism based on a global shutter camera. Specifically, in the aforementioned scheme, if a conventional rolling shutter camera is used, even if the illumination and triggering are locked within a stationary window, the start and end times of exposure for each row of the image are not completely consistent, and inter-row deformation may still occur under slight mechanical vibration, affecting the pixel-by-pixel comparison between images from different orientations. Therefore, this embodiment selects a global shutter industrial camera, which integrates the entire photosensitive surface corresponding to each exposure simultaneously, ensuring from a hardware perspective that there is no rolling distortion within the same frame. In practice, a global shutter industrial camera is fixedly mounted above the sewing needle plate at the observation position, with its lens field of view covering the placket seam and the adjacent fabric area. The camera responds to four trigger pulses to acquire images of the first, second, third, and fourth azimuth lighting, respectively. Since all four exposures occur within the same absolute static angle range, and the global shutter simultaneously captures the entire image during a single exposure, each image corresponds in physical space to the same texture area near the same needle position. The sub-pixel alignment here does not rely on subsequent software registration, but is the result of the combined effects of the same observation angle, the same lens, the same static window, synchronous exposure, and time-division lighting. The significance of this alignment can be illustrated through a simplified example. Assume the theoretical position of the center of a certain line trace in all four images is pixel coordinates (100.2, 58.7). If the system captures the image during motion, the four images may fall at (100.2, 58.7), (101.1, 58.9), (102.0, 59.2), and (102.8, 59.5), respectively. Subtracting these coordinates would mistakenly treat the actual displacement as a change in the normal vector. Using this embodiment, these four positions can be stabilized within the sub-pixel fluctuation range of (100.2, 58.7), (100.3, 58.7), (100.2, 58.8), and (100.3, 58.7). Pixel-level differences primarily reflect illumination differences rather than geometric misalignment, thus making them more suitable for normal vector calculation. As a fault-tolerance mechanism, if the camera causes overall field of view drift due to loose installation, the camera extrinsic parameters and region of interest position can be updated through daily calibration templates. Before the drift exceeds a preset threshold, the system can use fixed reference marks on the needle plate to perform micro-translation compensation. If the single static window is too short, causing the camera to not have enough time to complete four independent exposures, the resolution can be reduced, the exposure time shortened, or a camera with a higher frame rate can be selected. If the fabric still has high-frequency jitter below the preset displacement tolerance due to the impact of the presser foot, the system can perform a local consistency check before normal vector calculation. When it is found that the edge contour change between consecutive frames exceeds the threshold, the data of that period is discarded and the system waits for the next period to be resampled. For example, in the high-speed sewing area near the hem of the shirt placket, four illumination images correspond to a small field of view of about 3 mm × 3 mm around the same needle position; since the camera maintains a fixed downward angle during the four flashes and the fabric is in a mechanically locked state, the needle hole, fabric texture and stitch outline in these four images can remain highly overlapping, providing a reliable premise for subsequent pixel-level intensity difference. Furthermore, the sub-pixel alignment state here can be understood in engineering implementation as follows: after completing the rigid mounting of the camera, lens locking, trigger timing locking, and exposure time compression, using the fixed marks on the needle plate or the stable texture of the fabric as a reference, the main displacement between the four images is limited to less than 1 pixel, preferably within 0.5 pixels; the system does not require theoretically absolute zero displacement, but requires that the residual displacement is insufficient to dominate the subsequent difference results; in other words, as long as the grayscale change introduced by the geometric misalignment is significantly less than the grayscale change introduced by the change in the illumination direction, it can be considered that the sub-pixel alignment requirement of this embodiment is met; To ensure that this condition can be repeatedly met, the system can perform a short alignment check after power-on or when changing fabric: Under no fabric or standard sample fabric conditions, four images are acquired in the same static window, and the positional deviation of the fixed reference point is statistically analyzed; if the maximum deviation exceeds the preset threshold, the system will prompt to check the rigidity of the camera bracket, the lens locking status, or the static angle range setting; through this check, subpixel-level alignment is no longer just a result statement, but has verifiable assembly and adjustment conditions and failure criteria; The purpose of this mechanism is to avoid interference from rolling shutter and motion misalignment on multi-frame difference calculations, thereby enabling pixel-by-pixel photometric stereo calculations without complex registration.
[0023] Furthermore, the normal vector calculation module includes: a horizontal gradient calculation unit, used to calculate the pixel intensity difference between the third-position lighting image and the fourth-position lighting image to generate a horizontal normal component; a vertical gradient calculation unit, used to calculate the pixel intensity difference between the first-position lighting image and the second-position lighting image to generate a vertical normal component; and a vector fusion unit, connected to the horizontal gradient calculation unit and the vertical gradient calculation unit, used to use the horizontal and vertical normal components as the horizontal and vertical components of the surface gradient based on the Lambert cosine theorem, and to complete the depth component perpendicular to the image plane through the normal reconstruction formula, and after normalization processing, fuse and reconstruct surface normal vector data with three-dimensional directionality.
[0024] This embodiment provides a surface normal vector calculation mechanism based on opposite illumination difference. Specifically, after the aforementioned image acquisition is completed, if the four original images are still directly sent to the back-end classification, although some texture information can be extracted, the overall reflection intensity of different batches of fabric, ambient stray light, and local dirt will introduce significant instability. Therefore, this embodiment does not directly use the original grayscale, but uses the intensity difference of opposite illumination to construct two normal components, horizontal and vertical, and then fuses them to obtain surface normal vector data that better reflects the topological undulations. In the specific implementation process, the horizontal gradient calculation unit performs pixel difference between the third-angle lighting image and the fourth-angle lighting image to obtain the normal response of each pixel in the left-right direction; the vertical gradient calculation unit performs pixel difference between the first-angle lighting image and the second-angle lighting image to obtain the normal response of each pixel in the up-down direction; the vector fusion unit combines the results of the two directions into a two-dimensional or three-dimensional normal description. To simplify the explanation, the left and right difference results can be regarded as the horizontal tilt, and the up and down difference results can be regarded as the vertical tilt. Based on Lambert's cosine theorem, the above horizontal normal components and vertical normal components are approximated as the horizontal and vertical components of the surface gradient. Then, the depth component perpendicular to the image plane is completed by the normal reconstruction formula, and finally the unit surface normal vector with standard three-dimensional orientation is reconstructed. Specifically, let the first to fourth directional illumination images be at pixel points. The brightness values at each location are respectively The horizontal gradient calculation unit and the vertical gradient calculation unit respectively calculate the dimensionless gradient components in the relative directions. and : Based on this gradient component, the vector fusion unit calculates the 3D unit normal vector of the pixel using the normal reconstruction formula. : This formula achieves a linear mapping from the multi-source brightness observation space to the three-dimensional topological morphology space, eliminating the influence of the material surface diffuse reflectance on the absolute gray level. A local example analysis of a 3×3 pixel can be performed. Assume the brightness of the center pixel in the four images is as follows: 110 in the first direction, 70 in the second direction, 130 in the third direction, and 90 in the fourth direction. The vertical difference can be recorded as 110 minus 70 equals 40, indicating that the pixel has a significant tilt in the vertical direction. The horizontal difference can be recorded as 130 minus 90 equals 40, indicating that the pixel also has a significant tilt in the left and right directions. If the difference between its left neighboring pixels is 5 vertically and 35 horizontally, while the difference between its right neighboring pixels is -3 vertically and -30 horizontally, it can be inferred that there is a raised boundary across the left and right sides in this area. Further assume that a flat fabric area corresponds to a brightness of 98, 100, 101, and 99 in the four images. Then the differences in the two directions are close to 0 and 2 respectively, indicating that the normal vector is close to perpendicular to the fabric surface, which belongs to a normal planar response. To avoid the influence of overall brightness bias, the scaling of the difference results can be adjusted before vector fusion. For example, if the light source is brighter overall in the same period, all four images will have 20 gray levels increased. If you look directly at the original image, you might mistakenly think that the surface change is stronger. However, after the opposite difference, the difference remains basically unchanged. Furthermore, the horizontal and vertical components can be constrained to a unified numerical range before generating surface normal vector data. In this way, the normal vector focuses on reflecting the morphological changes, while weakening the problem of low white-to-white contrast caused by the uniform reflectivity of the material. As a fault-tolerance mechanism, if a pixel is truncated to a grayscale extreme value of 255 due to saturation, the difference result will be distorted. In this case, the flash energy can be reduced during the image acquisition stage, or the pixel can be marked as an invalid point during the solution stage and not participate in subsequent fusion. If there are isolated noise points in the four images, a small-range median filter can be performed first, and then the difference can be performed. If the difference components are too small and close to the system noise level, for example, the absolute values are all less than 3 grayscale levels, then the pixel can be regarded as an approximately flat or information-insufficient area to avoid treating noise as a micro-defect in subsequent classification. For example, when the shirt placket stitch is sewn normally, the raised top of the thread usually shows a continuous gradient change in both the left and right and up and down directions, so the fused normal vector field presents a stable and continuous high response band; while at the broken thread, due to the interruption of the stitch raised, the normal vector field will show obvious response break; at the fold, a wide and gentle normal change band will be formed; with the help of this differential calculation, the system can identify the three-dimensional structure of the sewn area without relying on color differences. Furthermore, to ensure that the third minus the fourth and the first minus the second truly reflect the surface tilt rather than the brightness inconsistency of the light source itself, the system can perform a reference correction on the four illumination sectors during maintenance or startup. During correction, a flat reference surface or standard diffuse reflection sample is used as the object, and the average response of the four directions under conditions without obvious topographic undulations is recorded, and the corresponding gain compensation parameters are generated accordingly. In actual operation, the brightness equalization of the four images can be performed first using the compensation parameters, and then the opposing difference is performed. In this way, even if the luminous intensity of a certain sector decreases due to aging, the difference in light source will not be mistakenly written as the normal component. In a simplified implementation, the system follows a calculation rule of first acquiring data under the same conditions, then performing differential analysis on opposite sides, and finally fusing the data at a uniform scale. For the same pixel, under ideal diffuse reflection conditions, left and right differential analysis mainly corresponds to horizontal tilt, while up and down differential analysis mainly corresponds to vertical tilt. Considering the potential specular highlights on seams and localized shadows on presser foot edges in industrial settings, a mask checking mechanism is added before differential analysis. If the brightness of a pixel in an image in a certain direction is either high-saturation or in an extremely dark shadow area, the underlying image acquisition module of the system will trigger closed-loop adjustment to dynamically reduce the global exposure time of the next cycle or the driving current intensity of the corresponding strobe light source. At the same time, the nonlinear mapping of the multi-frame difference results is used to retain the true gradient extreme value of the extreme highlight area to avoid the significant surface morphology abnormalities being incorrectly smoothed out due to the forced weight reduction by the software layer. Furthermore, the vector fusion unit can package the horizontal normal component, the vertical normal component, and the undulation strength jointly represented by the two into unified surface normal vector data. The fusion here can be combined according to a preset ratio, normalized combination, or output in the form of a multi-channel map. The common point is that the output result still takes the directional undulation information of each pixel as the core, rather than returning to the original grayscale texture itself. As a result, the subsequent anomaly detection module reads the topological representation data after illumination decoupling, and the algorithm link is more closed and clear. Furthermore, the horizontal and vertical normal components in this paper are based on the pixel coordinate system of the image output by the image acquisition module: horizontal is defined along the image row direction, and vertical is defined along the image column direction. Therefore, the opposing illumination corresponding to the third-position illumination image and the fourth-position illumination image must be fixed as a set in the horizontal direction of the image after installation and calibration, and the opposing illumination corresponding to the first-position illumination image and the second-position illumination image must be fixed as a set in the vertical direction of the image. In this way, when the actual spatial position of the sector in the aforementioned embodiment is referred to as front, back, left, and right, the calculation relationship of the third and fourth generating horizontal normal components and the first and second generating vertical normal components will not be changed. Furthermore, in actual software implementation, the horizontal gradient calculation unit, the vertical gradient calculation unit, and the vector fusion unit can read four images within the same static window according to a fixed period number, prohibiting the mixing of images across periods; that is, the third-position illumination image of a certain period can only be horizontally differiated with the fourth-position illumination image of that period, and the first-position illumination image of a certain period can only be vertically differiated with the second-position illumination image of that period, further ensuring the consistency of the normal vector definition and the consistency of the technical solution from the data pairing level; The purpose of this mechanism is to convert multi-directional grayscale observations into normal vector data that can directly characterize surface undulations, thereby achieving stable characterization of same-color streaks, minute wrinkles, and local bulges.
[0025] Furthermore, the anomaly detection module includes: a low-pass filtering unit, used to perform Gaussian low-pass filtering on the surface normal vector data to filter out high-frequency surface noise and generate smooth normal vector data; a feature mapping unit, connected to the low-pass filtering unit, used to map the smooth normal vector data into a pseudo-color two-dimensional image; and a classification execution unit, connected to the feature mapping unit, used to input the pseudo-color two-dimensional image into a lightweight convolutional network classification model pre-trained using morphological anomaly samples; the lightweight convolutional network contains multiple cascaded depthwise separable convolutional modules, used to extract the three-dimensional topological spatial distribution features mapped in the pseudo-color two-dimensional image, and generate morphological anomaly detection results through a global average pooling layer and a fully connected output layer.
[0026] This embodiment provides a post-processing mechanism for normal vectors for morphological anomaly detection. Specifically, after the aforementioned normal vector calculation is completed, although surface normal vector data that is more suitable for analysis than the original grayscale has been obtained, the actual fabric surface often has fuzz, fiber burrs, and tiny weave patterns. These components will form high-frequency perturbations in the normal vector field. If directly fed into the classification model, the model is likely to misidentify the fuzz spikes as defects. Therefore, this embodiment first performs low-pass filtering on the normal vector data and then maps it into a pseudo-color two-dimensional image for use by the classification execution unit. In the specific implementation process, the low-pass filtering unit performs Gaussian low-pass filtering on the surface normal vector data; the processing object here can be the horizontal normal component, the vertical normal component, or the amplitude map after the fusion of the two; the Gaussian kernel size can be selected according to the trace scale. For example, when the trace width is about 0.2 mm, the effective range of the kernel is set to be slightly smaller than the trace width in order to preserve the main shape of the trace and filter out single-pixel level burrs; after filtering, the originally scattered and sharp high-frequency fluctuations are suppressed, while continuous trace protrusions and wider wrinkles are still preserved; The feature mapping unit maps smoothed normal data into a pseudo-color 2D image to enhance the model's ability to distinguish direction and intensity. For example, the system performs scale normalization on the horizontal and vertical normal components, which contain positive and negative values, and then linearly translates and scales them to the standard pixel range of 0 to 255. The normalized horizontal normal component is mapped to the red channel, the normalized vertical normal component is mapped to the green channel, and the normal amplitude or smoothness is mapped to the blue channel. In this way, if the same area is mainly tilted to the left or right, it will appear reddish in the pseudo-color image. If the main feature is vertical tilt, it leans towards green; if the overall undulation is severe, the blue component is enhanced. The classification execution unit receives the pseudo-color image and outputs the result using an image classification model pre-trained with morphological abnormality samples. The classification model can be a lightweight convolutional network, a support vector machine, or a handcrafted feature combination model. The output result can be a binary classification result, such as normal / abnormal, or a multi-class classification result, such as normal, broken line, gap, wrinkle, or indentation. Specifically, when the image classification model uses a lightweight convolutional network, its network topology includes: an input layer for receiving a pseudo-color two-dimensional image tensor after scale normalization, for example, an input dimension configured as 224×224×3; and a feature extraction subnetwork containing at least three cascaded depthwise separable convolutional modules, each of which sequentially performs 3×3 channel-wise convolution and 1×1 pointwise convolution, supplemented by batch normalization and a linear rectified activation function to extract the spatial distribution features of the three-dimensional topological image. The global average pooling layer is used to compress the extracted 3D feature map into a 1D feature vector in the spatial dimension to prevent overfitting; and the fully connected output layer maps the 1D feature vector into the probability distribution value corresponding to each morphological abnormality category through a normalized exponential function classifier.
[0027] For the training process of this image classification model, its morphological anomaly sample library is constructed based on high-fidelity data from actual sewing production lines. The specific acquisition and labeling method is as follows: during the equipment trial operation phase, multi-directional illumination images of physical objects containing standard stitches and typical defects are collected. A large number of corresponding pseudo-color two-dimensional images are generated as original samples using the aforementioned normal calculation module and low-pass filtering unit. Professional technicians assign corresponding real morphological anomaly category labels to each pseudo-color two-dimensional image based on the actual physical defect manifestations using one-hot encoding. During the network training phase, the model uses the cross-entropy loss function to quantify the error between the predicted probability distribution of the network's forward propagation output and the true class label, and uses an adaptive moment estimation optimizer for backpropagation and iterative updates of the network weight parameters. The training process continues until the cross-entropy loss value on the validation set stabilizes and converges, and the multi-class comprehensive accuracy meets the preset engineering standard for non-stop online detection. The analysis continues with a microscopic example. Assume that after normal calculation, the horizontal component of the central region of a detection block is [30, 28, 32], and the vertical component is [5, 4, 6], indicating that it is mainly a left-right protrusion. After filtering, it remains stable, and when mapping a pseudo-color image, the central region shows a distinct red band, which the classification model can learn to correspond to regular lines. Further assume that another detection block has low horizontal and vertical components, but changes slowly over a large range, for example, gradually transitioning from -12 to 12. The pseudo-color image then appears as a wide, gentle color band, more closely resembling the pattern of fabric wrinkles. If a detection block's original components show an isolated spike of 80 pixels, which decreases to around 10 after filtering, such spikes will no longer be misjudged as abnormal. As a fault-tolerance mechanism, if excessive filtering causes real fine lines to be over-smoothed, the Gaussian kernel variance can be reduced according to the sample line width, or multi-scale normal features can be retained and jointly judged by the classification model. If pseudo-color mapping has channel saturation, the components can be truncated and normalized to avoid color distribution imbalance between different batches of images. If the highest confidence level output by the classification model is greater than or equal to the preset threshold, the discrimination result of the corresponding morphological abnormality category will be directly output. If the highest confidence level output by the classification model is lower than the preset threshold, for example, lower than 0.6, the system can mark the result as pending verification and make a secondary judgment based on the continuous results of adjacent needle positions. If multiple consecutive needle positions show low confidence abnormalities, an alarm will be triggered; otherwise, uncertain samples will be archived for subsequent incremental training. For example, in the white shirt placket sewing site, in the pseudo-color image generated after normal vector filtering, normal stitches are often represented as a high-contrast embossed band continuously distributed along the seam direction, while broken lines are represented as a clear gap in the middle of the embossed band, and wrinkles are represented as a wide and gently undulating band that crosses or runs parallel to the seam. After reading these pseudo-color images, the classification execution unit can stably distinguish various morphological anomalies without relying on color differences. Furthermore, the aforementioned pseudo-color 2D image is not merely for visual display, but rather a 2D encoded representation of 3D topological features. In other words, the direction and strength of the normal vector, as well as the local continuity relationship, are compressed into the color distribution, color band direction, and color abrupt change locations. The classification model learns essentially morphological information such as whether the lines are continuous, whether the convexity is interrupted, and whether the undulation is wide and gentle. Therefore, this post-processing link is technically consistent with the aforementioned 3D topological feature extraction, except that it converts the original normal field into an image representation that is easier for the model to recognize. Furthermore, to avoid the classification execution unit becoming a closed discrimination link that is difficult to reproduce, its input and output rules can be clearly defined as follows: the input is a pseudo-color two-dimensional image generated according to a fixed channel mapping rule, and the output is at least one abnormal category label and its corresponding confidence score; when the continuous line color band in the input image is complete and the width is stable, the model tends to output normal; when the continuous color band is partially interrupted, the model tends to output broken lines or gaps; when a large range of gradually changing color bands crosses or is accompanied by seam extension, the model tends to output wrinkles or bulges; in this way, even if the specific classifier type is different, its discrimination object and discrimination criteria remain clear and consistent. The purpose of this mechanism is to transform the normal vector field, which is difficult to use directly, into a two-dimensional feature representation that is noise-controlled, intuitive, and easy for machine classification, thereby enabling automatic identification of abnormal sewing patterns.
[0028] Furthermore, the system is applied to production process inspection scenarios with periodic motion characteristics; the target objects include: material surfaces with homogeneous and homogeneous characteristics; the mechanical mechanisms include: equipment that drives the target objects to perform periodic motion; and the morphological anomalies include: surface micro-structural defects or surface flatness anomalies.
[0029] This embodiment provides a mechanism for limiting applicable scenarios and defining anomaly types. Specifically, the applicability of the aforementioned technical solution is not limited to specific models of sewing equipment, but is based on general engineering applications, namely, the material being tested has repeatable periodic motion during the production process, and there is a static phase within the period that can be stably extracted; at the same time, the surface being tested does not rely on color differences, but on minute morphological changes for identification; therefore, this embodiment further clarifies that the system is applicable to production process detection scenarios with periodic motion characteristics, especially suitable for detecting minute structural defects and flatness anomalies on the surface of homogeneous and same-color materials. In specific implementation, the periodic motion characteristic means that the target object repeatedly goes through a state sequence of motion-pause-motion or high speed-low speed-high speed under mechanical drive; for automatic shirt sewing, this characteristic comes from the coordinated action of the feed dog and the needle under the rotation drive of the main shaft; for homogeneous and same color surfaces, such as white thread sewing white cloth, blue thread sewing blue cloth, or same color embossed fabric, traditional detection methods that rely on color difference are difficult to work stably, while this embodiment focuses more on the three-dimensional micro-morphology of the surface; the morphological anomalies here include both local micro-structural defects, such as broken thread, skipped stitch, floating thread, and uneven pressure, as well as abnormal surface flatness, such as wrinkles, bulges, local indentations, and wavy seam edges; It can be used for scene extension analysis; assuming that the surface color characteristics of a material are similar and it is difficult to extract contrast features through optical imaging under conventional floodlight illumination, but its local protrusion height and surface tilt angle are different from the surroundings, then a solvable normal change will be formed under multi-directional illumination; further assuming that although there are color differences in another scene, the material surface defects are mainly manifested as flatness problems rather than color spot problems, then the morphology detection link of this embodiment can still be used first; conversely, if there is no periodic pause in a certain scene and the measured part is always moving continuously at high speed, then an equivalent static window should be constructed through external mechanical synchronization, short-term buffer or other pause mechanism before applying this solution, otherwise it will be difficult to obtain a stable aligned multi-directional image; As a fault-tolerance mechanism, if the target surface is not only of the same color but also has strong specular reflection, the ordinary Lambertian approximation will be weakened. In this case, the effect of specular highlights can be reduced by adjusting the illumination incident angle, adding a polarizer, or changing the lens observation angle. If the production process is periodic but the static window is unstable, the system can perform automatic calibration before formal inspection to confirm whether the minimum time window length requirement is met. If it is not met, the system will switch to single-frame coarse inspection mode. If the anomaly type exceeds the training sample range, such as the presence of rare foreign objects, the classification result may have low confidence. In this case, it can be reported as an unknown anomaly and the image can be saved for subsequent expansion of anomaly categories. For example, in multiple work stations such as shirt placket, cuff facing, and collar sewing, the materials may exhibit characteristics such as consistent fabric and thread color, and defects mainly manifested in undulating shape changes; broken threads, loose threads, and local wrinkles are common in the placket work station; rolled edges and indentations may appear in the cuff work station; and wavy edges and poor flatness may appear in the collar work station. Although these abnormalities may not have obvious color differences, they can all be identified by the changes in normal direction under multi-directional lighting. The purpose of this mechanism is to clarify the applicable boundaries and detection object types of this scheme, so that the system can carry out stable detection around the three core conditions of periodic motion, homogeneous and homogeneous surfaces, and abnormal morphology.
[0030] Furthermore, this system also includes: an edge computing module; a normal calculation module and an anomaly detection module are deployed in the edge computing module; the edge computing module adopts a multi-threaded asynchronous processing mechanism to establish an asynchronous pipeline and cache queue that includes acquisition, calculation and detection; When the number of pending cycles in the cache queue is detected to be greater than or equal to a preset threshold of 3 periodic movements of target objects, causing congestion and conflict in the processing thread, a degradation strategy execution instruction is triggered. Priority is given to retaining areas with abnormal risk determined by the surface normal vector data and finely judged by the anomaly discrimination module. Normal areas that are not judged as abnormal risk areas are quickly screened or the input resolution is temporarily reduced. This is used to dynamically control the single-cycle pipeline throughput time from the acquisition of multi-directional illumination images by the image acquisition module to the output of the anomaly discrimination module to the output of the morphological anomaly discrimination result to be less than the single running cycle time of the periodic movement, so as to ensure that no image frame loss occurs during continuous high-speed production.
[0031] This embodiment provides an edge asynchronous processing mechanism that meets the single-cycle closed-loop time limit. Specifically, in the aforementioned scheme, multi-directional images and normal vector data can be stably obtained. However, if all processing steps are still executed sequentially in a single thread, such as waiting for all four images to arrive, uniformly solving, uniformly classifying, and outputting results, then the results are prone to lag during high-speed sewing. An anomaly at one stitch position may not be reported until several subsequent stitch positions, losing the value of timely shutdown. Therefore, this embodiment adds an edge computing module to the system and deploys the normal vector solving module and the anomaly detection module in this module. Through the multi-threaded asynchronous processing mechanism, the pipeline throughput time of the system's single processing is controlled within the duration of a single running cycle. In practical implementation, the edge computing module can be an industrial control computer, an embedded computing unit, or an edge server with graphics processing capabilities. It is installed close to the sewing equipment to reduce image transmission path and network round-trip latency. The multi-threaded asynchronous processing mechanism can include at least an acquisition thread, a processing thread, a discrimination thread, and a result output thread. The acquisition thread is responsible for receiving four azimuth images from the camera and writing them into a buffer queue according to period numbering. The processing thread reads the matched images of the same period from the buffer queue, performs difference and normal fusion, and generates normal vector data. The discrimination thread reads the normal vector results and performs filtering, pseudo-color mapping, and classification. The output thread sends the discrimination results to the host computer or the shutdown timing synchronization control module. This can be illustrated using a simplified time example. Assume the sewing cycle duration is 12 milliseconds. In the first cycle, the acquisition thread completes the reception of four images within 0 to 4 milliseconds. The processing thread does not need to wait for the start of the second cycle but completes the normal calculation in the latter half of the first cycle, i.e., 4 to 6 milliseconds. The discrimination thread can complete filtering and classification within 6 to 9 milliseconds. The output thread provides the results within 9 to 10 milliseconds. At this point, the total processing delay is 10 milliseconds, which is less than 12 milliseconds, meaning that an anomaly in the first stitch position can be detected before the next stitch position is completed. Meanwhile, the image acquisition in the second cycle can be performed in parallel with the discrimination in the first cycle, thus forming a pipeline. If a single-threaded serial approach is used, the reception, processing, and classification of the four images are all queued sequentially, which may accumulate to more than 15 milliseconds, failing to meet the closed-loop time limit. Here's another queue example; assume the image buffer can hold a maximum of 3 cycles of data; after the image of cycle 100 is enqueued, if the processing thread is idle, it immediately retrieves it and generates the normal result, forming normal packet number 100 in the result queue; the discrimination thread retrieves this normal packet and outputs 100 as either normal or abnormal; if the discrimination of cycle 100 has not yet ended when cycle 101 arrives, the acquisition thread can still write image number 101 into the next buffer slot without blocking camera triggering; the system only needs to execute frame dropping or rate limiting strategies when the buffer is full. As a fault-tolerance mechanism, if the edge computing module is overloaded, causing an abnormally long processing time for a certain thread, the system can automatically adjust its strategy based on the queue depth. In this embodiment, the preset threshold for the number of cycles to be processed is set to 3 sewing cycles. The logic behind this setting is that if the number of cycles exceeds 3, the cumulative delay will exceed 36 milliseconds, which may cause the alarm signal to lag behind the current physical sewing position, thus leading to missed detections. For example, when the number of cycles to be processed exceeds the threshold, the system prioritizes the fine discrimination of abnormal candidate areas and enables rapid screening of obviously normal areas. Alternatively, the system may temporarily reduce the input resolution and reduce the pseudo-color mapping resolution to shorten the single-cycle processing time. If a thread crashes or the result verification fails, the monitoring thread can restart the thread and mark the current cycle as an invalid result to avoid mismatching old data to the new cycle. If the total processing delay exceeds the time limit for multiple consecutive cycles, the system can issue a speed-down suggestion to the sewing equipment or enter a protective shutdown state. For example, on a high-speed automatic sewing line for white shirt plackets, the edge computing module is directly installed in the equipment side cabinet; the acquisition thread receives four images with each main axis stationary window, the calculation thread generates a normal vector map in real time, the discrimination thread completes the identification of thread breakage or wrinkle within the same needle cycle, and the output thread transmits the abnormal signal to the stop relay; in this way, when a thread breakage occurs at a certain needle position, the system can trigger an alarm or stop the machine in a very short time, reducing the length of defective sewing; The purpose of this mechanism is to compress the image processing chain into a single cycle time limit through edge deployment and multi-threaded asynchronous pipelines, thereby achieving pin-level real-time detection and rapid closed-loop response.
[0032] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. An automated shirt sewing inspection system based on industrial vision, characterized in that, The system includes: The motion phase monitoring module is used to monitor the phase signal of the mechanical mechanism that drives the preset target object to perform periodic motion; The timing synchronization control module is communicatively connected to the motion phase monitoring module and is used to extract the static time window of the target object based on the phase signal, and generate a time-division trigger signal within the static time window; The multi-zone directional lighting module includes multiple independent lighting sectors distributed in different spatial orientations around the target object, and is communicatively connected to the timing synchronization control module to sequentially activate each of the independent lighting sectors in response to the time-division trigger signal. An image acquisition module is set at a fixed observation angle of the target object and is communicatively connected to the timing synchronization control module. It is used to respond to the time-division trigger signal and synchronously perform continuous exposure operation when each of the independent illumination sectors is activated in sequence, so as to obtain multi-directional illumination images of the target object in a static state corresponding to the same physical observation area. The normal vector calculation module is communicatively connected to the image acquisition module and is used to receive the multi-directional illumination image and calculate the surface normal vector data of the target object based on the photometric stereo algorithm. The anomaly detection module is communicatively connected to the normal vector calculation module and is used to extract three-dimensional topological features based on the surface normal vector data and output the morphological anomaly detection results.
2. The automatic shirt sewing inspection system based on industrial vision according to claim 1, characterized in that, The mechanical mechanism has a rotating shaft; the motion phase monitoring module includes: an incremental rotary encoder; The incremental rotary encoder is connected to the rotary shaft and is used to output the rotary shaft angle data; The timing synchronization control module is used to compare the rotation axis angle data with a preset absolute stationary angle range. When the rotation axis angle data falls into the absolute stationary angle range, it determines that it has entered the stationary time window and generates multiple time-division trigger signals sequentially according to a preset rhythm. When the rotation axis angle data does not fall into the absolute stationary angle range, it determines that it is in a motion window and stops generating the time-division trigger signals. When it detects that the rotation axis angle data is missing or jumps, causing a timing conflict, it prioritizes entering a protection state and stops outputting the time-division trigger signals. Or, when it detects that the current stationary time window length is insufficient to complete the generation of all the time-division trigger signals, it executes a degradation strategy to only collect part of the azimuth image and marks the current period as a low-confidence frame.
3. The automatic shirt sewing inspection system based on industrial vision according to claim 2, characterized in that, The multi-zone directional lighting module includes: a ring-shaped strobe light source; The ring-shaped strobe light source is divided into a first illumination sector, a second illumination sector, a third illumination sector, and a fourth illumination sector, each corresponding to a different spatial orientation. The first illumination sector and the second illumination sector form opposing illumination in the vertical direction, and the third illumination sector and the fourth illumination sector form opposing illumination in the horizontal direction. The time-division trigger signal generated by the timing synchronization control module includes a first trigger pulse, a second trigger pulse, a third trigger pulse, and a fourth trigger pulse output sequentially. The multi-zone directional lighting module is used to sequentially activate the first lighting sector, the second lighting sector, the third lighting sector, and the fourth lighting sector in response to the first to the fourth trigger pulses.
4. The automatic shirt sewing inspection system based on industrial vision according to claim 3, characterized in that, The image acquisition module includes: a global shutter industrial camera; The global shutter industrial camera is used to acquire a first azimuth illumination image, a second azimuth illumination image, a third azimuth illumination image, and a fourth azimuth illumination image in response to the first to the fourth trigger pulses, respectively. The multi-directional illumination image is composed of a first directional illumination image, a second directional illumination image, a third directional illumination image, and a fourth directional illumination image; The image acquisition module continuously acquires the first azimuth illumination image to the fourth azimuth illumination image within the static time window, and these images are in a sub-pixel level aligned state in physical space.
5. The automatic shirt sewing inspection system based on industrial vision according to claim 4, characterized in that, The normal calculation module includes: A horizontal gradient calculation unit is used to calculate the pixel intensity difference between the third-position illumination image and the fourth-position illumination image to generate a horizontal normal component. The vertical gradient calculation unit is used to calculate the pixel intensity difference between the first azimuth illumination image and the second azimuth illumination image to generate the vertical normal component. The vector fusion unit, connected to the horizontal gradient calculation unit and the vertical gradient calculation unit, is used to take the horizontal normal component and the vertical normal component as the horizontal and vertical components of the surface gradient based on the Lambert cosine theorem, and complete the depth component perpendicular to the image plane through the normal reconstruction formula. After normalization processing, the surface normal vector data with three-dimensional directionality is fused and reconstructed.
6. The automatic shirt sewing inspection system based on industrial vision according to claim 1, characterized in that, The anomaly detection module includes: A low-pass filtering unit is used to perform Gaussian low-pass filtering on the surface normal vector data to filter out high-frequency surface noise and generate smooth normal vector data. A feature mapping unit, connected to the low-pass filtering unit, is used to map the smoothed normal data into a pseudo-color two-dimensional image; The classification execution unit, connected to the feature mapping unit, is used to input the pseudo-color two-dimensional image into a lightweight convolutional network classification model pre-trained with morphological anomaly samples. The lightweight convolutional network contains multiple cascaded depthwise separable convolutional modules, which are used to extract the three-dimensional topological spatial distribution features mapped in the pseudo-color two-dimensional image, and generate the morphological anomaly discrimination result through a global average pooling layer and a fully connected output layer.
7. The automatic shirt sewing inspection system based on industrial vision according to any one of claims 1 to 6, characterized in that, The system is applied to production process detection scenarios with periodic motion characteristics; The target object includes: a material surface with homogeneous and homogeneous characteristics; The mechanical mechanism includes: a device for driving the target object to perform periodic motion; The morphological anomalies include: microstructural defects on the surface or abnormal surface smoothness.
8. The automatic shirt sewing inspection system based on industrial vision according to claim 7, characterized in that, The system also includes: an edge computing module; The normal calculation module and the anomaly detection module are deployed in the edge computing module; The edge computing module adopts a multi-threaded asynchronous processing mechanism to establish an asynchronous pipeline and cache queue that includes acquisition, calculation and discrimination. When the number of pending cycles in the cache queue is detected to be greater than or equal to a preset threshold of 3 periodic movements of the target object, causing congestion and conflict in the processing thread, a degradation strategy execution instruction is triggered. Priority is given to retaining the finely discriminated areas with abnormal risk determined by the anomaly discrimination module through surface normal vector data, while normal areas not judged as abnormal risk areas are quickly screened or the input resolution is temporarily reduced. This is used to dynamically control the single-cycle pipeline throughput time from the acquisition of multi-directional illumination images by the image acquisition module to the output of the morphological anomaly discrimination result by the anomaly discrimination module to be less than the single running cycle time of the periodic movement, so as to ensure that no image frame loss occurs during continuous high-speed production.