Leather surface defect detection and grading method and system based on AI vision

By introducing a leather surface defect detection and grading method based on random geometric modeling and Markov chain Monte Carlo sampling framework, the problem of unstable leather surface grading in existing technologies is solved, and the consistency and repeatability of leather surface defect grading are achieved.

CN122115398APending Publication Date: 2026-05-29ZHONGNIU GRP

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHONGNIU GRP
Filing Date
2026-03-05
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing leather surface inspection methods are difficult to make stable and repeatable grading judgments on leather surfaces with complex textures, uneven distribution of defects, or obvious differences between regions, and lack the ability to model the spatial distribution structure of defects and the correlation between regions.

Method used

A leather surface defect detection and grading method based on AI vision is adopted. A random geometric modeling mechanism and a grading condition adaptive Markov chain Monte Carlo sampling framework are introduced to perform joint modeling and probabilistic constraint update on the spatial distribution of defects in multiple regions of the leather surface, and a grading judgment process including grade consistency constraints is constructed.

Benefits of technology

It achieves high consistency in leather surface defect grading results, stable spatial distribution characterization, and repeatable overall judgment, avoiding fluctuations in sampling status under fixed parameter conditions and outputting stable overall leather grading results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122115398A_ABST
    Figure CN122115398A_ABST
Patent Text Reader

Abstract

The application discloses a kind of leather surface flaw detection grading method and system based on AI vision, specifically includes: step 1: collection leather surface image data and divide leather surface analysis area, generate spatial position mark and texture feature vector;Step 2: construct random geometric model including spatial intensity parameter set, spatial interaction parameter set and flaw grade state variable set;Step 3: construct grading condition adaptive proposal distribution and generate sample candidate parameter set;Step 4: introduce grade consistency potential function to construct target probability distribution;Step 5: execute Markov chain Monte Carlo acceptance determination to generate parameter update result;Step 6: generate flaw spatial distribution state;Step 7: generate flaw grading determination result and output leather overall grading result.The application introduces random geometric constraint, realizes accurate grading.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial visual quality inspection technology, and in particular to a method and system for detecting and classifying leather surface defects based on AI vision. Background Technology

[0002] Leather products are widely used in clothing, furniture, and automotive interiors. The surface quality of leather directly affects the consistency of the product's appearance and its grading and pricing. During leather production and processing, variations in raw materials, processing conditions, and environmental factors can easily lead to localized irregularities on the leather surface, such as spots, holes, and abnormal textures. These surface anomalies exhibit significant uncertainty in their spatial distribution, morphological structure, and density, and different types of anomalies often overlap or interact with each other, posing considerable challenges to quality inspection and grading.

[0003] Existing leather surface inspection methods largely rely on human experience or rule-based judgment methods based on image features. They typically complete detection and grading through local threshold comparisons, simple statistical features, or single model outputs. These methods are prone to inconsistencies in region judgment or fluctuating grading results when dealing with leather surfaces with complex textures, uneven defect distribution, or significant differences between regions. Furthermore, some machine vision-based inspection methods focus on analyzing single regions or features, lacking the ability to model the spatial distribution structure of defects and the relationships between regions, making it difficult to generate unified and stable grading results for the overall leather surface quality.

[0004] Furthermore, existing technologies rarely combine defect grading processes with uncertainty modeling. They typically use fixed parameters or static judgment rules to process detection results, making it difficult to adapt to the varying needs of different leather batches and regional conditions. Therefore, how to introduce a modeling method that can characterize the spatial distribution features of defects and regional consistency constraints based on leather surface image analysis, and achieve a stable and repeatable grading judgment process, has become an unresolved problem in existing leather surface inspection and grading technologies. Summary of the Invention

[0005] One objective of this invention is to propose a leather surface defect detection and grading method and system based on AI vision. This invention introduces a stochastic geometric modeling mechanism and a grading condition adaptive Markov chain Monte Carlo sampling framework to perform joint modeling and probability constraint updates on the spatial distribution of defects in multiple regions of the leather surface, and constructs a grading judgment process that includes grade consistency constraints. It has the characteristics of high consistency of grading results, stable spatial distribution characterization, and repeatable overall judgment.

[0006] A leather surface defect detection and grading method based on AI vision according to an embodiment of the present invention includes the following steps:

[0007] Step 1: Collect leather surface image data, perform region segmentation on the leather surface image data to generate several leather surface analysis regions, and generate corresponding spatial location identifiers and texture feature vectors for each leather surface analysis region; Step 2: Construct a stochastic geometric model for each leather surface analysis region. The stochastic geometric model includes a set of spatial intensity parameters, a set of spatial interaction parameters, and a set of defect level state variables; Step 3: Construct a grading condition adaptive proposal distribution based on the defect level state variable set, and dynamically adjust the proposal distribution parameters in the Markov chain Monte Carlo sampling process to form a set of sampling candidate parameters under grading condition constraints; Step 4: Introduce a grading consistency potential function into the stochastic geometric model. The grading consistency potential function applies spatial consistency constraints to the defect level state variables of adjacent leather surface analysis regions, and constructs a target probability distribution containing grading consistency constraints; Step 5: Input the sampling candidate parameter set into the target probability distribution and perform Markov chain Monte Carlo acceptance judgment to generate parameter update results; Step 6: Generate the defect spatial distribution state corresponding to the leather surface analysis region based on the parameter update results; Step 7: Generate the leather surface defect grading judgment result based on the defect spatial distribution state and the defect level state variable set, and output the overall leather grading result.

[0008] Optionally, the execution area division in step 1 specifically includes:

[0009] Read the leather surface image data to form a two-dimensional pixel matrix, establish a pixel coordinate system containing horizontal and vertical coordinate axes, set the region width value, region height value, horizontal step value and vertical step value, and generate a set of region starting coordinate pairs along the horizontal and vertical coordinate axes according to the corresponding step value;

[0010] For each pair of starting coordinates of a region, a sub-matrix corresponding to the region width and region height values ​​is obtained by cropping from the two-dimensional pixel matrix. The sub-matrix is ​​written into the leather surface analysis region set, and the boundary coordinate quadruples corresponding to the sub-matrix are extracted as spatial location identifiers.

[0011] For each submatrix, perform texture feature parsing operations to generate texture feature vectors, and write the texture feature vectors into the corresponding leather surface analysis area record.

[0012] Optionally, step 2, constructing the stochastic geometric model, includes the following steps:

[0013] Read the spatial location identifier corresponding to each leather surface analysis area in the leather surface analysis area set, and generate a defect event location set within the leather surface analysis area based on the spatial location identifier; each defect event in the defect event location set represents the location of a spatial anomaly event participating in random geometric modeling within the leather surface analysis area, and the defect event is recorded in the form of two-dimensional spatial coordinates;

