A method, system, equipment, and medium for detecting seam threads in non-planar fabrics.

By performing affine transformation, stitching, and semantic segmentation network training on image data of non-planar fabrics, a sewing thread detection model is generated, which solves the accuracy problem of sewing thread detection in non-planar fabrics and improves detection efficiency and accuracy.

CN116309478BActive Publication Date: 2026-03-10HEFEI TRISTATE GARMENT MFG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-21
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately detect the location of seams in non-planar fabrics, especially in areas where the fabric surface is uneven or irregular.

Method used

By acquiring planar image data of non-planar fabric samples, performing affine transformation and stitching processing, mask image data is generated. A semantic segmentation network model is used to train a seam detection model, and the fabric to be detected is subjected to affine transformation and stitching processing to generate planar reconstruction data. Finally, the seam area image data is output in the seam detection model.

Benefits of technology

It enables accurate detection of the position of stitch lines in non-planar fabrics, improving the accuracy and efficiency of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116309478B_ABST
    Figure CN116309478B_ABST
Patent Text Reader

Abstract

This invention provides a method, system, device, and medium for detecting seam lines in non-planar fabrics, comprising: acquiring planar image data of each plane of a fabric sample; performing an affine transformation on each planar image data to generate transformed image data corresponding to each planar image data; stitching all transformed image data to generate stitched planar data; annotating the stitched planar data with seam lines to generate mask image data; training a preset semantic segmentation network model using the mask image data to generate a seam line detection model; performing an affine transformation and stitching on the acquired image data of the fabric to be detected to generate planar reconstruction data; and inputting the planar reconstruction data into the seam line detection model to output image data of the seam line region. This invention can accurately detect the seam line positions of non-planar three-dimensional fabrics.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a method, system, device, and medium for detecting seam lines in non-planar fabrics. Background Technology

[0002] As a traditional national industry, the textile industry has always placed great emphasis on fabric quality among manufacturers and consumers. During textile quality inspection, it is necessary to check the correctness of the stitching positions to allow for subsequent detailed inspection of the stitching quality, thereby ensuring the overall quality of the textile. However, when inspecting stitching, the unevenness, irregularities, or other difficult-to-observe areas on the surface of textiles make it currently difficult to accurately detect the position of the stitching. Summary of the Invention

[0003] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide a method, system, device and medium for detecting seam lines in non-planar fabrics. This invention can accurately detect the position of seam lines in fabrics.

[0004] To achieve the above and other related objectives, the present invention provides a method for detecting seam threads in non-planar fabrics, comprising:

[0005] Acquire planar image data for each surface of a non-planar fabric sample;

[0006] An affine transformation is performed on each of the planar image data to generate transformed image data corresponding to each of the planar image data.

[0007] All the transformed image data are stitched together to generate stitched planar data;

[0008] The stitching plane data is annotated with stitch lines to generate mask image data;

[0009] The mask image data is used to train a preset semantic segmentation network model to generate a seam detection model;

[0010] Affine transformation and stitching are performed on the acquired image data of the fabric to be tested to generate planar reconstruction data;

[0011] The planar reconstruction data is input into the seam detection model to output the seam area image data.

[0012] In one embodiment of the present invention, the step of performing an affine transformation on each of the planar image data to generate transformed image data corresponding to each of the planar image data includes:

[0013] An affine transformation model is established for each of the planar image data based on a preset mapping relationship between planar coordinate points and affine coordinate points, wherein the affine transformation model is represented as follows: Where (α, β) are the initial coordinates of the planar image data, (x, y) are the corresponding coordinates of the initial coordinates in the affine image data, and a1, a2, a3, a4, t x and t y These are model parameters;

[0014] Each of the planar image data is input into the corresponding affine transformation model to output the affine image data corresponding to each of the planar image data.

[0015] Each of the affine image data is subjected to grayscale resampling to generate transformed image data corresponding to each of the affine image data.

[0016] In one embodiment of the present invention, the step of performing grayscale resampling processing on each of the affine image data to generate transformed image data corresponding to each of the affine image data includes:

[0017] The grayscale resampling process is performed on each of the affine image data using bilinear interpolation to generate grayscale value data for each coordinate point in each of the affine image data.

[0018] Based on the grayscale value data of each coordinate point in each affine image data, transformed image data corresponding to each affine image data is generated, wherein the grayscale value data is represented as f(x,y)=(1-γ)(1-θ)g(α0,β0)+γ(1-θ)g(α0+1,β0)+(1-γ)θg(α0,β0)+γθg(α0+1,β0)

