Sample object loading method and system based on spatial adaptation constraints
Patent Information
- Application Number
- CN202611024437.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-10
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2046-07-10
AI Technical Summary
[0004]本申请的主要目的在于提供一种基于空间适配约束的样本对象加载方法及系统,旨在解决现有技术中难以将缺陷对象稳定加载到仿真目标表面,生成的训练样本偏离真实工况的技术问题
[0018]本申请提供了一种基于空间适配约束的样本对象加载方法,基于目标表面的几何属性信息以及目标缺陷对象的类别对应的约束配置,生成目标缺陷对象与目标表面之间的加载规则; 基于加载规则,在目标表面中筛选出目标缺陷对象的候选加载位置;基于缺陷对象在候选加载位置处的加载姿态与加载尺度,对目标表面进行冲突检测,得到冲突检测结果;基于冲突检测结果与候选加载位置,确定目标加载位置;基于目标加载位置,在目标表面上加载目标缺陷对象,生成原始合成样本。本申请能够明确缺陷对象放置位置与目标表面结构之间的对应关系,将缺陷对象稳定、准确地加载至目标表面,且缺陷对象在图像中的方向和大小更接近真实工况,生成的训练样本能够接近真实工况,保证样本生成的准确性,此外,通过冲突检测,可以使多个缺陷对象在表面空间和成像空间中均保持合理分布,解决了难以将缺陷对象稳定加载到仿真目标表面,生成的训练样本偏离真实工况的技术问题。
Smart Images