[0014] Spatial statistical calculations are performed on the set of defect event locations to generate a set of spatial intensity parameters. The set of spatial intensity parameters records the distribution density values ​​of defect events within the analysis area on the leather surface. Distance calculations are performed on any two sets of defect event locations in the set of defect event locations. Based on the distance calculation results, a set of spatial interaction parameters is generated. The set of spatial interaction parameters records the spatial correlation values ​​between defect events and establishes a correspondence with the set of defect level state variables.

[0015] Optionally, step 3, which involves constructing a graded conditional adaptive proposal distribution based on the set of defect level state variables, specifically includes:

[0016] Read the value of each defect level state variable in the defect level state variable set, and look up the corresponding proposal scale parameter and proposal direction parameter in the preset level index table according to the defect level state variable value. The proposal scale parameter and proposal direction parameter form a proposal distribution parameter vector. Input the proposal distribution parameter vector into the proposal distribution generation module, perform numerical constraints on the parameter perturbation amplitude according to the proposal scale parameter, and perform vector constraints on the parameter perturbation direction according to the proposal direction parameter to generate a conditional proposal distribution corresponding to the defect level state variable value. During the Markov chain Monte Carlo sampling process, sample candidate parameters are generated from the conditional proposal distribution according to the current defect level state variable value, and the sample candidate parameters are written into the sample candidate parameter set.

[0017] Optionally, step 3, which involves dynamically adjusting the proposal distribution parameters during the Markov chain Monte Carlo sampling process, includes the following steps:

[0018] Before the Markov chain Monte Carlo sampling begins, the defect level state variable value corresponding to the current leather surface analysis area is read, and the initial proposal scale parameter and initial proposal direction parameter corresponding to the defect level state variable value are located in the level index table. The initial proposal scale parameter and initial proposal direction parameter are combined to form the initial proposal distribution parameter vector. At the beginning of each sampling iteration, the parameter update result and the corresponding defect level state variable value recorded in the previous sampling iteration are read. The vector norm is calculated on the numerical difference vector between the parameter update result and the current parameter state to generate the parameter change amplitude value. The parameter change amplitude value is input into the proposal scale update mapping table. The scale adjustment coefficient corresponding to the parameter change amplitude value is found in the proposal scale update mapping table, and the current proposal scale parameter is updated to generate the updated proposal scale parameter. The defect level state is read simultaneously. For the proposal direction parameters corresponding to the values ​​of the state variables, a direction consistency calculation is performed on the magnitude of the parameter change and the proposal direction parameters. Based on the direction consistency calculation result, a direction vector rotation or direction vector preservation operation is performed on the proposal direction parameters to generate updated proposal direction parameters. The updated proposal scale parameters and the updated proposal direction parameters are recombined to form an updated proposal distribution parameter vector, and the updated proposal distribution parameter vector is written to the proposal distribution parameter buffer. In the current sampling iteration, the updated proposal distribution parameter vector is read from the proposal distribution parameter buffer, the corresponding conditional proposal distribution is constructed, and sampling candidate parameters are generated from the conditional proposal distribution. After the sampling candidate parameters are generated, the sampling candidate parameters, the magnitude of the parameter change, and the updated proposal distribution parameter vector of the current sampling iteration are written to the sampling process record table to dynamically adjust the proposal distribution parameters for the next sampling iteration.

[0019] Optionally, step 4 specifically includes:

[0020] The process involves: reading the spatial location identifiers corresponding to each leather surface analysis region in the set of leather surface analysis regions; performing neighborhood resolution on the spatial location identifiers to generate a set of adjacent leather surface analysis region index pairs; for each index pair in the set of adjacent leather surface analysis region index pairs, reading the corresponding defect level state variable values, calculating the level difference between adjacent defect level state variable values, and generating a level difference sequence; performing a potential function mapping operation on each level difference in the level difference sequence to generate a level consistency potential function value corresponding to the level difference; introducing the level consistency potential function value as a probability penalty factor into the energy term construction process of the stochastic geometric model, applying weight reduction constraints to the state combinations corresponding to the level differences, forming a joint energy expression structure containing level consistency constraint terms; in the joint energy expression structure, assigning a first probability weight to state combinations whose level differences exceed a preset difference threshold, and assigning a second probability weight to state combinations whose level differences do not exceed the preset difference threshold, with the first probability weight being numerically smaller than the second probability weight, thus generating a target probability distribution parameter structure containing spatial consistency constraint relationships;

[0021] Write the target probability distribution parameter structure into the target probability distribution cache.

[0022] Optionally, step 5 includes the following steps:

[0023] Read the target probability distribution parameter structure from the target probability distribution buffer, read the updated proposal distribution parameter vector from the proposal distribution parameter buffer, and read the current sampling candidate parameter from the sampling candidate parameter set;

[0024] Input the current sampled candidate parameter into the target probability distribution parameter structure, calculate the candidate probability value corresponding to the current sampled candidate parameter, input the current parameter state recorded in the parameter update result into the target probability distribution parameter structure, and calculate the current probability value corresponding to the current parameter state.

[0025] Calculate the ratio between the candidate probability value and the current probability value to generate a probability ratio value, and perform an upper bound truncation operation on the probability ratio value to generate an acceptance threshold value;

[0026] Generate a random value between zero and one, perform a numerical comparison operation between the random value and the acceptance threshold value, write the current sampling candidate parameter into the parameter update result if the random value does not exceed the acceptance threshold value, write the current parameter status into the parameter update result if the random value exceeds the acceptance threshold value, and write the acceptance determination result into the sampling process record table.

[0027] Optionally, step 6 specifically includes:

[0028] Read the stochastic geometric model parameter state from the parameter update results. The stochastic geometric model parameter state includes the current values ​​of the spatial intensity parameter set and the spatial interaction parameter set. Read the spatial location identifiers corresponding to the target leather surface analysis area from the leather surface analysis area set. Read the subset of defect event locations that fall within the range of the spatial location identifiers from the defect event location set.

[0029] For each defect event location in the defect event location subset, the current value of the spatial intensity parameter set is used to perform an intensity value calculation operation, generating an intensity value sequence. The intensity value sequence is written into the intensity record sequence in the order of the defect event location index. For any two sets of defect event locations in the defect event location subset, a distance calculation is performed. The distance calculation result is input into the current value of the spatial interaction parameter set to perform an interaction value calculation operation, generating an interaction value set. The interaction value set is written into the interaction record set according to the event location index.

[0030] The spatial location identifier, the subset of defect event locations, the intensity record sequence, and the set of interaction records are combined and written into the defect spatial distribution state record. The defect spatial distribution state record is written into the state buffer area that corresponds one-to-one with the analysis area of ​​the target leather surface. Each defect spatial distribution state record in the state buffer area serves as the input data for defect grading and determination.

[0031] Optionally, step 7 includes the following steps:

[0032] Read the spatial distribution status record of defects corresponding to each leather surface analysis area from the status buffer, and read the set of level numbers from the set of defect level status variables. The set of level numbers contains at least two level numbers. Establish a level scoring vector for each leather surface analysis area. Each component of the level scoring vector corresponds one-to-one with the level number in the set of level numbers.