[0019] 1,β0+1), f(x,y) is the gray value data of the (x,y) coordinate point in the affine image data, g(α,β) is the gray value of the (α,β) coordinate point in the planar image data, α∈(α0,α0+1), β∈(β0,β0+1), γ=α-α0, θ=β-β0.

[0020] In one embodiment of the present invention, the step of training a preset semantic segmentation network model using the mask image data to generate a seam detection model includes:

[0021] The mask image data is input into the semantic segmentation network model to output the stitching prediction data. The semantic segmentation network model includes a stitching feature extraction network, a context feature extraction network, and a prediction network.

[0022] Construct a loss function between the predicted stitch data and the actual stitch data;

[0023] The semantic segmentation network model is trained based on the loss function to generate a seam detection model.

[0024] In one embodiment of the present invention, the step of inputting the mask image data into the semantic segmentation network to output seam prediction data includes:

[0025] Based on the stitching feature extraction network, feature extraction is performed on the mask image data to generate stitching image feature data.

[0026] Based on the context feature extraction network, extract the context feature data of the stitching image feature data;

[0027] Based on the contextual feature data, feature enhancement processing is performed on the stitching image feature data to generate stitching feature-enhanced data, wherein the stitching feature-enhanced data is represented as follows: Y p The Y represents the feature data of the stitching image. f The context feature data is represented by C, the number of image channels is represented by C, and W is the attention matrix between the stitching image feature data and the context feature data.

[0028] The enhanced seam feature data is input into the prediction network to output seam prediction data, wherein the seam prediction data includes prediction position data and prediction classification data.

[0029] In one embodiment of the present invention, the loss function is expressed as follows: Among them, L cls This represents the loss between the predicted classification data and the actual classification data. This represents the loss between the predicted location data and the actual location data. This indicates the overlapping portion between the predicted location data and the actual location data. This indicates the portion where the predicted location data and the actual location data are combined.

[0030] In one embodiment of the present invention, the step of performing affine transformation and stitching processing on the acquired image data of the fabric to be tested to generate planar reconstruction data includes:

[0031] An affine transformation is performed on the acquired image data of each surface of the fabric to be tested to generate intermediate image data corresponding to each acquired image data.

[0032] All the intermediate image data are stitched together to generate planar reconstruction data.

[0033] The present invention also provides a sewing thread detection system for non-planar fabrics, comprising:

[0034] The data acquisition module is used to acquire planar image data of each surface of the non-planar fabric sample;

[0035] An affine transformation module is used to perform an affine transformation on each of the planar image data to generate transformed image data corresponding to each of the planar image data.

[0036] An image stitching module is used to stitch all the transformed image data to generate stitched planar data;

[0037] The image annotation module is used to perform stitch line annotation processing on the spliced ​​plane data to generate mask image data;

[0038] The model training module is used to train a preset semantic segmentation network model using the mask image data to generate a seam detection model.

[0039] The image restoration module is used to perform affine transformation and stitching processing on the acquired image data of the fabric to be inspected in order to generate planar restoration data.

[0040] The data processing module is used to input the planar reconstruction data into the seam detection model to output the seam area image data.

[0041] The present invention also provides an electronic device, the electronic device comprising:

[0042] One or more processors;

[0043] A storage device for storing one or more programs, which, when executed by the one or more processors, cause the electronic device to implement the stitch detection method for non-planar fabrics as described above.

[0044] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a computer processor, causes the computer to perform the above-described method for detecting stitches in non-planar fabrics.

[0045] As described above, the present invention provides a method, system, device and medium for detecting seam lines in non-planar fabrics, which can accurately detect the position of seam lines in fabrics. Attached Figure Description

[0046] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0047] Figure 1 The diagram shows an implementation environment of the non-planar fabric stitch detection method of the present invention;

[0048] Figure 2 The diagram shows a flowchart of the method for detecting stitches in non-planar fabrics according to the present invention.

[0049] Figure 3 Displayed as Figure 2 Flowchart of step S20;

[0050] Figure 4 Displayed as Figure 3 Flowchart of step S23;

[0051] Figure 5 Displayed as Figure 2 Flowchart of step S50;

[0052] Figure 6 Displayed as Figure 5 Flowchart of step S51;

[0053] Figure 7 Displayed as Figure 2 Flowchart of step S60;

[0054] Figure 8 The diagram shown is a block diagram of the stitch detection system of the present invention.