Figure CN122574562B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of defect detection technology, which belongs to the new generation of information technology industry in the national strategic emerging industries, and in particular to a sample object loading method and system based on spatial adaptation constraints. Background Technology
[0002] In industrial visual inspection scenarios, the surfaces of packaging, boxes, bottles, and regular industrial parts often exhibit defects such as scratches, patches, dirt, and localized damage. These defects are typically small in size, change shape rapidly, and appear in unpredictable locations, making it difficult to stably load them onto the simulated target surface. If the loading position deviates from the surface geometry, the defect is likely to fall into an unreasonable area; if the loading posture and scale do not match the local imaging relationship of the target, the rendered defect may appear too large, too small, or distorted in orientation; if multiple defects appear simultaneously without effective control, surface overlap or occlusion of the main viewpoint can easily occur. Therefore, even with a sufficient number of training samples, it is difficult to accurately reflect real-world conditions.
[0003] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention
[0004] The main purpose of this application is to provide a sample object loading method and system based on spatial adaptation constraints, which aims to solve the technical problem in the prior art that it is difficult to stably load defective objects onto the surface of the simulation target, and the generated training samples deviate from the real working conditions.
[0005] To achieve the above objectives, this application provides a sample object loading method based on spatial adaptation constraints, the method comprising: Based on the geometric attribute information of the target surface and the constraint configuration corresponding to the category of the target defect object, a loading rule is generated between the target defect object and the target surface, wherein the target surface is the surface of the target simulation three-dimensional model; Based on the loading rules, candidate loading locations for the target defect object are selected on the target surface; Based on the loading posture and loading scale of the target defect object at the candidate loading position, collision detection is performed on the target surface to obtain the collision detection result; Based on the conflict detection results and the candidate loading positions, the target loading position is determined; Based on the target loading location, the target defect object is loaded onto the target surface to generate an original synthetic sample.
[0006] In one embodiment, the step of selecting candidate loading locations for the target defect object on the target surface based on the loading rules includes: Based on the loading rules, allowable loading surface units of the target defect object are selected from the surface units of the target surface. Based on the category of the target defect object, initial candidate loading surface units that meet the preset geometric conditions are selected from the allowable loading surface units of the target defect object; Based on the geometric property information of the target surface, candidate loading surface units that meet the preset observable conditions are selected from the initial candidate loading surface units. A candidate loading center point is determined within the candidate loading surface unit, and a candidate loading position of the target defect object is determined based on the candidate loading surface unit and the candidate loading center point.
[0007] In one embodiment, the collision detection includes surface occupancy collision detection and two-dimensional projection collision detection. The step of performing collision detection on the target surface based on the loading posture and loading scale of the target defect object at the candidate loading position to obtain the collision detection result includes: Based on the loading posture and loading scale of the target defect object at the candidate loading position, the proposed loading surface profile of the target defect object is determined on the target surface; Obtain the surface occupation contour of the target surface, and perform surface occupation conflict detection based on the proposed loading surface contour and the surface occupation contour to obtain the surface occupation conflict detection result. The proposed surface contour is mapped onto the image plane corresponding to the camera's main viewpoint to obtain the projected surface contour. Obtain the outline of the occupied area of the image plane, and perform two-dimensional projection conflict detection based on the projection surface outline and the outline of the occupied area to obtain the projection conflict detection result. Based on the surface occupation conflict detection result and the projection conflict detection result, the conflict detection result is determined.
[0008] In one embodiment, the step of determining the conflict detection result based on the surface occupancy conflict detection result and the projection conflict detection result includes: When the surface occupation conflict detection result is no occupation conflict and the projection conflict detection result is no projection conflict, it is determined that the conflict detection result is no conflict. When the surface occupation conflict detection result is that an occupation conflict exists or the projection conflict detection result is that a projection conflict exists, the conflict detection result is determined to be a conflict.
[0009] In one embodiment, the step of determining the target loading location based on the conflict detection result and the candidate loading location includes: When the conflict detection result indicates that no conflict exists, the candidate loading position is taken as the target loading position; When the conflict detection result indicates the presence of a conflict, the candidate loading position is redefined, and the process returns to the step of performing conflict detection on the target surface based on the loading posture and loading scale of the target defect object at the candidate loading position to obtain the conflict detection result.
[0010] In one embodiment, before the step of performing surface occupation conflict detection and two-dimensional projection conflict detection on the target surface based on the loading posture and loading scale of the target defect object at the candidate loading position, and obtaining the conflict detection result, the method further includes: The reference loading attitude is determined based on the surface normal vector, principal tangential basis vector, and secondary tangential basis vector of the surface unit corresponding to the candidate loading center in the candidate loading position. The target defect object is aligned with the reference loading posture to obtain the loading posture of the target defect object.
[0011] In one embodiment, before the step of performing surface occupation conflict detection and two-dimensional projection conflict detection on the target surface based on the loading posture and loading scale of the target defect object at the candidate loading position, and obtaining the conflict detection result, the method further includes: Based on the principal tangential basis vector and the secondary tangential basis vector, a unit surface length is selected; The candidate loading center point and the surface point obtained by offsetting the candidate loading center point by a unit surface length along the corresponding tangential direction are projected onto the image plane, and the pixel length corresponding to the unit surface length in the image plane is used as the local pixel scale. Based on the preset image scale range and the local pixel scale, the physical scale range of the target defect object on the target surface is determined; Based on the physical scale range, the loading scale of the target defect object is determined.
[0012] In one embodiment, the step of generating the loading rules between the target defect object and the target surface based on the geometric attribute information of the target surface and the constraint configuration corresponding to the category of the target defect object further includes: Based on the target mesh model, the material texture map, and the mapping relationship between the material texture map and the target mesh model, the target simulation 3D model is determined; Based on the target simulation 3D model, determine the patch number, patch adjacency relationship and matching texture region of each surface unit in the target surface; Calculate the local normal vector, principal curvature, and local tangential basis vector of each surface element in the target surface; Obtain the observable attributes of each surface unit in the target surface, and determine the geometric attribute information of the target surface based on the patch number, patch adjacency relationship, matching texture region, local normal vector, principal curvature, local tangential basis vector and observable attributes of each surface unit in the target surface.
[0013] In one embodiment, after the step of loading the target defect object onto the target surface based on the target loading location to generate the original synthetic sample, the method further includes: Based on the original synthetic sample, target detection sample and defect detection sample are constructed respectively; Based on the target detection samples, a target detection model is generated; Based on the defect detection samples, a defect detection model is generated; Based on the target detection model and the defect detection model, defects of the target to be tested are identified.
[0014] Furthermore, to achieve the above objectives, this application also proposes a sample object loading system based on spatial adaptation constraints, which includes: The loading rule establishment module is used to generate loading rules between the target defect object and the target surface based on the geometric attribute information of the target surface and the constraint configuration corresponding to the category of the target defect object. The target surface is the surface of the target simulation three-dimensional model. The loading location determination module is used to filter out candidate loading locations of the target defect object on the target surface based on the loading rules. The collision detection module is used to perform collision detection on the target surface based on the loading posture and loading scale of the target defect object at the candidate loading position, and obtain the collision detection result; The loading position determination module is further configured to determine the target loading position based on the conflict detection result and the candidate loading positions; The sample synthesis module is used to load the target defect object on the target surface based on the target loading location to generate an original synthetic sample.
[0015] Furthermore, to achieve the above objectives, this application also proposes a sample object loading device based on spatial adaptation constraints. The sample object loading device based on spatial adaptation constraints includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. The computer program is configured to implement the steps of the sample object loading method based on spatial adaptation constraints as described above.
[0016] In addition, to achieve the above objectives, the present invention also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the sample object loading method based on spatial adaptation constraints as described above.
[0017] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the sample object loading method based on spatial adaptation constraints as described above.
[0018] This application provides a sample object loading method based on spatial adaptation constraints. Based on the geometric attribute information of the target surface and the constraint configuration corresponding to the category of the target defect object, loading rules between the target defect object and the target surface are generated. Based on the loading rules, candidate loading positions for the target defect object are selected on the target surface. Based on the loading posture and loading scale of the defect object at the candidate loading positions, collision detection is performed on the target surface to obtain collision detection results. Based on the collision detection results and the candidate loading positions, the target loading position is determined. Based on the target loading position, the target defect object is loaded onto the target surface to generate the original synthetic sample. This application can clearly define the correspondence between the placement position of the defect object and the target surface structure, stably and accurately loading the defect object onto the target surface. Furthermore, the orientation and size of the defect object in the image are closer to the real working condition, and the generated training samples are close to the real working condition, ensuring the accuracy of sample generation. In addition, through collision detection, multiple defect objects can maintain a reasonable distribution in both surface space and imaging space, solving the technical problem of difficulty in stably loading defect objects onto the simulated target surface and the resulting training samples deviating from the real working condition. Attached Figure Description
[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0020] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart illustrating an embodiment of the sample object loading method based on spatial adaptation constraints in this application. Figure 2 A schematic diagram of the surface unit for the sample object loading method based on spatial adaptation constraints provided in Embodiment 1 of this application; Figure 3 A schematic diagram illustrating the attitude determination of the sample object loading method based on spatial adaptation constraints provided in Embodiment 1 of this application; Figure 4 A schematic diagram illustrating the defect mapping of the sample object loading method based on spatial adaptation constraints provided in Embodiment 1 of this application; Figure 5 This is a schematic diagram illustrating the occupancy conflict detection of the sample object loading method based on spatial adaptation constraints provided in Embodiment 1 of this application. Figure 6 A schematic diagram illustrating projection conflict detection for the sample object loading method based on spatial adaptation constraints provided in Embodiment 1 of this application; Figure 7 A simplified flowchart illustrating the conflict detection process of the sample object loading method based on spatial adaptation constraints provided in Embodiment 1 of this application; Figure 8 This is a flowchart illustrating Embodiment 2 of the sample object loading method based on spatial adaptation constraints of this application; Figure 9 This is a schematic diagram of the module structure of the sample object loading system based on spatial adaptation constraints according to an embodiment of this application; Figure 10 This is a schematic diagram of the device structure of the hardware operating environment involved in the sample object loading method based on spatial adaptation constraints in the embodiments of this application.
[0022] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0023] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0024] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0025] The main solution of this application embodiment is as follows: Based on the geometric attribute information of the target surface and the constraint configuration corresponding to the category of the target defect object, a loading rule between the target defect object and the target surface is generated; Based on the loading rule, candidate loading positions of the target defect object are selected in the target surface; Based on the loading posture and loading scale of the defect object at the candidate loading position, a conflict detection is performed on the target surface to obtain a conflict detection result; Based on the conflict detection result and the candidate loading positions, the target loading position is determined; Based on the target loading position, the target defect object is loaded on the target surface to generate the original synthetic sample.
[0026] Currently, if the loading position deviates from the surface geometry, defects are prone to falling into unreasonable areas; if the loading posture and scale do not match the local imaging relationship of the target, the rendered defects may be too large, too small, or distorted in direction; if multiple defects occur simultaneously without effective control, surface overlap or occlusion of the main viewpoint can easily occur. As a result, even if the number of training samples obtained is sufficient, it is difficult to closely resemble real-world working conditions.
[0027] This application provides a solution that clearly defines the correspondence between the placement of the defective object and the target surface structure, enabling the defective object to be stably and accurately loaded onto the target surface. The orientation and size of the defective object in the image are closer to the real working condition, and the generated training samples can closely approximate the real working condition, ensuring the accuracy of sample generation. This solves the technical problem of difficulty in stably loading the defective object onto the simulated target surface and the resulting training samples deviating from the real working condition.
[0028] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device capable of performing the above functions, a sample object loading device based on spatial adaptation constraints, etc. This embodiment does not specifically limit it. The following uses a sample object loading device based on spatial adaptation constraints as an example to describe this embodiment and the following embodiments.
[0029] This application provides a sample object loading method based on spatial adaptation constraints, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the sample object loading method based on spatial adaptation constraints of this application.
[0030] In this embodiment, the sample object loading method based on spatial adaptation constraints includes steps S10~S50: Step S10: Based on the geometric attribute information of the target surface and the constraint configuration corresponding to the category of the target defect object, generate the loading rules between the target defect object and the target surface, wherein the target surface is the surface of the target simulation three-dimensional model; It should be noted that the target simulation 3D model is the 3D simulation model of the target object to which defect loading is currently performed, and the target surface is the surface of the target simulation 3D model, i.e., the target surface. The target defect object is the defect that needs to be loaded onto the target surface. The specific number and type are not limited in this embodiment and can be selected from the defect library according to requirements. The defect library stores all existing defects. Each defect object in the defect library is assigned a category identifier, size information, boundary information, and index information. When selecting a target defect object, its category identifier, size information, boundary information, and index information can be obtained simultaneously.
[0031] Additionally, it should be noted that geometric attribute information refers to the geometric description of the target surface. Geometric attribute information can be stored in the form of a data table, which can be considered as a geometric attribute information table. This embodiment does not make any specific limitations on this.
[0032] In one feasible implementation, before step S10, the following steps may be included: determining a target simulation 3D model based on a target mesh model, a material texture map, and the mapping relationship between the material texture map and the target mesh model; determining the patch number, patch adjacency relationship, and matching texture region of each surface unit in the target surface based on the target simulation 3D model; calculating the local normal vector, principal curvature, and local tangential basis vector of each surface unit in the target surface; obtaining the observable attributes of each surface unit in the target surface; and determining the geometric attribute information of the target surface based on the patch number, patch adjacency relationship, matching texture region, local normal vector, principal curvature, local tangential basis vector, and observable attributes of each surface unit in the target surface.
[0033] It should be noted that the target mesh model is the initial mesh model that has not yet been textured. The target simulation 3D model is constructed according to the target mesh model, the material texture map, and the mapping relationship (UV mapping) between the material texture map and the target mesh model to complete the initialization of the 3D scene.
[0034] Understandably, reference Figure 2 The target surface can be considered to be composed of several surface units. In this embodiment, a surface unit index is established using mesh patches as the basic unit, determining the patch number (mesh patch number), patch adjacency relationship (adjacent mesh patches), and matching texture region (matching UV region) corresponding to each surface unit. The local normal vector, principal curvature, and local tangential basis vector are calculated for each surface unit, and the calculation results are associated with the corresponding surface unit.
[0035] It should be understood that the analysis determines whether each surface element meets the preset observability conditions. These preset observability conditions are pre-defined criteria used to determine whether a surface element can be observed. Specifically, they can be set as follows: the surface element is visible in the current or candidate camera pose; it is not occluded by the target itself or other structures; and the angle between its normal and the viewing direction is within the allowable range. Based on these preset observability conditions, the observable attributes of each surface element are determined. If the conditions are met, the observable attribute is observable; otherwise, it is unobservable.
[0036] It is understandable that the surface unit's patch number, patch adjacency relationship, matching texture region, local normal vector, principal curvature, local tangential basis vector, associated surface region label, and observable attributes are used as the geometric attribute information of the target surface.
[0037] It should be noted that after determining the geometric properties of the target surface, loading rules between the target defect object and the target surface can be generated based on the geometric properties of the target surface and the constraint configuration corresponding to the category of the target defect object. At this time, the loading rules can be directly called by the program.
[0038] Understandably, different categories of target defect objects have different constraint configurations. Constraint configurations include surface area constraints, orientation constraints, scale constraints, and coexistence constraints, which are used to limit which target surface areas the target defect object can be loaded onto, in what orientation, at what scale, and how to determine whether coexistence is allowed when multiple defect objects are loaded simultaneously.
[0039] Among these, surface region constraints refer to the screening conditions for determining the surface units on the target surface that allow the loading of the target defect object, excluding edge regions, occluded regions, unobservable regions, or surface regions that do not match the target defect object. Orientation constraints refer to the correspondence that must be satisfied between the local reference direction of the target defect object and the local tangential basis vectors of the target surface. The local reference direction of the target defect object can be determined based on the boundary information, minimum bounding rectangle, or tile coordinate system of the target defect object. For target defect objects with unclear directionality, the default tile coordinate direction can be used as its local reference direction. Scale constraints refer to the correspondence that must be satisfied between the expected pixel scale of the target defect object in the image plane and the physical loading scale on the target surface. Coexistence constraints refer to the restrictions that must be satisfied when multiple defect objects coexist on the same target surface, specifying the areas they occupy on the target surface and the corresponding areas projected onto the image plane.
[0040] For example, for scratch-type defects, their main extension direction can be bound to the main tangential basis vector direction of the target surface; for patch-type defects, their surface coverage can be bound to a local continuous surface region; for contamination-type defects, their loading area can be restricted to a surface region with low curvature that meets the observability conditions.
[0041] In practical implementation, the category of the target defect object can be determined based on the category identifier of the target defect object. Then, the constraint configuration of the target defect object can be determined according to the category of the target defect object, and the corresponding loading rules can be generated.
[0042] Step S20: Based on the loading rules, candidate loading positions of the target defect object are selected on the target surface; It should be noted that the candidate loading position is the initially selected loading position, including the candidate loading surface element and the candidate loading center point. The candidate loading surface element is the surface element that is selected during loading, and the candidate loading center point is the center point that is selected during loading.
[0043] In one feasible implementation, step S20 may include steps S201 to S204: Step S201: Based on the loading rules, select the allowable loading surface units of the target defect object from the surface units of the target surface; It should be noted that, according to the surface region constraints in the loading rules, surface elements that are not allowed to load the target defect object are eliminated, and the resulting surface elements that are allowed to load the target defect object are the allowed loading surface elements.
[0044] Step S202: Based on the category of the target defect object, select initial candidate loading surface units that meet the preset geometric conditions from the allowable loading surface units of the target defect object; It should be noted that the preset geometric conditions refer to the geometric constraints used to determine whether a surface element is suitable for carrying the target defect object. These include curvature constraints, surface area constraints, and local morphological constraints. Curvature constraints are constraints on curvature, i.e., the conditions that curvature must meet, such as: local curvature changes do not exceed the allowable range of the target defect object category, and normal changes remain continuous. Surface area constraints are constraints on the area of the initial candidate loading surface elements, i.e., the conditions that the area of the initial candidate loading surface elements must meet, such as: the available surface area can cover the expected contour of the target defect object. Local morphological constraints mean that the initial candidate loading surface element and its adjacent surface elements should have a local continuous shape capable of carrying the target defect object, such as: the contour of the target defect object to be loaded on does not cross discontinuous boundaries / unloadable regions.
[0045] Understandably, surface elements that do not meet the preset geometric conditions are further filtered out from the allowed loading surface elements. The surface elements selected at this time are the initial candidate loading surface elements, and further filtering is required in the future.
[0046] Step S203: Based on the geometric property information of the target surface, select candidate loading surface units that meet the preset observable conditions from the initial candidate loading surface units. It is understandable that, among the initial candidate loading surface elements that meet the geometric conditions, surface elements that meet the preset observable conditions are further retained as candidate loading surface elements to ensure that the target defect object has a stable imaging basis under the specified observation view.
[0047] Step S204: Determine a candidate loading center point within the candidate loading surface unit, and determine the candidate loading position of the target defect object based on the candidate loading surface unit and the candidate loading center point.
[0048] It is understandable that the candidate loading center point is calculated inside the candidate loading surface element, and the coordinates of the candidate loading center point, the index of the surface element to which it belongs, and the corresponding surface attributes are written into the candidate loading position set.
[0049] Step S30: Based on the loading posture and loading scale of the target defect object at the candidate loading position, perform collision detection on the target surface to obtain the collision detection result; It should be noted that collision detection includes surface occupancy collision detection and two-dimensional projection collision detection. Before performing collision detection, it is necessary to determine the loading posture and loading scale of the target defect object at the candidate loading location so that the target defect object can be mapped onto the target surface according to the loading posture and loading scale.
[0050] In one feasible implementation, steps A11-A12 are included before step S30: Step A11: Determine the reference loading attitude based on the surface normal vector, principal tangential basis vector, and secondary tangential basis vector of the surface unit corresponding to the candidate loading center in the candidate loading position; It should be noted that the local tangential basis vectors are a general term for the tangential basis vectors within the local tangential plane of the target surface. (Refer to...) Figure 3 Principal tangential basis vector (principal tangential) And the secondary tangential basis vector (secondary tangential) These are two independent directional bases within the local tangential plane. The principal tangential base vector represents the main extension direction of the target surface at the candidate loading location, while the secondary tangential base vector, together with the principal tangential base vector, constitutes the two-dimensional unfolding base within the local tangential plane of the target surface. The surface normal vector of the surface element containing the candidate loading center point is obtained. Principal tangential basis vectors and secondary tangential basis vectors And use this set of vectors to construct the loading posture reference of the target defect object, that is, the reference loading posture.
[0051] Step A12: Align the target defect object with the attitude based on the reference loading attitude to obtain the loading attitude of the target defect object.
[0052] It should be understood that attitude alignment is performed based on the correspondence between the local reference direction of the target defect object and the local tangential basis vector of the target surface to obtain the attitude alignment result of the target defect object.
[0053] For example, for a target defect object with a major axis and a minor axis, the major axis direction can be used as the primary reference direction, and the minor axis direction as the secondary reference direction. For target defect objects with unclear directionality, the horizontal and vertical directions in the block coordinate system can be used as the default reference directions. For scratch-type defects, the major axis direction of the target defect object can be aligned with the direction of the principal tangential base vector, and the minor axis direction can be aligned with the direction of the secondary tangential base vector, and the normal or attachment direction of the target defect object can be matched with the normal of the target surface. For patch-type and dirt-type defects, the surface unfolding direction of the target local region around the candidate loading center point is determined by the principal tangential base vector and the secondary tangential base vector, and the boundary range of the target defect object on the target surface is determined based on this target local region. Here, the target local region is a continuous surface neighborhood centered on the candidate loading center point, consisting of the surface unit where it is located and the adjacent surface units.
[0054] It is understandable that the attitude alignment result includes the rotational relationship between the local coordinate system of the target defect object and the local coordinate system of the target surface. Based on the attitude alignment result, a matrix corresponding to the loading attitude of the target defect object can be generated. In specific implementations, the loading attitude can be represented using the matrix corresponding to the loading attitude.
[0055] In one feasible implementation, steps B11 to B14 are included before step S30: Step B11: Select a unit surface length based on the principal tangential basis vector and the secondary tangential basis vector; Understandably, by combining the current camera's extrinsic and intrinsic parameters, the imaging scale of the target's local region in the image plane is calculated, and the preset image scale range is then converted into the physical scale range of the target surface. After loading the target defect object onto the target surface, a corresponding two-dimensional image, i.e., the surface defect image, is generated. The plane in which this surface defect image is located is the image plane. The preset image scale range is a reasonable range of values set according to the pixel scale (pixel length and pixel width) that the target defect object should occupy in the final rendered two-dimensional image plane.
[0056] Step B12: Project the candidate loading center point and the surface point obtained by offsetting the candidate loading center point by a unit surface length along the corresponding tangential direction onto the image plane, and use the pixel length corresponding to the unit surface length in the image plane as the local pixel scale. It should be noted that the tangential direction refers to the direction in which the principal tangential basis vector and the secondary tangential basis vector lie, that is, the direction of the principal tangential basis vector and the direction of the secondary tangential basis vector. A unit surface length is selected in the tangential direction corresponding to the principal tangential basis vector, and another unit surface length is selected in the tangential direction corresponding to the secondary tangential basis vector.
[0057] In the specific implementation, a unit surface length is selected along the main tangential basis vector direction and the secondary tangential basis vector direction, respectively. The candidate loading center point and the surface point after the candidate loading center point is offset by a unit surface length along the corresponding tangential direction are projected onto the image plane. The pixel length corresponding to the unit surface length is calculated to obtain the local pixel scale in the two tangential directions.
[0058] Step B13: Based on the preset image scale range and the local pixel scale, determine the physical scale range of the target defect object on the target surface; Understandably, based on the preset image scale range, its scale range in two tangential directions can be determined. Dividing by the corresponding local pixel scale, the physical scale range (physical size range) of the target defect object on the target surface can be obtained. The physical scale range includes the physical length range and the physical width range.
[0059] Step B14: Determine the loading scale of the target defect object based on the physical scale range.
[0060] It should be understood that the physical scale range of the target defect object on the target surface is the scale conversion result. Based on the scale conversion result, the loading scale of the target defect object in the principal tangential basis vector direction and the secondary tangential basis vector direction can be determined.
[0061] Furthermore, based on the candidate loading center point, the translational position of the target defect object on the target surface can be determined. Combined with the loading posture and loading scale, a loading transformation relationship is formed, which is jointly determined by the translational position, local tangential basis vector, surface normal vector, and loading scale parameters, so that the target defect object can be written onto the target surface according to the determined position, direction, and scale.
[0062] In one feasible implementation, step S30 may include steps S301 to S305: Step S301: Based on the loading posture and loading scale of the target defect object at the candidate loading position, determine the proposed loading surface profile of the target defect object on the target surface; Understandably, reference Figure 4 Based on the loading posture matrix, loading scale, and boundary information of the target defect object, the contour that the target defect object needs to occupy on the target surface during loading is generated on the target surface, i.e., the proposed loading surface contour.
[0063] Step S302: Obtain the surface occupation contour of the target surface, perform surface occupation conflict detection based on the proposed loading surface contour and the surface occupation contour, and obtain the surface occupation conflict detection result. It should be noted that the surface occupation contour refers to the contour already occupied by the defect object on the target surface. The system determines whether the proposed surface contour of the target defect object overlaps with the already loaded surface occupation contour on the target surface. If overlap occurs and the area of the overlapping region exceeds a set area threshold, the surface occupation conflict detection result is considered to be an occupation conflict; otherwise, the surface occupation conflict detection result is considered to be no occupation conflict. For example, refer to... Figure 5 In the figure, U corresponds to the horizontal direction of the texture, V corresponds to the vertical direction, the defect 1 projection and defect 2 projection represent the surface contour that has been loaded on the target surface, and the candidate defect 3 projection represents the surface contour that the target defect object is to be loaded. At this time, there is a large overlap between the defect 2 projection and the candidate defect 3 projection, which can be considered as an occupation conflict.
[0064] Step S303: Map the proposed surface contour to the image plane corresponding to the camera's main viewpoint to obtain the projected surface contour. It is understandable that by mapping the surface profile to be loaded onto the image plane corresponding to the camera's main viewpoint, the projection of the surface profile to be loaded can be obtained, i.e., the projected surface profile.
[0065] Step S304: Obtain the outline of the occupied area of the image plane, and perform two-dimensional projection conflict detection based on the projection surface outline and the outline of the occupied area to obtain the projection conflict detection result. It is understandable that the occupied region contour refers to the contour occupied by the defect object already loaded on the target surface after being projected onto the image plane. The system determines whether there is an overlap between the projected surface contour of the target defect object and the occupied region contour of the image plane. If an overlap occurs and the area of the overlapping region exceeds a set area threshold, the projection conflict detection result is considered to be a projection conflict (abnormal occlusion); otherwise, the projection conflict detection result is considered to be no projection conflict. For example, refer to... Figure 6 In the figure, the projections of defect 1 and defect 2 represent the contours of the occupied areas on the image plane, and the projection of candidate defect 3 represents the projection surface contour of the target defect object on the image plane. At this time, there is a large overlap between the projections of defect 2 and candidate defect 3, and there is also a large overlap between the projections of defect 1 and candidate defect 3. It can be considered that there is a projection conflict.
[0066] Step S305: Determine the conflict detection result based on the surface occupation conflict detection result and the projection conflict detection result.
[0067] In one feasible implementation, step S305 may include: when the surface occupation conflict detection result is no occupation conflict and the projection conflict detection result is no projection conflict, determining that the conflict detection result is no conflict; when the surface occupation conflict detection result is an occupation conflict or the projection conflict detection result is a projection conflict, determining that the conflict detection result is a conflict.
[0068] Understandably, if there is no occupation conflict and no projection conflict, the conflict detection result is determined to be no conflict. If there is an occupation conflict or no projection conflict, the conflict detection result is determined to be a conflict.
[0069] Step S40: Determine the target loading position based on the conflict detection results and the candidate loading positions; In one feasible implementation, step S40 may include: when the conflict detection result is that there is no conflict, taking the candidate loading position as the target loading position; when the conflict detection result is that there is a conflict, redetermining the candidate loading position, returning to the step of performing conflict detection on the target surface based on the loading posture and loading scale of the target defect object at the candidate loading position, and obtaining the conflict detection result.
[0070] Understandably, if the conflict detection result indicates no conflict, then the subsequent loading location is considered suitable for loading the target defective object, and this location is taken as the final loading location, i.e., the target loading location. If the conflict detection result indicates a conflict, then the candidate loading location is redefined.
[0071] In the specific implementation, refer to Figure 7 First, a surface occupation conflict is determined. If no occupation conflict exists, the process passes, and a two-dimensional projection conflict is determined. If no projection conflict exists, the process passes, and loading of the target defect object at the candidate loading location is allowed. If either the surface occupation conflict determination or the two-dimensional projection conflict determination fails, loading of the target defect object at the candidate loading location is rejected, and a new candidate loading location is selected or the loading posture / loading scale is adjusted.
[0072] Step S50: Based on the target loading position, load the target defect object onto the target surface to generate the original synthetic sample.
[0073] Understandably, based on the target loading location, loading posture matrix, and loading scale of the target defect object, the target defect object is written to the corresponding position in the target surface material layer. During the writing process, the index relationship between the target defect object and the surface units of the target surface is preserved, and the defect category and surface position number are recorded simultaneously.
[0074] It should be understood that loading the target defect object onto the target surface generates the original samples, i.e., the original synthetic samples, required for subsequent training of models (object detection model, defect detection model). Using these original synthetic samples, the object detection model and the defect detection model are trained, enabling defect detection. Specifically, the target surface with the loaded defect object is rendered according to preset camera pose and lighting parameters, outputting the surface defect image, target bounding box annotations, and defect bounding box annotations. The image path, target bounding box annotations, defect bounding box annotations, defect category, and surface location index are written to a sample index file to form the original synthetic samples.
[0075] This embodiment provides a sample object loading method based on spatial adaptation constraints. Based on the geometric attribute information of the target surface and the constraint configuration corresponding to the category of the target defect object, loading rules between the target defect object and the target surface are generated. Based on the loading rules, candidate loading positions for the target defect object are selected on the target surface. Based on the loading posture and loading scale of the defect object at the candidate loading positions, collision detection is performed on the target surface to obtain collision detection results. Based on the collision detection results and the candidate loading positions, the target loading position is determined. Based on the target loading position, the target defect object is loaded onto the target surface to generate the original synthetic sample. This embodiment can clearly define the correspondence between the placement position of the defect object and the target surface structure, stably and accurately loading the defect object onto the target surface. Furthermore, the orientation and size of the defect object in the image are closer to the real-world working condition, and the generated training samples can closely approximate the real-world working condition, ensuring the accuracy of sample generation. In addition, through collision detection, multiple defect objects can maintain a reasonable distribution in both the surface space and the imaging space.
[0076] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in Embodiment 1 above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 8 Step S50 may be followed by steps S601 to S604: Step S601: Based on the original synthetic sample, construct the target detection sample and the defect detection sample respectively; It should be noted that object detection samples are the training data used to train the object detection model. Defect detection samples are the training data used to train the defect detection model.
[0077] Understandably, the process involves extracting full-image samples, target bounding box annotations, and sample index files from the original synthetic samples, and generating training and validation set indexes according to target category, scene batch, and set partitioning ratio. The full-image samples and corresponding target bounding box annotations are then used as the target detection samples for the first stage.
[0078] It should be understood that the target ROIs (Regions of Interest) are cropped one by one based on the target bounding box annotations, and a coordinate mapping relationship between the ROIs and the whole image sample is established. Each ROI is checked for defect annotations; ROIs without defect annotations are discarded. The defect bounding box annotations in the whole image sample coordinate system are transformed to the ROI coordinate system. The retained ROIs are normalized by scaling the long side and padding the short side, ensuring that the input size is fixed while the defect geometry remains unchanged. The transformed ROIs and their corresponding defect bounding box annotations are used as the defect detection samples for the second stage. This process can increase the effective pixel ratio of defects in the model input and reduce the interference of irrelevant background on fine-grained defect recognition.
[0079] Step S602: Generate a target detection model based on the target detection samples; Understandably, the object detection model is trained using the object detection samples from the first stage, and the object bounding box is output during inference.
[0080] Step S603: Generate a defect detection model based on the defect detection sample; It should be understood that the defect detection model is trained using the defect detection samples from the second stage, and the defect category, defect location, and confidence level are output during inference.
[0081] Step S604: Based on the target detection model and the defect detection model, identify the defects of the target to be tested.
[0082] It should be noted that the target to be tested is the object that needs to be inspected for defects.
[0083] In practice, the two-stage reasoning is performed in the order of whole-image localization, ROI clipping, ROI normalization, defect identification, and result back-mapping, outputting whole-image level detection results and target level defect results.
[0084] This embodiment provides a sample object loading method based on spatial adaptation constraints. Based on the original synthetic samples, target detection samples and defect detection samples are constructed respectively. A target detection model is generated based on the target detection samples; a defect detection model is generated based on the defect detection samples; and defects of the target object are identified based on the target detection model and the defect detection model. The constrained surface loading results are directly converted into training samples for the target detection and defect detection stages, forming a continuous link between sample construction, model training, and inference processing. Furthermore, the ROI normalization method using long-side scaling and short-side padding preserves the original geometric relationships of the defects and reduces the destruction of defect morphology during size normalization.
[0085] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the sample object loading method based on spatial adaptation constraints in this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0086] This application also provides a sample object loading system based on spatial adaptation constraints, please refer to... Figure 9 The sample object loading system based on spatial adaptation constraints includes: The loading rule establishment module 10 is used to generate loading rules between the target defect object and the target surface based on the geometric attribute information of the target surface and the constraint configuration corresponding to the category of the target defect object. The target surface is the surface of the target simulation three-dimensional model. The loading position determination module 20 is used to filter out candidate loading positions of the target defect object on the target surface based on the loading rules. The collision detection module 30 is used to perform collision detection on the target surface based on the loading posture and loading scale of the target defect object at the candidate loading position, and obtain the collision detection result. The loading position determination module 20 is further configured to determine the target loading position based on the conflict detection result and the candidate loading positions; The sample synthesis module 40 is used to load the target defect object on the target surface based on the target loading position to generate an original synthetic sample.
[0087] In one feasible implementation, the loading position determination module 20 is further configured to, based on the loading rules, select the permissible loading surface units of the target defect object from the surface units of the target surface; Based on the category of the target defect object, initial candidate loading surface units that meet the preset geometric conditions are selected from the allowable loading surface units of the target defect object; Based on the geometric property information of the target surface, candidate loading surface units that meet the preset observable conditions are selected from the initial candidate loading surface units. A candidate loading center point is determined within the candidate loading surface unit, and a candidate loading position of the target defect object is determined based on the candidate loading surface unit and the candidate loading center point.
[0088] In one feasible implementation, the conflict detection module 30 is further configured to determine the proposed loading surface profile of the target defect object on the target surface based on the loading posture and loading scale of the target defect object at the candidate loading position. Obtain the surface occupation contour of the target surface, and perform surface occupation conflict detection based on the proposed loading surface contour and the surface occupation contour to obtain the surface occupation conflict detection result. The proposed surface contour is mapped onto the image plane corresponding to the camera's main viewpoint to obtain the projected surface contour. Obtain the outline of the occupied area of the image plane, and perform two-dimensional projection conflict detection based on the projection surface outline and the outline of the occupied area to obtain the projection conflict detection result. Based on the surface occupation conflict detection result and the projection conflict detection result, the conflict detection result is determined.
[0089] In one feasible implementation, the conflict detection module 30 is further configured to determine that the conflict detection result is that there is no conflict when the surface occupation conflict detection result is that there is no occupation conflict and the projection conflict detection result is that there is no projection conflict. When the surface occupation conflict detection result is that an occupation conflict exists or the projection conflict detection result is that a projection conflict exists, the conflict detection result is determined to be a conflict.
[0090] In one feasible implementation, the loading position determination module 20 is further configured to use the candidate loading position as the target loading position when the conflict detection result is that there is no conflict; When the conflict detection result indicates the presence of a conflict, the candidate loading position is redefined, and the process returns to the step of performing conflict detection on the target surface based on the loading posture and loading scale of the target defect object at the candidate loading position to obtain the conflict detection result.
[0091] In one feasible implementation, the conflict detection module 30 is further configured to determine the reference loading posture based on the surface normal vector, principal tangential basis vector and secondary tangential basis vector of the surface unit corresponding to the candidate loading center in the candidate loading position; The target defect object is aligned with the reference loading posture to obtain the loading posture of the target defect object.
[0092] In one feasible implementation, the collision detection module 30 is further configured to select a unit surface length based on the principal tangential basis vector and the secondary tangential basis vector; The candidate loading center point and the surface point obtained by offsetting the candidate loading center point by a unit surface length along the corresponding tangential direction are projected onto the image plane, and the pixel length corresponding to the unit surface length in the image plane is used as the local pixel scale. Based on the preset image scale range and the local pixel scale, the physical scale range of the target defect object on the target surface is determined; Based on the physical scale range, the loading scale of the target defect object is determined.
[0093] In one feasible implementation, the loading rule establishment module 10 is further used to determine the target simulation 3D model based on the target mesh model, the material texture map, and the mapping relationship between the material texture map and the target mesh model; Based on the target simulation 3D model, determine the patch number, patch adjacency relationship and matching texture region of each surface unit in the target surface; Calculate the local normal vector, principal curvature, and local tangential basis vector of each surface element in the target surface; Obtain the observable attributes of each surface unit in the target surface, and determine the geometric attribute information of the target surface based on the patch number, patch adjacency relationship, matching texture region, local normal vector, principal curvature, local tangential basis vector and observable attributes of each surface unit in the target surface.
[0094] In one feasible implementation, the sample synthesis module 40 is further configured to construct a target detection sample and a defect detection sample based on the original synthesized sample. Based on the target detection samples, a target detection model is generated; Based on the defect detection samples, a defect detection model is generated; Based on the target detection model and the defect detection model, defects of the target to be tested are identified.
[0095] The sample object loading system based on spatial adaptation constraints provided in this application, employing the sample object loading method based on spatial adaptation constraints in the above embodiments, can solve the technical problem of difficulty in stably loading defective objects onto the simulation target surface, resulting in training samples deviating from real working conditions. Compared with the prior art, the beneficial effects of the sample object loading system based on spatial adaptation constraints provided in this application are the same as those of the sample object loading method based on spatial adaptation constraints provided in the above embodiments, and other technical features of the sample object loading system based on spatial adaptation constraints are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0096] This application provides a sample object loading device based on spatial adaptation constraints. The sample object loading device based on spatial adaptation constraints includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the sample object loading method based on spatial adaptation constraints in the above embodiment 1.
[0097] The following is for reference. Figure 10 This document illustrates a schematic diagram of a sample object loading device based on spatial adaptation constraints, suitable for implementing embodiments of this application. The sample object loading device based on spatial adaptation constraints in these embodiments may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 10 The sample object loading device based on spatial adaptation constraints shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0098] like Figure 10 As shown, the sample object loading device based on spatial adaptation constraints may include a processing system 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in ROM (Read Only Memory) 1002 or a program loaded from storage system 1003 into RAM (Random Access Memory) 1004. RAM 1004 also stores various programs and data required for the operation of the sample object loading device based on spatial adaptation constraints. The processing system 1001, ROM 1002, and RAM 1004 are interconnected via bus 1005. Input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to I / O interface 1006: input systems 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output systems 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage systems 1003 including, for example, magnetic tapes, hard disks, etc.; and communication systems 1009. Communication system 1009 allows the spatially adapted sample object loading device to communicate wirelessly or wiredly with other devices to exchange data. Although a spatially adapted sample object loading device with various systems is shown in the figure, it should be understood that it is not required to implement or possess all the systems shown. More or fewer systems may be implemented alternatively.
[0099] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication system, or installed from storage system 1003, or installed from ROM 1002. When the computer program is executed by processing system 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0100] The sample object loading device based on spatial adaptation constraints provided in this application, employing the sample object loading method based on spatial adaptation constraints in the above embodiments, can solve the technical problem of difficulty in stably loading defective objects onto the simulation target surface, resulting in training samples deviating from real working conditions. Compared with the prior art, the beneficial effects of the sample object loading device based on spatial adaptation constraints provided in this application are the same as those of the sample object loading method based on spatial adaptation constraints provided in the above embodiments, and other technical features in this sample object loading device based on spatial adaptation constraints are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0101] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0102] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0103] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the sample object loading method based on spatial adaptation constraints in the above embodiments.
[0104] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0105] The aforementioned computer-readable storage medium may be included in a sample object loading device based on spatial adaptation constraints; or it may exist independently and not assembled into a sample object loading device based on spatial adaptation constraints.
[0106] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by a spatially adaptive constraint-based sample object loading device, the spatially adaptive constraint-based sample object loading device: generates loading rules between the target defect object and the target surface based on the geometric attribute information of the target surface and the constraint configuration corresponding to the category of the target defect object; based on the loading rules, selects candidate loading positions for the target defect object on the target surface; performs collision detection on the target surface based on the loading posture and loading scale of the defect object at the candidate loading positions, and obtains collision detection results; determines the target loading position based on the collision detection results and the candidate loading positions; and loads the target defect object on the target surface based on the target loading position, generating an original synthetic sample.
[0107] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0108] 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. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing 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 the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, 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.
[0109] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0110] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described sample object loading method based on spatial adaptation constraints. This solves the technical problem of difficulty in stably loading defective objects onto the simulation target surface, resulting in training samples deviating from real-world conditions. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the sample object loading method based on spatial adaptation constraints provided in the above embodiments, and will not be repeated here.
[0111] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the sample object loading method based on spatial adaptation constraints as described above.
[0112] The computer program product provided in this application can solve the technical problem of difficulty in stably loading defective objects onto the surface of simulated targets, resulting in training samples deviating from real working conditions. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the sample object loading method based on spatial adaptation constraints provided in the above embodiments, and will not be repeated here.
[0113] The above are only some embodiments of this application and do not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A sample object loading method based on spatial adaptation constraints, characterized in that, The method includes: Based on the geometric attribute information of the target surface and the constraint configuration corresponding to the category of the target defect object, a loading rule is generated between the target defect object and the target surface, wherein the target surface is the surface of the target simulation three-dimensional model; Based on the loading rules, candidate loading locations for the target defect object are selected on the target surface; Based on the loading posture and loading scale of the target defect object at the candidate loading position, conflict detection is performed on the target surface to obtain a conflict detection result. This includes: determining the proposed loading surface contour of the target defect object on the target surface based on the loading posture and loading scale of the target defect object at the candidate loading position; obtaining the surface occupancy contour of the target surface; performing surface occupancy conflict detection based on the proposed loading surface contour and the surface occupancy contour to obtain a surface occupancy conflict detection result; mapping the proposed loading surface contour to the image plane corresponding to the camera's main viewpoint to obtain a projected surface contour; obtaining the occupied area contour of the image plane; performing two-dimensional projection conflict detection based on the projected surface contour and the occupied area contour to obtain a projection conflict detection result; determining that the conflict detection result is "no conflict" when the surface occupancy conflict detection result is "no occupancy conflict" and the projection conflict detection result is "no projection conflict"; and determining that the conflict detection result is "conflict" when the surface occupancy conflict detection result is "occupancy conflict" or the projection conflict detection result is "projection conflict". Based on the conflict detection results and the candidate loading positions, the target loading position is determined; Based on the target loading location, the target defect object is loaded onto the target surface to generate an original synthetic sample.
2. The method as described in claim 1, characterized in that, The step of selecting candidate loading locations for the target defect object on the target surface based on the loading rules includes: Based on the loading rules, allowable loading surface units of the target defect object are selected from the surface units of the target surface. Based on the category of the target defect object, initial candidate loading surface units that meet the preset geometric conditions are selected from the allowable loading surface units of the target defect object; Based on the geometric property information of the target surface, candidate loading surface units that meet the preset observable conditions are selected from the initial candidate loading surface units. A candidate loading center point is determined within the candidate loading surface unit, and a candidate loading position of the target defect object is determined based on the candidate loading surface unit and the candidate loading center point.
3. The method as described in claim 1, characterized in that, The step of determining the target loading location based on the conflict detection result and the candidate loading locations includes: When the conflict detection result indicates that no conflict exists, the candidate loading position is taken as the target loading position; When the conflict detection result indicates the presence of a conflict, the candidate loading position is redefined, and the process returns to the step of performing conflict detection on the target surface based on the loading posture and loading scale of the target defect object at the candidate loading position to obtain the conflict detection result.
4. The method as described in claim 1, characterized in that, Before the step of performing collision detection on the target surface based on the loading posture and loading scale of the target defect object at the candidate loading position, and obtaining the collision detection result, the method further includes: The reference loading attitude is determined based on the surface normal vector, principal tangential basis vector, and secondary tangential basis vector of the surface unit corresponding to the candidate loading center point in the candidate loading position. The target defect object is aligned with the reference loading posture to obtain the loading posture of the target defect object.
5. The method as described in claim 4, characterized in that, Before the step of performing collision detection on the target surface based on the loading posture and loading scale of the target defect object at the candidate loading position, and obtaining the collision detection result, the method further includes: Based on the principal tangential basis vector and the secondary tangential basis vector, a unit surface length is selected; The candidate loading center point and the surface point obtained by offsetting the candidate loading center point by a unit surface length along the corresponding tangential direction are projected onto the image plane, and the pixel length corresponding to the unit surface length in the image plane is used as the local pixel scale. Based on the preset image scale range and the local pixel scale, the physical scale range of the target defect object on the target surface is determined; Based on the physical scale range, the loading scale of the target defect object is determined.
6. The method as described in claim 1, characterized in that, Before the step of generating the loading rules between the target defect object and the target surface based on the geometric attribute information of the target surface and the constraint configuration corresponding to the category of the target defect object, the method further includes: Based on the target mesh model, the material texture map, and the mapping relationship between the material texture map and the target mesh model, the target simulation 3D model is determined; Based on the target simulation 3D model, determine the patch number, patch adjacency relationship and matching texture region of each surface unit in the target surface; Calculate the local normal vector, principal curvature, and local tangential basis vector of each surface element in the target surface; Obtain the observable attributes of each surface unit in the target surface, and determine the geometric attribute information of the target surface based on the patch number, patch adjacency relationship, matching texture region, local normal vector, principal curvature, local tangential basis vector and observable attributes of each surface unit in the target surface.
7. The method as described in claim 1, characterized in that, After the step of loading the target defect object onto the target surface based on the target loading location to generate the original synthetic sample, the method further includes: Based on the original synthetic sample, target detection sample and defect detection sample are constructed respectively; Based on the target detection samples, a target detection model is generated; Based on the defect detection samples, a defect detection model is generated; Based on the target detection model and the defect detection model, defects of the target to be tested are identified.
8. A sample object loading system based on spatial adaptation constraints, characterized in that, The system includes: The loading rule establishment module is used to generate loading rules between the target defect object and the target surface based on the geometric attribute information of the target surface and the constraint configuration corresponding to the category of the target defect object. The target surface is the surface of the target simulation three-dimensional model. The loading location determination module is used to filter out candidate loading locations of the target defect object on the target surface based on the loading rules. The collision detection module is used to perform collision detection on the target surface based on the loading posture and loading scale of the target defect object at the candidate loading position, and obtain the collision detection result; The loading position determination module is further configured to determine the target loading position based on the conflict detection result and the candidate loading positions; The sample synthesis module is used to load the target defect object onto the target surface based on the target loading location, and generate an original synthetic sample. The conflict detection module is also used to determine the proposed loading surface profile of the target defect object on the target surface based on the loading posture and loading scale of the target defect object at the candidate loading position. Obtain the surface occupation contour of the target surface, and perform surface occupation conflict detection based on the proposed loading surface contour and the surface occupation contour to obtain the surface occupation conflict detection result. The proposed surface contour is mapped onto the image plane corresponding to the camera's main viewpoint to obtain the projected surface contour. Obtain the outline of the occupied area of the image plane, and perform two-dimensional projection conflict detection based on the projection surface outline and the outline of the occupied area to obtain the projection conflict detection result. When the surface occupation conflict detection result is no occupation conflict and the projection conflict detection result is no projection conflict, the conflict detection result is determined to be no conflict. When the surface occupation conflict detection result is an occupation conflict or the projection conflict detection result is a projection conflict, the conflict detection result is determined to be a conflict.
Citation Information
Patent Citations
3D digital city target VR space cutting body conflict detection method
CN120107501A
Defect image synthesis method, electronic equipment and computer readable storage medium
CN121095058A