[0033] Statistical operations are performed on the intensity record sequence in the defect spatial distribution state record to generate intensity statistical values, and statistical operations are performed on the interaction record set to generate interaction statistical values. The intensity statistical values ​​and interaction statistical values ​​are input into the grade mapping table. The candidate grade number corresponding to the intensity statistical value and interaction statistical value is found in the grade mapping table. The candidate grade number is written into the corresponding component position of the grade scoring vector and incremented by one.

[0034] For each leather surface analysis region, a maximum value selection operation is performed on the grade scoring vector to generate a leather surface analysis region grading result, which is then written to the grading result cache. All leather surface analysis region grading results are read from the grading result cache, and a region-level grade aggregation operation is performed to generate an overall leather grade counting vector. Each component of the overall leather grade counting vector corresponds one-to-one with a grade number in the grade number set. Finally, a maximum value selection operation is performed on the overall leather grade counting vector to output the overall leather grading result.

[0035] A leather surface defect detection and grading system based on AI vision according to an embodiment of the present invention includes the following modules:

[0036] The image acquisition module is used to acquire image data of the leather surface and generate leather surface images containing multiple regions;

[0037] The region segmentation module is used to perform region segmentation on the leather surface image data, generate several leather surface analysis regions, and generate spatial location identifiers and texture feature vectors for each analysis region.

[0038] The stochastic geometry modeling module is used to construct a stochastic geometry model for each leather surface analysis area. The model includes a set of spatial intensity parameters, a set of spatial interaction parameters, and a set of defect level state variables.

[0039] The proposal distribution generation module is used to construct a hierarchical conditional adaptive proposal distribution based on the set of defect level state variables, and to dynamically adjust the proposal distribution parameters during the Markov chain Monte Carlo sampling process to generate a set of sampling candidate parameters.

[0040] The consistency constraint module is used to introduce a level consistency potential function into the stochastic geometric model. This potential function imposes a spatial consistency constraint on the defect level state variables of adjacent leather surface analysis areas, forming a target probability distribution containing consistency constraints.

[0041] The parameter update module is used to input the sampled candidate parameter set into the target probability distribution, perform Markov chain Monte Carlo acceptance decision, and generate parameter update results;

[0042] The grading and determination module is used to generate the spatial distribution status of defects in the leather surface analysis area based on the parameter update results, and generate the leather surface defect grading and determination results based on the status and defect level status variable set, and finally output the overall leather grading results.

[0043] The beneficial effects of this invention are:

[0044] (1) This invention introduces a random geometric model at the level of the analysis area on the leather surface to uniformly model the spatial position relationship, distribution density and interaction relationship of defect events, so that the defects on the leather surface are transformed from discrete local detection results into spatial structured descriptions, forming a defect spatial distribution state that can be used for subsequent grading judgment, thereby ensuring the consistency and repeatability of the grading process in the spatial dimension.

[0045] (2) In the parameter update stage, the present invention adopts a hierarchical condition adaptive Markov chain Monte Carlo sampling mechanism, which dynamically adjusts the proposal distribution parameters according to the defect level state variable, so that the sampling process and the hierarchical state maintain a consistent constraint relationship, avoids the hierarchical instability caused by sampling state fluctuations under fixed parameter conditions, and forms a continuous and controllable parameter update process.

[0046] (3) In the process of constructing the target probability distribution, the present invention introduces a level consistency potential function to apply spatial consistency constraints on the defect level status of adjacent leather surface analysis areas, so that the regional level grading results maintain structural coordination relationship within the overall leather surface range, thereby forming a stable regional grading result aggregation mechanism and outputting the overall leather grading result with consistent judgment logic. Attached Figure Description

[0047] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:

[0048] Figure 1 This is a flowchart of a method and system for detecting and classifying leather surface defects based on AI vision, as proposed in this invention.

[0049] Figure 2 This is a schematic diagram illustrating the implementation process of an AI vision-based leather surface defect detection and grading method and system proposed in this invention, which features an adaptive proposal distribution for grading conditions.

[0050] Figure 3 This diagram illustrates the process of introducing the grade consistency potential function into the leather surface defect detection and grading method and system based on AI vision proposed in this invention. Detailed Implementation

[0051] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.

[0052] refer to Figures 1-3 A method for detecting and grading leather surface defects based on AI vision includes the following steps:

[0053] Step 1: Collect leather surface image data, perform region segmentation on the leather surface image data to generate several leather surface analysis regions, and generate corresponding spatial location identifiers and texture feature vectors for each leather surface analysis region; Step 2: Construct a stochastic geometric model for each leather surface analysis region. The stochastic geometric model includes a set of spatial intensity parameters, a set of spatial interaction parameters, and a set of defect level state variables; Step 3: Construct a grading condition adaptive proposal distribution based on the defect level state variable set, and dynamically adjust the proposal distribution parameters in the Markov chain Monte Carlo sampling process to form a set of sampling candidate parameters under grading condition constraints; Step 4: Introduce a grading consistency potential function into the stochastic geometric model. The grading consistency potential function applies spatial consistency constraints to the defect level state variables of adjacent leather surface analysis regions, and constructs a target probability distribution containing grading consistency constraints; Step 5: Input the sampling candidate parameter set into the target probability distribution and perform Markov chain Monte Carlo acceptance judgment to generate parameter update results; Step 6: Generate the defect spatial distribution state corresponding to the leather surface analysis region based on the parameter update results; Step 7: Generate the leather surface defect grading judgment result based on the defect spatial distribution state and the defect level state variable set, and output the overall leather grading result.

[0054] In this embodiment, the execution area division in step 1 specifically includes:

[0055] Read the leather surface image data to form a two-dimensional pixel matrix, establish a pixel coordinate system containing horizontal and vertical coordinate axes, set the region width value, region height value, horizontal step value and vertical step value, and generate a set of region starting coordinate pairs along the horizontal and vertical coordinate axes according to the corresponding step value;

[0056] For each pair of starting coordinates of a region, a sub-matrix corresponding to the region width and region height values ​​is obtained by cropping from the two-dimensional pixel matrix. The sub-matrix is ​​written into the leather surface analysis region set, and the boundary coordinate quadruples corresponding to the sub-matrix are extracted as spatial location identifiers.

[0057] For each submatrix, perform texture feature parsing operations to generate texture feature vectors, and write the texture feature vectors into the corresponding leather surface analysis area record.

[0058] In this embodiment, performing texture feature parsing operations specifically includes:

[0059] Read the grayscale values ​​of each pixel in the submatrix and rearrange the pixel grayscale values ​​in row-matrix order to form a two-dimensional grayscale distribution matrix. In the two-dimensional grayscale distribution matrix, with a preset pixel spacing as the step size, count the occurrence frequency of grayscale combinations of adjacent pixels in the horizontal, vertical and diagonal directions to generate grayscale co-occurrence statistical matrices for the corresponding directions. Calculate the energy component, contrast component, correlation component and uniformity component for each grayscale co-occurrence statistical matrix. Each component represents the texture distribution characteristics of the submatrix in the corresponding direction in numerical form. The energy component is used to characterize the concentration of the probability distribution of grayscale combinations in the submatrix and is used as a component of the texture feature vector in the form of the sum of squares of the probability values ​​in the grayscale co-occurrence statistical matrix. Perform vector concatenation operation on the energy component, contrast component, correlation component and uniformity component obtained from different directions in a preset order to form a fixed-length texture feature vector. Write the generated texture feature vector into the corresponding leather surface analysis area record and establish an index association with the spatial location identifier of the leather surface analysis area.

[0060] In this embodiment, step 2, constructing the stochastic geometric model, includes the following steps:

[0061] Read the spatial location identifier corresponding to each leather surface analysis region in the leather surface analysis region set, and generate a defect event location set within the leather surface analysis region based on the spatial location identifier; each defect event in the defect event location set represents the location of a spatial anomaly event participating in random geometric modeling within the leather surface analysis region, and the defect events are recorded in the form of two-dimensional spatial coordinates;

[0062] Spatial statistical calculations are performed on the set of defect event locations to generate a set of spatial intensity parameters. The set of spatial intensity parameters records the distribution density values ​​of defect events within the analysis area on the leather surface. Distance calculations are performed on any two sets of defect event locations in the set of defect event locations. Based on the distance calculation results, a set of spatial interaction parameters is generated. The set of spatial interaction parameters records the spatial correlation values ​​between defect events and establishes a correspondence with the set of defect level state variables.

[0063] In this embodiment, step 2, the execution space statistical calculation, specifically includes:

[0064] Based on the spatial location markers of the leather surface analysis area, the corresponding area value is determined. Within the leather surface analysis area, the area is divided into several statistical sub-regions according to a preset spatial division scale. For each statistical sub-region, the number of defect event locations falling within the statistical sub-region is counted, generating a corresponding event count value. The event count values ​​of each statistical sub-region are normalized with the corresponding statistical sub-region area value to generate an event density value. The event density values ​​corresponding to all statistical sub-regions are written into the spatial intensity parameter set according to the statistical sub-region index order, so that the spatial intensity parameter set records the spatial distribution density of defect events within the leather surface analysis area.

[0065] In this embodiment, step 3, constructing the hierarchical conditional adaptive proposal distribution based on the defect level state variable set, specifically includes:

[0066] Read the value of each defect level state variable in the defect level state variable set, and look up the corresponding proposal scale parameter and proposal direction parameter in the preset level index table according to the defect level state variable value. The proposal scale parameter and proposal direction parameter form a proposal distribution parameter vector. Input the proposal distribution parameter vector into the proposal distribution generation module, perform numerical constraints on the parameter perturbation amplitude according to the proposal scale parameter, and perform vector constraints on the parameter perturbation direction according to the proposal direction parameter to generate a conditional proposal distribution corresponding to the defect level state variable value. During the Markov chain Monte Carlo sampling process, sample candidate parameters are generated from the conditional proposal distribution according to the current defect level state variable value, and the sample candidate parameters are written into the sample candidate parameter set.

[0067] In this embodiment, the numerical limitation for step 3 specifically includes:

[0068] Read the proposal scale parameter values ​​from the proposal distribution parameter vector and determine the corresponding scale constraint interval for each parameter to be perturbed. The scale constraint interval consists of the upper and lower boundary values ​​generated with the current parameter value as the center and the proposal scale parameter as the radius. When generating parameter perturbation values, perform interval constraint judgment on each original perturbation value. When the perturbed parameter value falls within the corresponding scale constraint interval, retain the perturbation value as a valid perturbation result. When the perturbed parameter value exceeds the corresponding scale constraint interval, truncate the perturbed parameter value to the nearest interval boundary value to form a restricted perturbation value. Use the restricted perturbation value after being limited by the scale constraint interval as the final value of the parameter perturbation amplitude and establish a mapping relationship with the corresponding parameter index to form a parameter perturbation result that satisfies the proposal scale parameter constraint conditions.

[0069] In this embodiment, step 3, which involves dynamically adjusting the proposal distribution parameters during the Markov chain Monte Carlo sampling process, includes the following steps:

[0070] Before the Markov chain Monte Carlo sampling begins, the defect level state variable value corresponding to the current leather surface analysis area is read, and the initial proposal scale parameter and initial proposal direction parameter corresponding to the defect level state variable value are located in the level index table. The initial proposal scale parameter and initial proposal direction parameter are combined to form the initial proposal distribution parameter vector. At the beginning of each sampling iteration, the parameter update result and the corresponding defect level state variable value recorded in the previous sampling iteration are read. The vector norm is calculated on the numerical difference vector between the parameter update result and the current parameter state to generate the parameter change amplitude value. The parameter change amplitude value is input into the proposal scale update mapping table. The scale adjustment coefficient corresponding to the parameter change amplitude value is found in the proposal scale update mapping table, and the current proposal scale parameter is updated to generate the updated proposal scale parameter. The defect level state is read simultaneously. For the proposal direction parameters corresponding to the values ​​of the state variables, a direction consistency calculation is performed on the magnitude of the parameter change and the proposal direction parameters. Based on the direction consistency calculation result, a direction vector rotation or direction vector preservation operation is performed on the proposal direction parameters to generate updated proposal direction parameters. The updated proposal scale parameters and the updated proposal direction parameters are recombined to form an updated proposal distribution parameter vector, and the updated proposal distribution parameter vector is written to the proposal distribution parameter buffer. In the current sampling iteration, the updated proposal distribution parameter vector is read from the proposal distribution parameter buffer, the corresponding conditional proposal distribution is constructed, and sampling candidate parameters are generated from the conditional proposal distribution. After the sampling candidate parameters are generated, the sampling candidate parameters, the magnitude of the parameter change, and the updated proposal distribution parameter vector of the current sampling iteration are written to the sampling process record table to dynamically adjust the proposal distribution parameters for the next sampling iteration.

[0071] In this embodiment, step 3, performing numerical update, specifically refers to reading the current proposal scale parameter value and performing numerical operation on the value and the scale adjustment coefficient found in the proposal scale update mapping table to generate the updated proposal scale parameter value. The numerical operation includes performing multiplication or addition operations on the current proposal scale parameter value and the scale adjustment coefficient. The updated proposal scale parameter value is used as the scale parameter value for limiting the parameter perturbation amplitude in the next sampling iteration.

[0072] In this embodiment, step 3, the consistency calculation of execution direction, specifically includes:

[0073] Read the direction vector representation corresponding to the proposal direction parameter, which is recorded in vector form consistent with the parameter space dimension; perform a vector dot product operation between the parameter change vector corresponding to the parameter change magnitude and the direction vector corresponding to the proposal direction parameter to generate a direction consistency judgment value; perform a sign judgment operation on the direction consistency judgment value. When the direction consistency judgment value is positive, the parameter change direction is determined to be consistent with the proposal direction parameter; when the direction consistency judgment value is negative, the parameter change direction is determined to be inconsistent with the proposal direction parameter; based on the direction consistency judgment result, choose to perform a direction vector preservation operation or a direction vector reversal operation on the proposal direction parameter to generate an updated proposal direction parameter for the current sampling iteration.

[0074] In this embodiment, step 4 specifically includes:

[0075] The process involves: reading the spatial location identifiers corresponding to each leather surface analysis region in the set of leather surface analysis regions; performing neighborhood resolution on the spatial location identifiers to generate a set of adjacent leather surface analysis region index pairs; for each index pair in the set of adjacent leather surface analysis region index pairs, reading the corresponding defect level state variable values, calculating the level difference between adjacent defect level state variable values, and generating a level difference sequence; performing a potential function mapping operation on each level difference in the level difference sequence to generate a level consistency potential function value corresponding to the level difference; introducing the level consistency potential function value as a probability penalty factor into the energy term construction process of the stochastic geometric model, applying weight reduction constraints to the state combinations corresponding to the level differences, forming a joint energy expression structure containing level consistency constraint terms; in the joint energy expression structure, assigning a first probability weight to state combinations whose level differences exceed a preset difference threshold, and assigning a second probability weight to state combinations whose level differences do not exceed the preset difference threshold, with the first probability weight being numerically smaller than the second probability weight, thus generating a target probability distribution parameter structure containing spatial consistency constraint relationships;

[0076] Write the target probability distribution parameter structure into the target probability distribution cache.

[0077] In this embodiment, step 4, performing the neighborhood resolution operation, specifically includes:

[0078] Read the spatial location identifier corresponding to each leather surface analysis area. The spatial location identifier is recorded in the form of a quadruple of area boundary coordinates. Based on the boundary coordinate values ​​recorded in the spatial location identifier, perform boundary relationship calculation on the spatial location identifiers of any two leather surface analysis areas to determine the relative positional relationship between the two analysis areas in the spatial coordinate system. When the boundary coordinates of two leather surface analysis areas meet the preset spatial distance conditions of being adjacent or overlapping in the horizontal or vertical direction, it is determined that the two leather surface analysis areas constitute a neighborhood relationship, and a corresponding neighborhood association record is generated. Write all leather surface analysis area number pairs that meet the neighborhood relationship determination conditions into the set of adjacent leather surface analysis area index pairs to complete the neighborhood resolution operation of the spatial location identifier.

[0079] In this embodiment, step 4, the execution of the potential function mapping operation, specifically includes:

[0080] Read the numerical value of the grade difference and determine the potential function calculation parameters corresponding to the grade difference based on the preset potential function parameter table; substitute the grade difference value into the preset potential function expression according to the potential function calculation parameters, perform numerical calculation on the grade difference value, and generate the corresponding grade consistency potential function value; the potential function expression is a monotonic function with respect to the grade difference value, its function input is the grade difference value, and its function output is the potential function value in non-negative numerical form; write the generated grade consistency potential function value corresponding to each grade difference into the potential function value sequence according to the index order of the grade difference sequence.

[0081] In this embodiment, the energy term construction in step 4 is as follows:

[0082] The system reads the original energy term value corresponding to the current parameter state in the stochastic geometric model. The original energy term value is calculated from the values ​​corresponding to the spatial intensity parameter set and the spatial interaction parameter set. Simultaneously, it reads the level consistency potential function value corresponding to the current parameter state and converts it into an energy increment value according to a preset penalty introduction rule. According to the penalty introduction rule, it performs a numerical superposition operation on the energy increment value and the original energy term value to generate a joint energy term value. The energy increment value corresponding to the level consistency potential function value is used to increase the joint energy term value. In the subsequent probability value calculation process, a probability value for the Markov chain Monte Carlo acceptance decision is generated based on the joint energy term value. The increase in the joint energy term value corresponds to a decrease in the probability value, thereby subjecting the state corresponding to the level difference to a probability penalty in the acceptance decision.

[0083] In this embodiment, step 5 includes the following steps:

[0084] Read the target probability distribution parameter structure from the target probability distribution buffer, read the updated proposal distribution parameter vector from the proposal distribution parameter buffer, and read the current sampling candidate parameter from the sampling candidate parameter set;

[0085] Input the current sampled candidate parameter into the target probability distribution parameter structure, calculate the candidate probability value corresponding to the current sampled candidate parameter, input the current parameter state recorded in the parameter update result into the target probability distribution parameter structure, and calculate the current probability value corresponding to the current parameter state.

[0086] Calculate the ratio between the candidate probability value and the current probability value to generate a probability ratio value, and perform an upper bound truncation operation on the probability ratio value to generate an acceptance threshold value;

[0087] Generate a random value between zero and one, perform a numerical comparison operation between the random value and the acceptance threshold value, write the current sampling candidate parameter into the parameter update result if the random value does not exceed the acceptance threshold value, write the current parameter status into the parameter update result if the random value exceeds the acceptance threshold value, and write the acceptance determination result into the sampling process record table.

[0088] In this embodiment, step 5, calculating the candidate probability value corresponding to the current sampled candidate parameter, specifically includes:

[0089] When calculating the candidate probability value by inputting the current sampled candidate parameter into the target probability distribution parameter structure, the calculation method of the energy term corresponding to the stochastic geometric model is first read from the target probability distribution parameter structure, and the values ​​of the spatial intensity parameter and the spatial interaction parameter contained in the current sampled candidate parameter are also read. Based on the energy term calculation method, the values ​​of the spatial intensity parameter and the spatial interaction parameter are substituted into the energy term construction process of the stochastic geometric model to generate the joint energy term value corresponding to the current sampled candidate parameter. After the joint energy term value is generated, the candidate probability value corresponding to the current sampled candidate parameter is calculated based on the joint energy term value and the probability calculation relationship recorded in the target probability distribution parameter structure.

[0090] When calculating the current probability value by inputting the current parameter state recorded in the parameter update result into the target probability distribution parameter structure, the spatial intensity parameter value and spatial interaction parameter value corresponding to the current parameter state recorded in the parameter update result are read; according to the energy term calculation method consistent with the candidate probability value calculation process, the joint energy term value is calculated for the parameter value corresponding to the current parameter state to generate the joint energy term value corresponding to the current parameter state; based on the joint energy term value and the probability calculation relationship recorded in the target probability distribution parameter structure, the current probability value corresponding to the current parameter state is calculated.

[0091] In this embodiment, step 6 specifically includes:

[0092] Read the stochastic geometric model parameter state from the parameter update results. The stochastic geometric model parameter state includes the current values ​​of the spatial intensity parameter set and the spatial interaction parameter set. Read the spatial location identifiers corresponding to the target leather surface analysis area from the leather surface analysis area set. Read the subset of defect event locations that fall within the range of the spatial location identifiers from the defect event location set.