[0055] Figure 9 The diagram shown is a structural schematic of a computer system for the electronic device of the present invention.

[0056] Component designation explanation:

[0057] 10. Image acquisition device; 20. Central switch; 30. Smart terminal; 40. Data acquisition module; 41. Affine transformation module; 42. Image stitching module; 43. Image annotation module; 44. Model training module; 45. Image restoration module; 46. Data processing module. Detailed Implementation

[0058] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0059] Please see Figure 1-9 It should be noted that the illustrations provided in this embodiment are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0060] This invention provides a method for detecting seam threads in non-planar fabrics, which can be applied to the detection of seam threads in fabrics. For example, this method can be applied to... Figure 1 The illustration shows a garment stitching test scenario. Specifically, during the garment stitching test, image data of various surfaces of the garment can be acquired using image acquisition devices 10. Each image acquisition device 10 can be network-connected to a central switch 20 to transmit image data to the central switch 20. The central switch 20 can be network-connected to a smart terminal 30 to forward image data to the smart terminal 30. The smart terminal 30 can detect the image data using a non-planar fabric stitching detection method to accurately detect the position of the garment stitching. The smart terminal 30 can be any terminal device that supports the installation of navigation map software, such as a smartphone, in-vehicle computer, tablet computer, laptop computer, or wearable device, but is not limited to these.

[0061] Please see Figure 2 As shown, the method for detecting seam lines in non-planar fabrics provided by the present invention may include the following steps:

[0062] Step S10: Obtain planar image data of each surface of the non-planar fabric sample;

[0063] Step S20: Perform an affine transformation on each planar image data to generate transformed image data corresponding to each planar image data;

[0064] Step S30: Perform stitching processing on all transformed image data to generate stitched planar data;

[0065] Step S40: Perform stitch line annotation processing on the splicing plane data to generate mask image data;

[0066] Step S50: Train the preset semantic segmentation network model using mask image data to generate a seam detection model;

[0067] Step S60: Perform affine transformation and stitching processing on the acquired image data of the fabric to be tested to generate planar reconstruction data;

[0068] Step S70: Input the planar reconstruction data into the seam detection model to output the seam area image data.

[0069] In one embodiment of the present invention, when step S10 is executed, planar image data of each surface of the non-planar fabric sample is acquired. Specifically, for fabrics with multiple surfaces, images of multiple surfaces of the fabric can be acquired using an image acquisition device 10. However, this is not the only possibility; other acquisition methods can also be used to acquire images of the fabric. The image acquisition device 10 can be multiple cameras, which can be positioned relative to different areas of the fabric surface to acquire planar image data of each surface of the fabric. For example, when acquiring images of multiple surfaces of a garment, for planar images of the shoulders, sleeves, collars, or other areas of the garment, images of the corresponding areas can be acquired separately using multiple cameras. Furthermore, the planar image data of each surface of the textile sample acquired by the image acquisition device 10 can be acquired through a smart terminal 30.

[0070] Please see Figure 3 As shown, when step S20 is executed, an affine transformation is performed on each planar image data to generate transformed image data corresponding to each planar image data. Specifically, step S20 may include the following steps:

[0071] Step S21: Based on the preset mapping relationship between planar coordinate points and affine coordinate points, establish an affine transformation model for each planar image data, wherein the affine transformation model is represented as... Where (α, β) are the initial coordinates of the planar image data, (x, y) are the corresponding coordinates of the initial coordinates in the affine image data, and a1, a2, a3, a4, t x and t y These are model parameters;

[0072] Step S22: Input each planar image data into the corresponding affine transformation model to output the affine image data corresponding to each planar image data;

[0073] Step S23: Perform grayscale resampling on each affine image data to generate the transformed image data corresponding to each affine image data.

[0074] In one embodiment of the present invention, when step S21 is executed, an affine transformation model for each planar image data is established based on a preset mapping relationship between planar coordinate points and affine coordinate points. Specifically, when establishing an affine transformation model for planar image data, multiple pairs of constraint correspondence points between the planar image data and the affine image data to be affined can be selected first to calculate the parameters of the affine transformation model. Specifically, an affine transformation model with unknown parameters can be represented as... (α i ,β i (x) can represent the coordinates of a constraint point in planar image data. i y i ) can represent the coordinates of the constraint point (α) i ,β i The coordinates of a corresponding constraint point in the affine image data, (x i y i ) and (α) i ,β i ) can be represented as a pair of constrained corresponding points. i1 a i2 a i3 a i4 t xi and t yi This can represent unknown model parameters. When calculating multiple model parameters, the coordinates of three pairs of constraint corresponding points can be selected from the affine transformation model with unknown parameters. This allows the calculation of the affine transformation matrix that transforms planar image data into affine image data, thus obtaining the parameters of the affine transformation model. An affine transformation model with known parameters can be represented as follows: Where (α, β) are the initial coordinates of the planar image data, (x, y) are the corresponding coordinates of the initial coordinates in the affine image data, and a1, a2, a3, a4, t x and t y These are the model parameters. Similarly, the affine transformation model corresponding to each planar image data can be established using the same steps described above.

[0075] In one embodiment of the present invention, when step S22 is executed, each planar image data is input into the corresponding affine transformation model to output the affine image data corresponding to each planar image data. Specifically, the affine transformation model with known parameters can be expressed as follows: When calculating the affine image data corresponding to each planar image data, each initial coordinate (α, β) in each planar image data can be input into the affine transformation model, thereby outputting the corresponding coordinates (x, y) in the affine image data for each initial coordinate. Based on the corresponding coordinates of all initial coordinates in each planar image data, the affine image data corresponding to each planar image data is thus formed.

[0076] Please see Figure 4 As shown, when step S23 is executed, grayscale resampling is performed on each affine image data to generate transformed image data corresponding to each affine image data. Specifically, step S23 may include the following steps:

[0077] Step S231: Perform grayscale resampling on each affine image data based on bilinear interpolation to generate grayscale value data for each coordinate point in each affine image data.

[0078] Step S232: Based on the grayscale value data of each coordinate point in each affine image data, generate the transformed image data corresponding to each affine image data, where the grayscale value data is represented as f(x,y)=(1-γ)(1-θ)g(α0,β0)+γ(1-θ)g(α0+1,β0)+(1-γ)θg(α0,β0)+

[0079] γθg(α0+1,β0+1), f(x,y) is the gray value of the (x,y) coordinate point in the affine image data, g(α,β) is the gray value of the (α,β) coordinate point in the planar image data, α∈(α0,α0+1), β∈(β0,β0+1), γ=α-α0, θ=β-β0.

[0080] In one embodiment of the present invention, when executing steps S231 and S232, specifically, it should be noted that bilinear interpolation refers to a method of calculating one point in the new image from four points in the original image. Here, points (α0,β0), (α0,β0+1), (α0+1,β0), and (α0+1,β0+1) can be the four neighboring points of point (α,β) in the planar image data. The coordinates of point (α,β) fall in the middle of points (α0,β0), (α0,β0+1), (α0+1,β0), and (α0+1,β0+1), i.e., α∈(α0, α0+1), β∈(β0, β0+1). The point (α,β) in the planar image data corresponds to the point (x,y) in the affine image data, and the gray value of point (x,y) can be calculated based on the gray values ​​of the neighboring points of point (α,β). Specifically, by substituting the gray values ​​of neighboring points in the planar image data into the gray value formula, i.e., f(x,y)=(1-γ)(1-θ)g(α0,β0)+γ(1-θ)g(α0+1,β0)+(1-γ)θg(α0,β0)+γθg(α0+1,β0+1), the gray value of the coordinate point (x,y) in each affine image data can be calculated. Here, γ can take the value α-α0, θ can take the value β-β0, and g(α,β) can be the gray value of the coordinate point (α,β) in the planar image data. Furthermore, based on the gray value data of each coordinate point in each affine image data, the transformed image data corresponding to each affine image data can be generated.

[0081] In one embodiment of the present invention, when step S30 is executed, all transformed image data are stitched together to generate stitched planar data. Specifically, for transformed image data of multiple surfaces of a fabric, stitching can be performed based on a corresponding template image and by selecting specific corresponding points to stitch multiple transformed image data into a single stitched plane. For example, for transformed image data of multiple surfaces of a garment, such as the shoulders, sleeves, and collar, stitching can be performed based on a corresponding garment template image and by selecting specific corresponding points to create stitched planar data of the garment. Thus, the planar image data of each surface of the fabric can be stitched together to restore the overall stitched planar data.

[0082] In one embodiment of the present invention, when step S40 is executed, stitch line annotation is performed on the stitched planar data to generate mask image data. Specifically, when annotating the stitch line data, an image annotation tool can be used first to annotate the stitch line areas in the image, and then the non-stitch line areas can be annotated. For example, the stitch line areas are annotated as 1, and the non-stitch line areas in the stitched planar data are annotated as 0. It should be understood that such annotations can serve as a mask to distinguish specific areas in the image. After the overall annotation of the stitched planar data is completed, mask image data can be generated.