[0093] For each defect event location in the defect event location subset, the current value of the spatial intensity parameter set is used to perform an intensity value calculation operation, generating an intensity value sequence. The intensity value sequence is written into the intensity record sequence in the order of the defect event location index. For any two sets of defect event locations in the defect event location subset, a distance calculation is performed. The distance calculation result is input into the current value of the spatial interaction parameter set to perform an interaction value calculation operation, generating an interaction value set. The interaction value set is written into the interaction record set according to the event location index.

[0094] The spatial location identifier, the subset of defect event locations, the intensity record sequence, and the set of interaction records are combined and written into the defect spatial distribution state record. The defect spatial distribution state record is written into the state buffer area that corresponds one-to-one with the analysis area of ​​the target leather surface. Each defect spatial distribution state record in the state buffer area serves as the input data for defect grading and determination.

[0095] In this embodiment, step 6, the calculation of the execution intensity value, specifically includes:

[0096] Read the spatial coordinates corresponding to the location of the defect event, and locate the statistical sub-region to which it belongs within the analysis area of ​​the leather surface based on the spatial coordinates; in the set of spatial intensity parameters, find the event density value corresponding to the statistical sub-region one by one according to the index of the statistical sub-region. The event density value is calculated by normalizing the number of defect events in the statistical sub-region and the area value of the statistical sub-region; use the found event density value as the intensity value corresponding to the location of the defect event, and write the intensity value into the intensity record sequence according to the index order of the defect event location in the subset; repeat the above operation process for all defect event locations in the defect event location subset to complete the intensity value calculation based on the current value of the set of spatial intensity parameters.

[0097] In this embodiment, step 6, performing the interaction value calculation, specifically includes:

[0098] Read the spatial coordinates corresponding to the locations of two defective events, perform distance calculation on the two spatial coordinates, and generate the distance calculation result; read the interaction parameter group corresponding to the locations of the two defective events from the current values ​​of the spatial interaction parameter set. The interaction parameter group includes the distance attenuation coefficient and the action weight parameter; input the distance calculation result into the interaction parameter group, perform numerical operation on the distance calculation result and the distance attenuation coefficient, and generate the distance attenuation value; perform numerical operation on the distance attenuation value and the action weight parameter, and generate the interaction value corresponding to the locations of the two defective events; write the generated interaction value into the interaction record set according to the index order of the defective event location pair, and repeat the above operation process for all defective event location pairs that meet the pairing conditions to complete the calculation of the interaction value.

[0099] In this embodiment, step 7 includes the following steps:

[0100] Read the spatial distribution status record of defects corresponding to each leather surface analysis area from the status buffer, and read the set of level numbers from the set of defect level status variables. The set of level numbers contains at least two level numbers. Establish a level scoring vector for each leather surface analysis area. Each component of the level scoring vector corresponds one-to-one with the level number in the set of level numbers.

[0101] Statistical operations are performed on the intensity record sequence in the defect spatial distribution state record to generate intensity statistical values, and statistical operations are performed on the interaction record set to generate interaction statistical values. The intensity statistical values ​​and interaction statistical values ​​are input into the grade mapping table. The candidate grade number corresponding to the intensity statistical value and interaction statistical value is found in the grade mapping table. The candidate grade number is written into the corresponding component position of the grade scoring vector and incremented by one.

[0102] For each leather surface analysis region, a maximum value selection operation is performed on the grade scoring vector to generate a leather surface analysis region grading result, which is then written to the grading result cache. All leather surface analysis region grading results are read from the grading result cache, and a region-level grade aggregation operation is performed to generate an overall leather grade counting vector. Each component of the overall leather grade counting vector corresponds one-to-one with a grade number in the grade number set. Finally, a maximum value selection operation is performed on the overall leather grade counting vector to output the overall leather grading result.

[0103] A leather surface defect detection and grading system based on AI vision according to an embodiment of the present invention includes the following modules:

[0104] The image acquisition module is used to acquire image data of the leather surface and generate leather surface images containing multiple regions;

[0105] The region segmentation module is used to perform region segmentation on the leather surface image data, generate several leather surface analysis regions, and generate spatial location identifiers and texture feature vectors for each analysis region.

[0106] The stochastic geometry modeling module is used to construct a stochastic geometry model for each leather surface analysis area. The model includes a set of spatial intensity parameters, a set of spatial interaction parameters, and a set of defect level state variables.

[0107] The proposal distribution generation module is used to construct a hierarchical conditional adaptive proposal distribution based on the set of defect level state variables, and to dynamically adjust the proposal distribution parameters during the Markov chain Monte Carlo sampling process to generate a set of sampling candidate parameters.

[0108] The consistency constraint module is used to introduce a level consistency potential function into the stochastic geometric model. This potential function imposes a spatial consistency constraint on the defect level state variables of adjacent leather surface analysis areas, forming a target probability distribution containing consistency constraints.

[0109] The parameter update module is used to input the sampled candidate parameter set into the target probability distribution, perform Markov chain Monte Carlo acceptance decision, and generate parameter update results;

[0110] The grading and determination module is used to generate the spatial distribution status of defects in the leather surface analysis area based on the parameter update results, and generate the leather surface defect grading and determination results based on the status and defect level status variable set, and finally output the overall leather grading results.

[0111] Example 1:

[0112] To verify the feasibility and stability of this invention in practical use, it was applied to a leather surface quality inspection and grading scenario. In this scenario, after leather production, quality grading is required based on surface condition. Different areas may have scratches, holes, uneven texture, variations in surface roughness, etc. These conditions are spatially random, and adjacent areas often exhibit continuous or gradual relationships. Traditional methods based on single thresholds or local features are prone to grade jumps at region boundaries, leading to unstable overall grading results and failing to meet the requirements of continuous judgment and overall consistency. In practical application, a complete image of the leather surface is first acquired, and the image is then divided into regularized regions to form multiple leather surface analysis areas. Each analysis area is associated with a clear spatial location identifier, and a texture feature vector is generated through texture parsing operations to provide basic data for subsequent spatial modeling. Subsequently, a random geometric model is constructed within each leather surface analysis area. The distribution of anomalies in space is characterized by a set of defect event locations, and spatial intensity parameters and spatial interaction parameters are calculated respectively, enabling the model to reflect the degree of clustering of defects in local areas and their mutual influence relationships. In the model inference process, an adaptive proposal distribution based on defect level state variables is introduced to differentiate the parameter sampling process under different level conditions. As the sampling iteration progresses, the proposal distribution parameters are dynamically adjusted according to the parameter change amplitude, thus maintaining the ability to characterize spatial details while ensuring sampling stability. Simultaneously, a level consistency potential function is introduced between adjacent leather surface analysis areas, creating a constraint relationship between the level states of adjacent areas in probability calculations, avoiding isolated level determinations caused by local anomalies. Using a Markov chain Monte Carlo acceptance decision mechanism, probability values ​​are calculated for both the sampled candidate parameters and the current parameter state, and parameters are updated according to the acceptance decision rules. After parameter stabilization, the spatial distribution state of defects in each analysis area is generated based on spatial intensity parameters and spatial interaction parameters. This, combined with the defect level state variable set, forms the regional level grading determination result. Finally, the grading results of all analysis areas are summarized to obtain the overall leather grading result. To verify the effectiveness of the above process, the grading stability and consistency performance before and after introducing level consistency constraints are compared and analyzed. Statistical results show that, under the same input conditions, the method of the present invention exhibits better results in terms of regional level continuity, overall hierarchical consistency, and stability of repeated judgments, and can effectively reduce the impact of local misjudgments on the overall results.