[0083] Please see Figure 5 As shown, when step S50 is executed, the preset semantic segmentation network model is trained using the mask image data to generate a seam detection model. Specifically, step S50 may include the following steps:

[0084] Step S51: Input the mask image data into the semantic segmentation network model to output the stitching prediction data. The semantic segmentation network model includes a stitching feature extraction network, a context feature extraction network, and a prediction network.

[0085] Step S52: Construct the loss function between the predicted stitching data and the actual stitching data;

[0086] Step S53: Train the semantic segmentation network model based on the loss function to generate a seam detection model.

[0087] Please see Figure 6 As shown, when step S51 is executed, the mask image data is input into the semantic segmentation network model to output the seam prediction data. Specifically, step S51 may include the following steps:

[0088] Step S511: Based on the stitching feature extraction network, perform feature extraction on the mask image data to generate stitching image feature data;

[0089] Step S512: Extract contextual feature data of the stitching image feature data based on the contextual feature extraction network;

[0090] Step S513: Based on the contextual feature data, perform feature enhancement processing on the stitching image feature data to generate stitching feature enhancement data;

[0091] Step S514: Input the enhanced seam feature data into the prediction network to output seam prediction data, wherein the seam prediction data includes prediction position data and prediction classification data.

[0092] In one embodiment of the present invention, when step S511 is executed, features are extracted from the mask image data based on the stitching feature extraction network to generate stitching image feature data. Specifically, the feature extraction network can be a VGG network (classic convolutional neural network), a GoogLeNet neural network, a residual network, or other network structures. Inputting the mask image data into the stitching feature extraction network yields global image features. Further utilizing ROIAlign (region feature aggregation method), the stitching image region can be obtained from the global image features. Finally, projecting the stitching image region onto the global image features extracts the stitching image feature data.

[0093] In one embodiment of the present invention, when performing steps S512 and S513, specifically, the stitch line image feature data (Y) can be calculated first. P ∈R C×1 ) and contextual feature data (Y f ∈R C×H×W The attention matrix W between ) can be represented as Furthermore, the stitch feature enhancement data can be represented as Among them, Y P It can represent the feature data of the stitching image, Y f It can represent contextual feature data, and C can represent the number of image channels.

[0094] In one embodiment of the present invention, when step S514 is executed, the enhanced seam feature data is input into the prediction network to output seam prediction data. Specifically, the prediction network can predict the predicted position data and predicted classification data of the seam using the enhanced seam feature data. The predicted position data can represent the predicted position region of the seam. The predicted classification data can represent the probability data that the predicted region is a seam region.

[0095] In one embodiment of the present invention, when step S52 is executed, a loss function is constructed for the predicted stitch data and the actual stitch data. Specifically, the loss function may include the loss between the predicted probability and the true label, as well as the intersection-union ratio (IUU) loss between the predicted stitch data and the actual stitch data; that is, the loss function can be expressed as L. cls +L thread Among them, L cls L can represent the loss between the predicted probability and the true label. thread L can represent the intersection-over-union loss between the predicted stitch data and the actual stitch data. thread It can be represented as This can represent the overlap between the predicted stitch length data and the actual stitch length data. This can represent the combined portion of the predicted and actual stitching data. This loss function calculation method treats the stitching as a whole for regression prediction, improving overall detection accuracy.

[0096] In one embodiment of the present invention, when step S53 is executed, the semantic segmentation network is trained based on the loss function to generate a stitching detection model. Specifically, the semantic segmentation network can be optimized according to the loss function to reduce the error between the predicted stitching data and the actual stitching data, and the optimized semantic segmentation network model is used as the stitching detection model. Furthermore, the stitching detection model can be retrained using new mask image data, a new loss function between the predicted stitching data and the actual data can be calculated, and the initial stitching detection model can be further optimized based on the new loss function to further reduce the error between the predicted stitching data and the actual stitching data. Similarly, multiple optimizations can be performed to obtain the optimal stitching detection model.

[0097] Please see Figure 7 As shown, when step S60 is executed, the acquired image data of the fabric to be inspected undergoes affine transformation and stitching processing to generate planar reconstruction data. Specifically, step S60 may include the following steps:

[0098] Step S61: Perform an affine transformation on the acquired image data of each surface of the fabric to be inspected to generate intermediate image data corresponding to each acquired image data.

[0099] Step S62: Perform stitching on all intermediate image data to generate planar reconstruction data.

[0100] In one embodiment of the present invention, when step S61 is executed, an affine transformation is performed on the acquired image data of each surface of the fabric to be inspected to generate intermediate image data corresponding to each acquired image data. Specifically, the affine transformation model can be represented as follows: When performing an affine transformation on each acquired image data, each initial coordinate (α, β) from each acquired image data can be input into the affine transformation model, thereby outputting the corresponding coordinates in the affine image data for each initial coordinate. Based on the corresponding coordinates of all initial coordinates in each acquired image data, the affine image data corresponding to each acquired image data is formed. Further, grayscale resampling processing is performed on each affine image data using bilinear interpolation, which generates grayscale value data for each coordinate point in each affine image data. Based on the grayscale value data for each coordinate point in each affine image data, the intermediate image data corresponding to the affine transformation of each acquired image data can be generated.

[0101] In one embodiment of the present invention, when step S62 is executed, all intermediate image data are stitched together to generate planar reconstruction data. Specifically, for intermediate image data of multiple surfaces of the fabric to be detected, stitching can be performed based on the corresponding template image and by selecting specific corresponding points, so as to stitch multiple intermediate image data into a single planar reconstruction image data. Furthermore, to avoid the reconstruction image data being too large and affecting detection efficiency, a sliding window method can also be used to divide the planar reconstruction data into blocks, so as to divide the planar reconstruction data into multiple sub-block images for parallel detection, thereby improving detection efficiency.

[0102] In one embodiment of the present invention, when step S70 is executed, the planar reconstruction data is input into the seam detection model to output seam area image data. Specifically, after the planar reconstruction data is processed into blocks, multiple threads can be used to input each sub-block image into the seam detection model for parallel detection. After merging the detection results of all sub-block images, accurate seam area image data can be output quickly. When the planar reconstruction data is not processed into blocks, the planar reconstruction data is directly input into the seam detection module to output accurate seam area image data.

[0103] Furthermore, after inputting the planar reconstruction data into the seam detection model, the seam area image data can be output based on the detection results. Specifically, if the planar reconstruction data detects seams, the output seam area image data can be seam area image data with a seam mask; if the planar reconstruction data does not contain seams, the output seam area image data can be planar reconstruction data without a seam mask.

[0104] As can be seen, in the above scheme, the image data of the fabric can be corrected and restored, and the restored image can be used to train the sewing thread detection model. The trained sewing thread detection model can quickly and accurately detect the position of the sewing thread of the fabric, thereby improving the detection accuracy and efficiency of the sewing thread.

[0105] Please see Figure 8 As shown, the present invention also provides a sewing thread detection system for non-planar fabrics, which corresponds one-to-one with the detection methods in the above embodiments. This detection system may include a data acquisition module 40, an affine transformation module 41, an image stitching module 42, an image annotation module 43, a model training module 44, an image restoration module 45, and a data processing module 46.

[0106] In one embodiment of the present invention, the data acquisition module 40 can be used to acquire planar image data of each surface of a non-planar fabric sample;

[0107] In one embodiment of the present invention, the affine transformation module 41 can be used to perform an affine transformation on each planar image data to generate transformed image data corresponding to each planar image data; specifically, the affine transformation module 41 can be used to establish an affine transformation model for each planar image data based on a preset mapping relationship between planar coordinate points and affine coordinate points, wherein the affine transformation model is represented as follows: Where (α, β) are the initial coordinates of the planar image data, (x, y) are the corresponding coordinates of the initial coordinates in the affine image data, and a1, a2, a3, a4, t x and t y The model parameters are defined as follows: each planar image data is input into the corresponding affine transformation model to output the affine image data corresponding to each planar image data; grayscale resampling is performed on each affine image data to generate the transformed image data corresponding to each affine image data.

[0108] In one embodiment of the present invention, the affine transformation module 41 can also be used to perform grayscale resampling processing on each affine image data based on bilinear interpolation to generate grayscale value data for each coordinate point in each affine image data; based on the grayscale value data for each coordinate point in each affine image data, transform image data corresponding to each affine image data is generated, wherein the grayscale value data is represented as f(x,y)=(1-γ)(1-θ)g(α0,β0)+γ(1-θ)g(α0+1,β0)+(1-γ)θg(α0,β0)+γθg(α0+1,β0)