[0113] Table 1: Comparative Statistical Results of Leather Surface Defect Grading

[0114] Detection method Number of analysis areas Percentage of areas with the same grade Number of level jumps Overall Consistency Index Consistency rate of duplicate judgments No consistency constraints were introduced 120 68.3% 27 0.71 0.82 Introducing the method of the present invention 120 89.6% 9 0.88 0.94

[0115] As can be seen from the data in Table 1, under the condition of the same number of analysis areas, different detection methods exhibit significant differences in grading stability and consistency. Both methods divided the same leather surface into 120 analysis areas, ensuring a consistent basis for the comparison process at the area scale. Without introducing consistency constraints, the proportion of areas with consistent grades in the analysis areas was 68.3%, indicating that many areas still showed discontinuities in grade between adjacent spatial locations, with 27 grade jumps between areas. This phenomenon was particularly evident in areas with dense spatial distribution or frequent texture changes. The corresponding overall consistency index was 0.71, reflecting a certain degree of dispersion in the overall aggregation of area-level judgment results.

[0116] After introducing the method of this invention, the proportion of regions with consistent levels increased to 89.6%, and the level distribution between adjacent regions exhibited a more continuous spatial characteristic. The number of level jumps decreased to 9, indicating that the regional level classification results were more stable in the spatial dimension. At the same time, the overall consistency index increased to 0.88, indicating that when summarizing and judging all analyzed regions, the synergy between the classification results of each region was higher, and the stability of the overall classification results was significantly enhanced.

[0117] From the perspective of the consistency rate of repeated decisions, the consistency rate without the introduction of consistency constraints is 0.82, which still shows some fluctuation under multiple repeated decisions. After adopting the method of this invention, the consistency rate of repeated decisions increases to 0.94, indicating that under the same input conditions, the results obtained by executing the hierarchical process multiple times remain highly consistent. This change shows that the adaptive sampling of hierarchical conditions and the spatial consistency constraints form a more stable numerical evolution path in the parameter inference process, making the final hierarchical result less susceptible to the influence of local random disturbances.

[0118] Based on the above data, it can be seen that after introducing spatial consistency constraints and hierarchical conditional sampling mechanisms, the regional-level grading results exhibit more coordinated distribution characteristics in terms of spatial continuity, overall consistency, and stability of repeated judgments, providing a reliable data foundation for the generation of overall leather grading results.

[0119] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A method for detecting and grading surface defects in leather based on AI vision, characterized in that, Includes the following steps: Step 1: Acquire leather surface image data, perform region segmentation on the leather surface image data to generate several leather surface analysis regions, and generate corresponding spatial location identifiers and texture feature vectors for each leather surface analysis region; Step 2: Construct a stochastic geometric model for each leather surface analysis area. The stochastic geometric model includes a set of spatial intensity parameters, a set of spatial interaction parameters, and a set of defect level state variables. Step 3: Construct a grading condition adaptive proposal distribution based on the defect level state variable set. Dynamically adjust the proposal distribution parameters during the Markov chain Monte Carlo sampling process to form a set of sampling candidate parameters under grading condition constraints. Step 4: Introduce a grading consistency potential function into the stochastic geometric model. The grading consistency potential function applies spatial consistency constraints to the defect level state variables of adjacent leather surface analysis areas, constructing a target probability distribution containing grading consistency constraints. Step 5: Input the set of sampling candidate parameters into the target probability distribution and perform Markov chain Monte Carlo acceptance judgment to generate parameter update results. Step 6: Generate the defect spatial distribution state corresponding to the leather surface analysis area based on the parameter update results. Step 7: Generate the leather surface defect grading judgment result based on the defect spatial distribution state and the defect level state variable set, and output the overall leather grading result.

2. The method for detecting and grading leather surface defects based on AI vision according to claim 1, characterized in that, The execution area division in step 1 specifically includes: Read the leather surface image data to form a two-dimensional pixel matrix, establish a pixel coordinate system containing horizontal and vertical coordinate axes, set the region width value, region height value, horizontal step value and vertical step value, and generate a set of region starting coordinate pairs along the horizontal and vertical coordinate axes according to the corresponding step value; For each pair of starting coordinates of a region, a sub-matrix corresponding to the region width and region height values ​​is obtained by cropping from the two-dimensional pixel matrix. The sub-matrix is ​​written into the leather surface analysis region set, and the boundary coordinate quadruples corresponding to the sub-matrix are extracted as spatial location identifiers. For each submatrix, perform texture feature parsing operations to generate texture feature vectors, and write the texture feature vectors into the corresponding leather surface analysis area record.

3. The method for detecting and grading leather surface defects based on AI vision according to claim 2, characterized in that, Step 2, constructing the stochastic geometric model, includes the following steps: Read the spatial location identifier corresponding to each leather surface analysis area in the leather surface analysis area set, and generate a defect event location set within the leather surface analysis area based on the spatial location identifier; each defect event in the defect event location set represents the location of a spatial anomaly event participating in random geometric modeling within the leather surface analysis area, and the defect event is recorded in the form of two-dimensional spatial coordinates; Spatial statistical calculations are performed on the set of defect event locations to generate a set of spatial intensity parameters. The set of spatial intensity parameters records the distribution density values ​​of defect events within the analysis area on the leather surface. Distance calculations are performed on any two sets of defect event locations in the set of defect event locations. Based on the distance calculation results, a set of spatial interaction parameters is generated. The set of spatial interaction parameters records the spatial correlation values ​​between defect events and establishes a correspondence with the set of defect level state variables.

4. The method for detecting and grading leather surface defects based on AI vision according to claim 3, characterized in that, Step 3, which involves constructing a graded conditional adaptive proposal distribution based on the set of defect level state variables, specifically includes: Read the value of each defect level state variable in the defect level state variable set, and look up the corresponding proposal scale parameter and proposal direction parameter in the preset level index table according to the defect level state variable value. The proposal scale parameter and proposal direction parameter form a proposal distribution parameter vector. Input the proposal distribution parameter vector into the proposal distribution generation module, perform numerical constraints on the parameter perturbation amplitude according to the proposal scale parameter, and perform vector constraints on the parameter perturbation direction according to the proposal direction parameter to generate a conditional proposal distribution corresponding to the defect level state variable value. During the Markov chain Monte Carlo sampling process, sample candidate parameters are generated from the conditional proposal distribution according to the current defect level state variable value, and the sample candidate parameters are written into the sample candidate parameter set.