[0109] 1,β0+1), f(x,y) is the gray value of the (x,y) coordinate point in the affine image data, g(α,β) is the gray value of the (α,β) coordinate point in the planar image data, α∈(α0,α0+1), β∈(β0,β0+1), γ=α-α0, θ=β-β0.

[0110] In one embodiment of the present invention, the image stitching module 42 can be used to stitch all transformed image data to generate stitched planar data;

[0111] In one embodiment of the present invention, the image annotation module 43 can be used to perform stitch line annotation processing on the splicing plane data to generate mask image data;

[0112] In one embodiment of the present invention, the model training module 44 can be used to train a preset semantic segmentation network model using mask image data to generate a stitch detection model. Specifically, the model training module 44 can be used to input mask image data into the semantic segmentation network model to output stitch prediction data, wherein the semantic segmentation network model includes a stitch feature extraction network, a context feature extraction network, and a prediction network; construct a loss function between the stitch prediction data and the actual stitch data; and train the semantic segmentation network model based on the loss function to generate a stitch detection model. The loss function is expressed as follows: Among them, L cls This represents the loss between the predicted classification data and the actual classification data. This represents the loss between predicted location data and actual location data. This represents the overlap between predicted location data and actual location data. This represents the portion of the predicted location data that is combined with the actual location data.

[0113] In one embodiment of the present invention, the model training module 44 can also be used to extract features from the mask image data based on the stitching feature extraction network to generate stitching image feature data; extract context feature data from the stitching image feature data based on the context feature extraction network; and perform feature enhancement processing on the stitching image feature data according to the context feature data to generate stitching feature-enhanced data, wherein the stitching feature-enhanced data is represented as follows: Y p Y represents the feature data of the stitching image. f The context feature data is represented by C, the number of image channels is represented by W, and the attention matrix between the stitching image feature data and the context feature data is represented by W. The stitching feature enhancement data is input into the prediction network to output stitching prediction data, which includes prediction location data and prediction classification data.

[0114] In one embodiment of the present invention, the image restoration module 45 can be used to perform affine transformation and stitching processing on the acquired image data of the fabric to be tested, so as to generate planar restoration data; specifically, the image restoration module 45 can be used to perform affine transformation on the acquired image data of each surface of the fabric to be tested, so as to generate intermediate image data corresponding to each acquired image data; and stitching processing is performed on all intermediate image data to generate planar restoration data.

[0115] In one embodiment of the present invention, the data processing module 46 can be used to input planar reconstruction data into the seam detection model to output seam area image data.

[0116] It should be noted that the non-planar fabric stitch detection system and the non-planar fabric stitch detection method provided in the above embodiments belong to the same concept. The specific operation methods of each module and unit have been described in detail in the method embodiments and will not be repeated here. In practical applications, the non-planar fabric stitch detection system provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. This is not a limitation here.

[0117] Embodiments of this application also provide an electronic device, including: one or more processors; and a storage device for storing one or more programs, which, when executed by one or more processors, cause the electronic device to implement the non-planar fabric stitch detection method provided in the above embodiments.

[0118] Figure 9 A schematic diagram of a computer system suitable for implementing the embodiments of this application is shown. It should be noted that... Figure 9 The computer system of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0119] like Figure 9 As shown, the computer system includes a Central Processing Unit (CPU) 901, which can perform various appropriate actions and processes based on programs stored in Read-Only Memory (ROM) 902 or programs loaded from storage portion 908 into Random Access Memory (RAM) 903, such as performing the methods described in the above embodiments. The RAM 903 also stores various programs and data required for system operation. The CPU 901, ROM 902, and RAM 903 are interconnected via a bus 904. An Input / Output (I / O) interface 905 is also connected to the bus 904.

[0120] The following components are connected to I / O interface 905: an input section 906 including a keyboard, mouse, etc.; an output section 907 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to I / O interface 905 as needed. Removable media 911, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 910 as needed so that computer programs read from them can be installed into storage section 908 as needed.

[0121] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 909, and / or installed from removable medium 911. When the computer program is executed by central processing unit (CPU) 901, it performs various functions defined in the system of this application.

[0122] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0123] Another aspect of this application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer's processor, causes the computer to perform the stitch detection method for non-planar fabrics as described above. This computer-readable storage medium may be included in the electronic device described in the above embodiments, or it may exist independently and not assembled into the electronic device.