5. The method for detecting and grading leather surface defects based on AI vision according to claim 4, characterized in that, Step 3, which involves dynamically adjusting the proposal distribution parameters during the Markov chain Monte Carlo sampling process, includes the following steps: Before the Markov chain Monte Carlo sampling begins, the defect level state variable value corresponding to the current leather surface analysis area is read, and the initial proposal scale parameter and initial proposal direction parameter corresponding to the defect level state variable value are located in the level index table. The initial proposal scale parameter and initial proposal direction parameter are combined to form the initial proposal distribution parameter vector. At the beginning of each sampling iteration, the parameter update result and the corresponding defect level state variable value recorded in the previous sampling iteration are read. The vector norm is calculated on the numerical difference vector between the parameter update result and the current parameter state to generate the parameter change amplitude value. The parameter change amplitude value is input into the proposal scale update mapping table. The scale adjustment coefficient corresponding to the parameter change amplitude value is found in the proposal scale update mapping table, and the current proposal scale parameter is updated to generate the updated proposal scale parameter. The defect level state is read simultaneously. For the proposal direction parameters corresponding to the values ​​of the state variables, a direction consistency calculation is performed on the magnitude of the parameter change and the proposal direction parameters. Based on the direction consistency calculation result, a direction vector rotation or direction vector preservation operation is performed on the proposal direction parameters to generate updated proposal direction parameters. The updated proposal scale parameters and the updated proposal direction parameters are recombined to form an updated proposal distribution parameter vector, and the updated proposal distribution parameter vector is written to the proposal distribution parameter buffer. In the current sampling iteration, the updated proposal distribution parameter vector is read from the proposal distribution parameter buffer, the corresponding conditional proposal distribution is constructed, and sampling candidate parameters are generated from the conditional proposal distribution. After the sampling candidate parameters are generated, the sampling candidate parameters, the magnitude of the parameter change, and the updated proposal distribution parameter vector of the current sampling iteration are written to the sampling process record table to dynamically adjust the proposal distribution parameters for the next sampling iteration.

6. The method for detecting and grading leather surface defects based on AI vision according to claim 5, characterized in that, Step 4 specifically includes: The process involves: reading the spatial location identifiers corresponding to each leather surface analysis region in the set of leather surface analysis regions; performing neighborhood resolution on the spatial location identifiers to generate a set of adjacent leather surface analysis region index pairs; for each index pair in the set of adjacent leather surface analysis region index pairs, reading the corresponding defect level state variable values, calculating the level difference between adjacent defect level state variable values, and generating a level difference sequence; performing a potential function mapping operation on each level difference in the level difference sequence to generate a level consistency potential function value corresponding to the level difference; introducing the level consistency potential function value as a probability penalty factor into the energy term construction process of the stochastic geometric model, applying weight reduction constraints to the state combinations corresponding to the level differences, forming a joint energy expression structure containing level consistency constraint terms; in the joint energy expression structure, assigning a first probability weight to state combinations whose level differences exceed a preset difference threshold, and assigning a second probability weight to state combinations whose level differences do not exceed the preset difference threshold, with the first probability weight being numerically smaller than the second probability weight, thus generating a target probability distribution parameter structure containing spatial consistency constraint relationships; Write the target probability distribution parameter structure into the target probability distribution cache.

7. The method for detecting and grading leather surface defects based on AI vision according to claim 6, characterized in that, Step 5 includes the following steps: Read the target probability distribution parameter structure from the target probability distribution buffer, read the updated proposal distribution parameter vector from the proposal distribution parameter buffer, and read the current sampling candidate parameter from the sampling candidate parameter set; Input the current sampled candidate parameter into the target probability distribution parameter structure, calculate the candidate probability value corresponding to the current sampled candidate parameter, input the current parameter state recorded in the parameter update result into the target probability distribution parameter structure, and calculate the current probability value corresponding to the current parameter state. Calculate the ratio between the candidate probability value and the current probability value to generate a probability ratio value, and perform an upper bound truncation operation on the probability ratio value to generate an acceptance threshold value; Generate a random value between zero and one, perform a numerical comparison operation between the random value and the acceptance threshold value, write the current sampling candidate parameter into the parameter update result if the random value does not exceed the acceptance threshold value, write the current parameter status into the parameter update result if the random value exceeds the acceptance threshold value, and write the acceptance determination result into the sampling process record table.

8. The method for detecting and grading leather surface defects based on AI vision according to claim 7, characterized in that, Step 6 specifically includes: Read the stochastic geometric model parameter state from the parameter update results. The stochastic geometric model parameter state includes the current values ​​of the spatial intensity parameter set and the spatial interaction parameter set. Read the spatial location identifiers corresponding to the target leather surface analysis area from the leather surface analysis area set. Read the subset of defect event locations that fall within the range of the spatial location identifiers from the defect event location set. For each defect event location in the defect event location subset, the current value of the spatial intensity parameter set is used to perform an intensity value calculation operation, generating an intensity value sequence. The intensity value sequence is written into the intensity record sequence in the order of the defect event location index. For any two sets of defect event locations in the defect event location subset, a distance calculation is performed. The distance calculation result is input into the current value of the spatial interaction parameter set to perform an interaction value calculation operation, generating an interaction value set. The interaction value set is written into the interaction record set according to the event location index. The spatial location identifier, the subset of defect event locations, the intensity record sequence, and the set of interaction records are combined and written into the defect spatial distribution state record. The defect spatial distribution state record is written into the state buffer area that corresponds one-to-one with the analysis area of ​​the target leather surface. Each defect spatial distribution state record in the state buffer area serves as the input data for defect grading and determination.

9. A leather surface defect detection and grading system based on AI vision, applied to the leather surface defect detection and grading method based on AI vision as described in any one of claims 1 to 8, characterized in that, Includes the following modules: The image acquisition module is used to acquire image data of the leather surface and generate multi-region leather surface images; The region segmentation module is used to perform region segmentation on image data, generate leather surface analysis regions, and generate spatial location identifiers and texture feature vectors for each region; The stochastic geometry modeling module is used to build a stochastic geometry model for each analysis region, including spatial intensity parameters, spatial interaction parameters, and defect level state variables. The proposal distribution generation module is used to generate an adaptive proposal distribution based on the set of defect level state variables, dynamically adjust the proposal distribution parameters, and generate sampling candidate parameters. The consistency constraint module is used to introduce a level consistency potential function into the stochastic geometric model, apply consistency constraints to the defect level state variables of adjacent regions, and generate a target probability distribution containing consistency constraints. The parameter update module is used to input the sampled candidate parameters into the target probability distribution, perform Markov chain Monte Carlo acceptance decision, and generate parameter update results. The grading and determination module is used to generate the spatial distribution of defects in the leather surface analysis area based on the parameter update results, and to generate the final overall leather grading result.