[0124] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. A method of detecting a stitch in a non-planar fabric, the method comprising: The method comprises the following steps: acquiring planar image data of each surface of a non-planar fabric sample; establishing an affine transformation model for each of the planar image data based on a preset mapping relationship between planar coordinate points and affine coordinate points; inputting each of the planar image data into the corresponding affine transformation model to output affine image data corresponding to each of the planar image data; performing gray resampling processing on each of the affine image data based on a bilinear interpolation method to generate gray value data of each coordinate point in each of the affine image data; generating transformation image data corresponding to each of the affine image data based on the gray value data of each coordinate point in each of the affine image data; performing stitching processing on all the transformation image data to generate stitched planar data; performing sewing line marking processing on the stitched planar data to generate mask image data; extracting features from the mask image data based on a sewing line feature extraction network to generate sewing line image feature data; extracting context feature data of the sewing line image feature data based on a context feature extraction network; performing feature enhancement processing on the sewing line image feature data according to the context feature data to generate sewing line feature enhancement data; inputting the sewing line feature enhancement data into a prediction network to output sewing line prediction data, wherein the sewing line prediction data comprises predicted position data and predicted classification data; constructing a loss function of the sewing line prediction data and actual sewing line data; training a semantic segmentation network model based on the loss function to generate a sewing line detection model; the semantic segmentation network model comprises a sewing line feature extraction network, a context feature extraction network, and a prediction network; performing affine transformation and stitching processing on collected image data of a fabric to be detected to generate planar restoration data; inputting the planar restoration data into the sewing line detection model to output sewing line region image data.

2. The method of stitch detection for non-planar fabrics of claim 1, wherein, The affine transformation model is represented as where (a, b) is the initial coordinate of the planar image data, (x, y) is the corresponding coordinate in the affine image data corresponding to the initial coordinate, a1, a2, a3, a4, t x and t y are model parameters.

3. The method of stitch detection for non-planar fabrics of claim 2, wherein, The gray value data is represented as f(x, y) = (1-γ)(1-θ)g(α0, β0) + γ(1-θ)g(α0+1, β0) + (1-γ)θg(α0, β0) + γθg(α0+1, β0+1), f(x, y) is the gray value data of the (x, y) coordinate point in the affine image data, g(α, β) is the gray value of the (α, β) coordinate point in the planar image data, α ∈ (α0, α0+1), β ∈ (β0, β0+1), γ = α-α0, θ = β-β0.

4. The method of stitch detection for non-planar fabrics of claim 1, wherein, The sewing thread feature enhancement data is represented as Y p The sewing thread image feature data is represented as Y f The context feature data is represented as C, C represents the number of image channels, and W represents an attention matrix between the sewing thread image feature data and the context feature data.

5. The method of stitch detection for non-planar fabrics of claim 1, wherein, The loss function is represented as where L cls represents the loss between the predicted classification data and the true classification data, represents the loss between the predicted location data and the actual location data, represents the overlapping part of the predicted location data and the actual location data, represents the non-overlapping part of the predicted location data and the actual location data, and N represents the total number of predicted location data or actual location data.

6. The method of stitch detection for non-planar fabrics of claim 1, wherein, The step of performing affine transformation and stitching processing on collected image data of a fabric to be detected to generate planar restoration data comprises: performing affine transformation on collected image data of each surface of a fabric to be detected to generate intermediate image data corresponding to each of the collected image data; performing stitching processing on all the intermediate image data to generate planar restoration data.

7. A non-planar fabric thread detection system characterized by, The sewing line detection system comprises: a data acquisition module configured to acquire planar image data of each surface of a non-planar fabric sample; An affine transformation module is configured to perform affine transformation on each of the planar image data to generate transformed image data corresponding to each of the planar image data; An image stitching module is configured to perform stitching processing on all the transformed image data to generate stitched planar data; An image labeling module is configured to perform stitch line labeling processing on the stitched planar data to generate mask image data; A model training module is configured to train a preset semantic segmentation network model by using the mask image data to generate a stitch line detection model; An image restoration module is configured to perform affine transformation and stitching processing on collected image data of a to-be-detected fabric to generate planar restoration data; A data processing module is configured to input the planar restoration data into the stitch line detection model to output stitch line region image data.

8. An electronic device, comprising: The electronic device includes: one or more processors; a storage device configured to store one or more programs that, when executed by the one or more processors, cause the electronic device to implement the stitch line detection method for non-planar fabric according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, a computer program is stored thereon, when the computer program is executed by the processor of the computer, the computer executes the stitch line detection method for non-planar fabric according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • AR navigation method and system for corneal transplantation suture operation based on instance segmentation network

    CN114283260A

  • Crack detection method

    CN115240070A