OCC semantic segmentation annotation method based on diversified matting mode

CN122199983BActive Publication Date: 2026-08-11SUZHOU KUSHUJU INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-05-14
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

人工绘制非重叠多边形难以适配OCC图像中复杂对象的内外结构勾勒需求,镂空处理时无法自动识别多边形之间的重叠区域,布尔差集运算需要人工手动操作执行,基准多边形与叠加多边形的重叠区域剔除精度依赖人工操作水平,标注过程中易产生多余图形区域,无法直接生成规整的单一复合图形,语义类别标签的关联需要针对多个零散图形分别操作

Benefits of technology

响应绘图操作生成的多个基础多边形要素可直接勾勒待标注对象的边界或内部结构,至少两个基础多边形要素可自然形成空间重叠关系,多边形要素的绘制无需提前规避空间重叠问题,贴合OCC图像中复杂目标对象的结构勾勒形式,重叠状态的多边形要素可完整覆盖目标对象的内外轮廓形态,轮廓勾勒过程中无需反复调整多边形的绘制位置与范围,多边形要素的生成逻辑简化了复杂对象轮廓的勾勒流程,重叠区域的形成无需额外的人工规划操作。采用双流程并行处理重叠多边形要素,可在执行基准多边形与叠加多边形布尔差集运算生成主目标图形的同时,完整提取叠加多边形自身几何轮廓形成独立镂空轮廓图形,保留叠加图形原始形态不被运算破坏。镂空留窗指令同步完成主体区域抠合与镂空轮廓提取,无需分步骤执行图形编辑与轮廓重绘操作,维持标注过程的连续性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122199983B_ABST
    Figure CN122199983B_ABST
Patent Text Reader

Abstract

This invention relates to the field of image semantic segmentation and annotation technology, specifically to an OCC semantic segmentation and annotation method based on diverse matting modes. The method includes: receiving an original OCC image containing the object to be annotated; generating multiple basic polygonal elements that outline the object's boundary and internal structure in response to user drawing operations on the interface; at least two of these elements having spatial overlap. The interface provides two types of matting mode selection options: a matting mode option for executing cutout commands and a matting mode option for executing cutout shape-retaining commands. When a cutout mode is selected, the overlapping areas of the polygons are automatically identified and Boolean difference operations are performed to remove the overlapping areas of the base polygon and the superimposed polygons, generating a single cutout composite graphic that retains only the target entity area. This graphic is then associated with a corresponding semantic category label. This method simplifies the process of outlining complex object contours, eliminates the need for manual removal of overlapping areas, results in a more regular shape for the annotated graphic, and makes the label association operation more seamless.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image semantic segmentation and annotation technology, and in particular to an OCC semantic segmentation and annotation method based on diverse matting modes. Background Technology

[0002] In the semantic segmentation and annotation process of OCC images, conventional annotation methods often use independent polygon drawing to outline the objects to be annotated. During polygon drawing, spatial separation is maintained, and the cutout operation only offers a single graphic splicing mode. There are no differentiated cutout operation modes available, and the removal of graphic regions relies entirely on manual division. Manually drawing non-overlapping polygons is difficult to adapt to the requirements of outlining the internal and external structures of complex objects in OCC images. The cutout process cannot automatically identify overlapping areas between polygons, Boolean difference operations require manual execution, and the accuracy of removing overlapping areas between the baseline polygon and the superimposed polygon depends on the skill of the operator. The annotation process easily generates redundant graphic areas, making it impossible to directly generate regular single composite graphics. The association of semantic category labels requires separate operations for multiple scattered graphics.

[0003] During the OCC semantic segmentation annotation process, it is impossible to directly generate multiple basic polygonal features with spatial overlap through drawing operations. The graphical user interface does not have interfaces for selecting two types of cutout modes: cutout and cutout with window. It cannot automatically identify the overlapping areas of polygons and perform Boolean difference operations after selecting the cutout mode. It is impossible to remove the overlapping graphic areas of superimposed polygons from the base polygons. It is difficult to generate a single cutout composite graphic that only contains the target entity area. It is also impossible to directly perform semantic category label association operations on this regular graphic. Summary of the Invention

[0004] The purpose of this invention is to address the shortcomings of existing technologies by proposing an OCC semantic segmentation and annotation method based on diverse image matting modes.

[0005] To achieve the above objectives, the present invention adopts the following technical solution: an OCC semantic segmentation and annotation method based on diverse image matting modes, comprising: Receive the original OCC image containing at least one object to be labeled; In the graphical user interface, in response to the user's drawing operation, multiple basic polygonal features are generated. These basic polygonal features are used to outline the boundary or internal structure of the object to be labeled, wherein at least two basic polygonal features have a spatial overlap relationship. The graphical user interface provides a cutout mode selection interface, which includes cutout mode options for executing cutout commands and cutout window mode options for executing cutout shape retention commands. When the cutout mode selection interface receives a selection instruction for the cutout mode option, it executes the cutout instruction on the basic polygonal elements that have spatial overlap. The cutout instruction automatically identifies the overlapping area and performs Boolean difference operations to remove the graphic area that overlaps with the superimposed polygon from the base polygon, including: Identify the base polygon features that serve as the reference polygon and the base polygon features that serve as the superimposed polygon; The hollowing-out shape retention instruction is executed. The hollowing-out shape retention instruction performs two processing flows in parallel. The first processing flow executes the Boolean difference operation to subtract the area overlapping with the superimposed polygon from the base polygon to generate the main target graphic. The second processing step extracts the complete geometric contour of the superimposed polygon itself and generates one or more independent hollow contour graphics; The main target graphic is associated with one or more independent hollow outline graphics to form a set of output graphics. Generate a single hollow composite graphic, wherein the single hollow composite graphic is the final geometric graphic after performing the Boolean difference operation, and contains only the target entity region; Associate a semantic category label with the individual hollowed-out composite graphic.

[0006] As a further aspect of the present invention, the step of executing the cutout command on the basic polygonal elements that have spatial overlapping relationships, wherein the cutout command automatically identifies overlapping areas and performs Boolean difference operations, includes: Calculate the geometric boundaries of the basic polygonal elements that form the basis of the superimposed polygons; The intersection of the base polygon features, which serve as the reference polygon, and the geometric boundaries of the superimposed polygon is calculated to obtain the overlapping region polygon. Subtract the area covered by the overlapping polygon from the complete geometric region of the base polygon; Perform geometric cleanup on self-intersecting loops or isolated vertices generated after the subtraction operation to ensure that the final generated graphic is a valid single-part polygon; The polygons after geometric cleanup are stored as the single hollowed-out composite graphic.

[0007] As a further aspect of the present invention, the calculation of the intersection of the basic polygonal elements serving as the reference polygon and the geometric boundaries of the superimposed polygon to obtain the overlapping region polygon includes: Obtain the coordinates of all vertices of the base polygon element that serves as the reference polygon, and construct a list of closed edges of the reference polygon; Obtain the coordinates of all vertices of the base polygon element that forms the superimposed polygon, and construct a list of closed edges of the superimposed polygon. Perform line segment intersection detection on each edge of the base polygon and each edge of the superimposed polygon, and calculate the coordinates of all intersection points; Collect all intersection points on the boundary between the base polygon and the superimposed polygon, and record the order of intersection points on each edge; From the collected intersection points, select the set of points that are simultaneously located inside the base polygon and the superimposed polygon; Connect the selected set of points and generate one or more closed geometric shapes according to the connection rules of polygon vertices; Merge one or more closed geometries into an overlapping region polygon.

[0008] As a further aspect of the present invention, generating the one or more independent hollow outline patterns includes: Inspect the geometry of the superimposed polygon itself; If the superimposed polygon is a single simple polygon, then the vertex coordinate sequence of the polygon is directly copied and used as an independent hollow outline graphic. If the superimposed polygon itself is a composite graphic, it is composed of multiple sub-polygons. In this case, the vertex coordinate sequence of each sub-polygon is copied, and each sub-polygon is treated as an independent hollow outline graphic. Record the source information for each individual hollow outline graphic, whereby the source information points to its corresponding original superimposed polygon.

[0009] As a further aspect of the present invention, the method further includes the step of data encoding the single hollow composite graphic or the output graphic set: Read the vertex coordinate sequence of the single hollow composite graphic, or read the vertex coordinate sequence of the main target graphic and each independent hollow outline graphic in the output graphic set respectively; Arrange the vertex coordinate sequence in a preset order; A corresponding graphic identifier is attached to the vertex coordinate sequence. The graphic identifier is used to distinguish different independent graphics and the hierarchical relationship between graphics. The vertex coordinate sequence with attached graphic identifier, the associated semantic category label, and the graphic type code are packaged together to form an intermediate annotation data block.

[0010] As a further aspect of the present invention, the method further includes a graphic overlay relationship verification step: After generating multiple basic polygon features in response to the user's drawing operation, the positional relationship between any two basic polygon features is detected. When two basic polygon features are detected to have a relationship of inclusion, being included, or intersecting, the detected pair of basic polygon features is marked as a pair of graphics to be processed. In the image cutout mode selection interface, the operation controls related to the image pair to be processed are highlighted; When the image matting mode selection interface receives a mode selection instruction, it executes the corresponding image matting instruction only on the marked image pairs to be processed.

[0011] As a further aspect of the present invention, the method further includes a step of deriving annotation results: Extract the geometric and semantic information of all graphics from the intermediate labeled data block; According to the specified OCC semantic segmentation data format specification, the geometric information and semantic information are converted into a standardized data structure; In the standardized data structure, the same instance identifier is assigned to the main target graphic and the independent hollow outline graphic that belong to the same physical object but are separated by the hollowing shape retention instruction. The standardized data structure is written to a disk file, and the disk file is in the format of the General Label Exchange Format.

[0012] As a further aspect of the present invention, the method also includes a visual preview and editing step: Before exporting the annotation results, the intermediate annotation data block is loaded and rendered in the graphical user interface; The individual hollow composite graphic can be drawn using different visual styles, or the main target graphic and each independent hollow outline graphic in the output graphic set can be drawn separately. In response to the user's dragging operation on the vertices of the rendered graphics, the vertex coordinate sequence in the intermediate annotation data block is dynamically updated; In response to a user's modification of the semantic labels of a rendered graphic, update the associated semantic category labels in the intermediate labeled data block; After each update, the data encoding steps for the single hollow composite graphic or the set of output graphics are re-executed to generate updated intermediate annotation data blocks.

[0013] As a further aspect of the present invention, the step of dynamically updating the vertex coordinate sequence in the intermediate annotation data block in response to a user's dragging operation on the vertex of the rendered graphics includes: Capture drag events of users on specific vertexes of a rendered graphic in the graphical user interface and obtain the new screen coordinates after dragging; The new screen coordinates are converted into corresponding image coordinate system coordinates using a view transformation matrix; In the intermediate labeled data block, find and replace the original coordinate values ​​of the vertices; After replacing the coordinate values, a graph validity verification is triggered to check whether the order of the graph vertex sequence remains consistent, either clockwise or counterclockwise. If the order of the vertex sequence in the graphic becomes disordered due to vertex movement, the vertex coordinate sequence is automatically reordered to restore the preset vertex wrapping direction.

[0014] Compared with the prior art, the advantages and positive effects of the present invention are as follows: Multiple basic polygonal elements generated in response to drawing operations can directly outline the boundaries or internal structure of the object to be labeled. At least two basic polygonal elements can naturally form a spatial overlap relationship. The drawing of polygonal elements does not need to avoid spatial overlap problems in advance, which fits the structural outline form of complex target objects in OCC images. The overlapping polygonal elements can completely cover the inner and outer contours of the target object. There is no need to repeatedly adjust the drawing position and range of the polygons during the outline drawing process. The generation logic of polygonal elements simplifies the outline drawing process of complex objects. The formation of overlapping areas does not require additional manual planning operations. The dual-process parallel processing of overlapping polygonal elements can completely extract the geometric contour of the superimposed polygons to form an independent hollow contour graphic while performing Boolean difference operations on the base polygon and superimposed polygon to generate the main target graphic, preserving the original shape of the superimposed graphic without being destroyed by the operation. The hollow window instruction simultaneously completes the main area cladding and hollow contour extraction, without the need to perform graphic editing and contour redrawing operations step by step, maintaining the continuity of the annotation process.

[0015] The graphical user interface provides options for cutout mode selection, offering both cutout and cutout window options. Upon receiving a cutout mode selection command, it automatically identifies overlapping areas of basic polygonal elements with spatial overlap, directly performs Boolean difference operations on these overlapping areas, and removes the overlapping regions from the base polygons. This automatic calculation replaces manual graphic editing, eliminating the need for manual intervention in overlapping area identification and removal. The resulting single cutout composite graphic retains only the target entity area, maintaining a regular and uniform graphic shape. Semantic category label association can be directly performed on this single graphic, eliminating the need to split multiple graphics for separate processing. The graphic annotation and label association workflow remains seamless. A corresponding association is established between the main target graphic and the independent cutout contour graphics, integrating them into an output graphic set. This ensures that the separated graphics remain spatially independent but belong to the same annotation object at the data level. The associated graphic set completely preserves all geometric information of the target object's main structure and cutout parts, preventing the loss of cutout area information. The annotation results simultaneously carry complete data for both the main outline and the cutout contour, adapting to complex OCC image multi-morphological structure annotation scenarios. Attached Figure Description

[0016] Figure 1This is a state diagram of the OCC semantic segmentation and annotation method based on diverse image matting modes described in this invention. Figure 2 A flowchart for executing the cutout command and Boolean difference operation; Figure 3 A flowchart for executing the cutout and shape retention instruction. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0018] In the description of this invention, it should be understood that the terms "length," "width," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships, are based on the orientation or positional relationships shown in the accompanying drawings and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, in the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0019] See Figure 1 This invention provides an OCC semantic segmentation and annotation method based on diverse image matting modes, and its overall implementation scheme is as follows: The system receives an original OCC image containing at least one object to be labeled. In the graphical user interface (GUI), in response to user drawing operations, multiple basic polygonal features are generated to outline the boundaries or internal structure of the object to be labeled, where at least two of the basic polygonal features have a spatial overlap. The GUI provides a cutout mode selection interface, which includes cutout mode options for executing cutout commands and cutout window-retention mode options for executing cutout shape-retention commands. When the cutout mode selection interface receives a selection command for a cutout mode option, a cutout command is executed on the basic polygonal features with spatial overlap. This cutout command automatically identifies overlapping areas and performs a Boolean difference operation, removing the graphic area overlapping with another basic polygonal feature defined as a superimposed polygon from the basic polygonal features defined as base polygons. The operation generates a single cutout composite graphic, which is the final geometry after the Boolean difference operation and contains only the target entity region. Finally, a corresponding semantic category label is associated with this single cutout composite graphic.

[0020] In one embodiment of the present invention, see [reference] Figure 2The process involves calculating the geometric boundaries of the base polygon elements that form the superimposed polygon. The intersection of the base polygon elements (the reference polygon) with the geometric boundaries of the superimposed polygon is then calculated to obtain the overlapping region polygon. This process includes obtaining the coordinates of all vertices of the base polygon elements (the reference polygon) to construct a list of closed edges, and simultaneously obtaining the coordinates of all vertices of the base polygon elements (the superimposed polygon) to construct a list of closed edges. Line segment intersection detection is performed on each edge of the reference polygon and each edge of the superimposed polygon, and the coordinates of all intersection points are calculated. All intersection points on both boundaries are collected, and the order of intersection points on each edge is recorded. From the collected intersection points, a set of points that are simultaneously located inside both the reference polygon and the superimposed polygon is selected. This selected set of points is connected, and one or more closed geometric shapes are generated according to the polygon vertex connection rules. The generated one or more closed geometric shapes are merged into the final overlapping region polygon. The area covered by the overlapping region polygon is subtracted from the complete geometric area of ​​the reference polygon. Geometric cleanup is performed on any self-intersecting loops or isolated vertices that may result from the subtraction operation to ensure that the final generated graphic is a valid single-part polygon. The geometrically cleaned polygon is stored as a single hollowed-out composite graphic.

[0021] In specific implementation, the detailed process of executing the cutout command on basic polygonal elements with spatial overlap is as follows: In an example scenario, the original OCC image contains a mechanical part to be labeled. In the graphical user interface, the user draws a rectangle representing the outer contour of the part as the base polygon, and draws a circle representing an internal hole inside the rectangle as the overlay polygon. The rectangle and the circle have a spatial overlap relationship. In specific implementation, the geometric boundary of the circular base polygon element as the overlay polygon is calculated. This boundary is represented by a list of closed edges defined by the discrete vertex sequence constituting the circle. The intersection of the geometric boundary of the rectangular base polygon element as the base polygon and the circular overlay polygon is calculated to obtain the overlapping region polygon. This process includes obtaining all vertex coordinates of the rectangular base polygon element as the base polygon and constructing the list of closed edges of the rectangle, and simultaneously obtaining all vertex coordinates of the circular base polygon element as the overlay polygon and constructing the list of closed edges of the circle.

[0022] In some embodiments, line segment intersection detection is performed on each side of the base polygon rectangle and each side of the superimposed polygon circle, and the coordinates of all intersection points are calculated. Specifically, for one side segment of the base polygon... (coordinates are) and ) and a side segment of the superimposed polygon (coordinates are) and The intersection can be determined by solving the parametric equations and the intersection parameters can be calculated. and The formula can be expressed as:

[0023] Where: symbol and These are the coordinates of the two endpoints of the edge of the reference polygon, denoted by [symbol]. and These are the coordinates of the two endpoints of the superimposed polygon's edge, denoted by [symbol]. The intersection point is on the line segment The parameters and symbols on The intersection point is on the line segment The parameters on. When the parameters and parameters The values ​​simultaneously satisfy the condition and When determining if two line segments intersect, the coordinates of the intersection point can be determined based on parameters. The calculation yielded the result.

[0024] In practice, all intersection points on the boundaries of the base polygon rectangle and the superimposed polygon circle are collected, and the intersection points on each edge are recorded in order of the line segment direction. From the collected intersection points, a set of points that are simultaneously located inside the base polygon rectangle and the superimposed polygon circle is selected. The selected set of points is connected, and a closed geometric shape is generated according to the polygon vertex connection rules. This generated closed geometric shape is the overlapping region polygon. In the data comparison of the example scenario, the vertex coordinates of the base polygon rectangle might be... The vertices of the superimposed polygonal circle are represented by a sequence of approximately circular points, and the calculated coordinates of the intersection points may include... The resulting overlapping polygon after connection may be a lens-shaped polygon representing the intersection of a rectangle and a circle.

[0025] Optionally, the area covered by overlapping polygons is subtracted from the complete geometric region of the base polygon rectangle. Geometric cleanup is performed on self-intersecting loops or isolated vertices resulting from the subtraction operation to ensure the final generated shape is a valid single-part polygon. This geometric cleanup removes degenerate edges or overlapping vertices with zero area and repairs illegal intersections between polygon edges. In the data comparison, the base polygon before subtraction is a complete rectangle, and the single hollow composite shape generated after subtraction is a rectangle with a circular hole, whose vertex coordinate sequence is an ordered combination of the outer contour vertices of the rectangle and the inner contour vertices of the circle. The geometrically cleaned polygon is stored as a single hollow composite shape.

[0026] In one embodiment of the present invention, when the cutout mode selection interface receives a selection instruction for the cutout window retention mode option, a cutout retention instruction is executed on the basic polygonal elements that have spatial overlapping relationships. See also... Figure 3 The process identifies the base polygon elements that serve as the reference polygon and the base polygon elements that serve as the superimposed polygon. A cutout and shape retention instruction is executed, which performs two parallel processing flows. The first flow performs a Boolean difference operation to subtract the area overlapping with the superimposed polygon from the reference polygon, generating the main target graphic. The second flow extracts the complete geometric contour of the superimposed polygon itself, generating one or more independent cutout contour graphics. This generation process includes checking the geometric structure of the superimposed polygon itself. If the superimposed polygon is a single simple polygon, its vertex coordinate sequence is directly copied as an independent cutout contour graphic. If the superimposed polygon is a composite graphic composed of multiple sub-polygons, the vertex coordinate sequence of each sub-polygon is copied separately, and each sub-polygon is treated as an independent cutout contour graphic. Source information pointing to the corresponding original superimposed polygon is recorded for each independent cutout contour graphic. The generated main target graphic is then associated with one or more independent cutout contour graphics to form a set of output graphics.

[0027] In practical implementation, when the image cutout mode selection interface receives a selection instruction for the cutout window mode option, the specific process of executing the cutout shape retention instruction on basic polygonal elements with spatial overlap is as follows: In an example scenario involving the annotation of a mechanical flange, the original OCC image contains a flange part. The user draws a hexagon representing the outer shape of the flange as a basic polygonal element in the graphical user interface, and simultaneously draws two circles representing bolt mounting holes inside the hexagon as additional basic polygonal elements. The hexagon and the two circles have spatial overlap. In practical implementation, the system identifies the basic polygonal element as the reference polygon, namely the hexagon representing the outer contour, and identifies the basic polygonal elements as the superimposed polygons, namely the two circles representing the two bolt holes. The cutout shape retention instruction is then executed, with two processing flows initiated in parallel.

[0028] In some embodiments, the first processing flow performs a Boolean difference operation to subtract the overlapping regions of the two circles (which are superimposed polygons) from the hexagon (which serves as the base polygon) to generate the main target graphic. During this process, the system calculates the overlapping region between the hexagon and each circle, and subtracts these overlapping regions sequentially from the complete geometric region of the hexagon. In the data comparison, assuming the vertex coordinate sequence of the base polygon hexagon is [(100,100),(150,100),(180,150),(150,200),(100,200),(70,150)], the center coordinates of circle A of the superimposed polygon are (120,150) with a radius of 10, and the center coordinates of circle B are (140,150) with a radius of 10, the main target graphic generated after the Boolean difference operation is a hexagon with two circular holes. Its geometric data includes the vertices of the outer contour hexagon and the contour vertex sequence of the two circular holes. The second processing flow extracts the complete geometric contour of the superimposed polygon itself, generating one or more independent hollow contour graphics. It is understandable that generating independent cutout outline graphics involves checking the geometry of the superimposed polygons themselves.

[0029] Optionally, if the superimposed polygon is a single simple polygon, the vertex coordinate sequence of the polygon is directly copied, making it an independent hollow outline graphic. In the flange example, the superimposed polygon circle A is a simple polygon. The system copies its center and radius parameters or the discretized vertex sequence to generate an independent hollow outline graphic representing the complete outline of circle A. If the superimposed polygon itself is a composite graphic composed of multiple sub-polygons, the vertex coordinate sequence of each sub-polygon is copied separately, making each sub-polygon an independent hollow outline graphic. In another example scenario, assuming the superimposed polygon is a composite graphic composed of two separate rectangles, and its geometric structure data indicates that it contains two sub-polygon rectangles C and D, the system will copy the vertex coordinate sequences of rectangle C and rectangle D respectively, thereby generating two independent hollow outline graphics. The source information of each independent hollow outline graphic is recorded. The source information points to its corresponding original superimposed polygon. The source information can be a unique identifier, and its generation formula is:

[0030] Where: symbol It is the generated source information identifier, symbol. It is a polygon type encoding, symbol It is a normalized string representation of the vertex coordinate sequence of a polygon, with symbols It is a hash function applied to the input parameters.

[0031] In specific implementations, the generated main target graphic is associated with one or more generated independent hollow outline graphics to form a set of output graphics. In some embodiments, this association can be achieved by using a common group identifier in the data structure. For example, in data comparison, the main target graphic (the hexagon with holes) is assigned the group identifier "Group_001", and the independent hollow outline graphics representing circle A and circle B are also assigned the same group identifier "Group_001", thus indicating that the three belong to the annotation of a physical object (flange). It can be understood that this set of output graphics fully preserves the independent outline information of the original superimposed polygons (two circles), and is not merely a set of graphics with holes.

[0032] In one embodiment of the present invention, a single hollow composite graphic or a set of output graphics is data encoded. All vertex coordinate sequences of the single hollow composite graphic are read, or the vertex coordinate sequences of the main target graphic and each independent hollow contour graphic in the set of output graphics are read separately. The vertex coordinate sequences are arranged in a preset order. Corresponding graphic identifiers are attached to the vertex coordinate sequences; these graphic identifiers are used to distinguish different independent graphics and the hierarchical relationships between graphics. The vertex coordinate sequences with attached graphic identifiers, associated semantic category labels, and graphic type codes are packaged together to form an intermediate annotation data block.

[0033] In a specific implementation, the step of data encoding for a single hollow composite graphic or a set of output graphics is illustrated in an example scenario involving printed circuit board (PCB) component annotation. The system has completed the image cutout and shape retention instruction processing, generating a main target graphic representing an insulating outer frame and two independent hollow outline graphics representing internal metal regions, forming a set of output graphics. In the specific implementation, the vertex coordinate sequences of the main target graphic and each independent hollow outline graphic in the output graphic set are read. For example, in data comparison, the vertex coordinate sequence of the main target graphic (insulating outer frame) might be [(0,0),(200,0),(200,150),(0,150)], the vertex coordinate sequence of the first independent hollow outline graphic (metal region A) is [(20,20),(80,20),(80,80),(20,80)], and the vertex coordinate sequence of the second independent hollow outline graphic (metal region B) is [(120,20),(180,20),(180,80),(120,80)]. Arrange the vertex coordinate sequence in a preset order, which can be that all vertices are arranged in a counter-clockwise direction.

[0034] In some embodiments, a corresponding graphic identifier is appended to the arranged vertex coordinate sequence. The graphic identifier is used to distinguish different independent graphics and the hierarchical relationship between graphics. The graphic identifier can adopt a hierarchical encoding format of "parent ID-child ID". In the data comparison of the PCB example, the main target graphic may be assigned the graphic identifier "G1", and two independent cutout outline graphics, as its child graphics, may be assigned the graphic identifiers "G1-1" and "G1-2" respectively, indicating that they belong to the main graphic identified by "G1". It is understood that the generation of graphic identifiers must follow the rules of uniqueness and resolvability. A formula for generating a unique sequence number in a graphic identifier can be expressed as:

[0035] Where: symbol It is a unique integer value of the generated sequence number, with the symbol... It is a large constant, symbol It is the x-coordinate of the center point of the smallest bounding rectangle of the polygon, with the symbol... It is the decimal part of the system startup timestamp, with the sign... It is the current thread ID, symbol It is the floor function, symbol It is the bitwise XOR operator.

[0036] Optionally, the vertex coordinate sequence with attached graphic identifiers, the associated semantic category label, and the graphic type code are packaged together to form an intermediate annotation data block. The semantic category label can be text or code such as "insulating material" or "metallic wiring." The graphic type code is used to identify whether the graphic is a solid outline or a hole outline. See Table 1 for an example of an intermediate annotation data block:

[0037] In practical implementation, the encoding process for a single hollowed-out composite graphic is similar. It involves reading the vertex coordinate sequence of the single hollowed-out composite graphic, which includes all vertices of both the outer and inner contours (holes). In another example scenario, a single hollowed-out composite graphic (a metal plate with a rectangular window) processed by the hollowing instruction might have a vertex coordinate sequence of [(0,0),(100,0),(100,100),(0,100),(20,20),(20,80),(80,80),(80,20)], where the first four points define the outer contour and the last four points define the inner contour. This sequence is then appended with a graphic identifier, such as "G2," and associated with the semantic category label "metal plate," with the graphic type code marked as "2" (indicating a composite graphic). In some embodiments, the packaging process serializes all information into a specific binary or JSON format. In data comparison, the data before packaging is a scattered structure, and after packaging, it may form a continuous binary block with a fixed header and segmented data body. The header contains information such as version and number of graphics, and each segment corresponds to the encoded data of a graphic.

[0038] In one embodiment of the present invention, after generating multiple basic polygonal features in response to a user's drawing operation, a graphic overlay relationship verification step is performed. The positional relationship between any two basic polygonal features is detected. When a relationship of inclusion, being included, or intersection between two basic polygonal features is detected, the detected pair of basic polygonal features is marked as a pair of graphics to be processed. In the cutout mode selection interface, the operation controls related to the pair of graphics to be processed are highlighted. When the cutout mode selection interface receives a mode selection instruction, the corresponding cutout instruction is executed only on the marked pair of graphics to be processed. A step of exporting annotation results is performed, extracting the geometric and semantic information of all graphics from the intermediate annotation data block. According to the specified OCC semantic segmentation data format specification, the geometric and semantic information is converted into a standardized data structure. In the standardized data structure, the same instance identifier is assigned to the main target graphic and the independent cutout contour graphic that belong to the same physical object but are separated by the cutout shape retention instruction. The standardized data structure is written to a disk file, and the disk file format is a general annotation exchange format.

[0039] In the specific implementation, the graphic overlay relationship verification step and the annotation result export step are performed. In an example scenario involving door and window annotations on a building floor plan, the original OCC image is an interior layout diagram. The user draws a large rectangular basic polygon element representing the overall area of ​​the room in the graphical user interface, and draws three smaller rectangular basic polygon elements representing windows and doorways respectively within this rectangle. In the specific implementation, after generating multiple basic polygon elements in response to the user's drawing operation, the system performs a graphic overlay relationship verification step to detect the positional relationship between any two basic polygon elements. In the data comparison, assuming the coordinate range of the basic polygon element R1 representing the room is [(0,0),(1000,0),(1000,800),(0,800)], and the coordinate range of the basic polygon element W1 representing the window is [(200,0),(400,0),(400,50),(200,50)], calculations show that all vertices of W1 are within the boundary range of R1, and the system determines that the basic polygon element W1 is contained within the basic polygon element R1. Similarly, the coordinate range of the basic polygonal element D1 representing the doorway is [(800,300),(900,300),(900,500),(800,500)], which intersects with the boundary of R1. The system determines that there is an intersection relationship between the basic polygonal element R1 and the basic polygonal element D1.

[0040] In some embodiments, when two basic polygonal features are detected to have an inclusion, being included, or intersecting relationship, the detected pair of basic polygonal features is marked as a pair of graphics to be processed. In the architectural floor plan example, the system marks the polygon pairs (R1,W1) and (R1,D1) as pairs of graphics to be processed. In the cutout mode selection interface, the operation controls related to the pairs of graphics to be processed are highlighted, for example, the borders of the "Cutout Mode" and "Cutout with Window" buttons are changed to flashing orange. When the user selects the "Cutout with Window" option in the interface, the system only performs the cutout and shape retention instruction on the marked pairs of graphics to be processed (R1,W1) and (R1,D1), and does not process other independent polygons that may exist in the image without overlapping relationships. The formula for calculating the confidence of the superposition relationship between two basic polygonal features A and B to assist in the determination can be expressed as:

[0041] Where: symbol It is the calculated confidence level of the superposition relationship, with the sign... It is the area of ​​the intersection region between basic polygon feature A and basic polygon feature B, denoted by [symbol missing]. It is the area of ​​the basic polygon feature A, symbol It is the area of ​​the basic polygon feature B, symbol It is a function that takes the minimum value. When When two basic polygonal elements are determined to have an overlapping relationship, it is determined that they are superimposed.

[0042] In practice, the annotation result export step is executed, extracting the geometric and semantic information of all graphics from the intermediate annotation data block. Following the specified OCC semantic segmentation data format specification, the geometric and semantic information is converted into a standardized data structure. In the example of the architectural floor plan, assuming that after processing with the cutout shape retention instruction, a main target graphic representing the room wall (the graphic after subtracting the W1 and D1 regions from R1), a separate cutout outline graphic W1 representing a window, and a separate cutout outline graphic D1 representing a doorway are generated. In the standardized data structure, the same instance identifier, such as "Instance_001," is assigned to the main target graphic and the separate cutout outline graphics W1 and D1, which belong to the same physical object "room wall" but are separated by the cutout shape retention instruction. It can be understood that this instance identifier is used in the exported data to associate different graphic parts segmented from the same original target. Refer to Table 2, which shows a possible fragment of the standardized data structure:

[0043] In some embodiments, the OCC semantic segmentation data format specification may require geometric information to be represented in normalized relative coordinates. In a data comparison, the original image resolution is 2000x1600 pixels, and the coordinates of a vertex of the main target graphic in the intermediate labeled data block are (1000, 800). When converted to the normalized data structure, these coordinates are normalized to (0.5, 0.5). Optionally, the normalized data structure is written to a disk file in a common annotation exchange format, such as JSON or XML. In a specific implementation, the writing process includes creating a file header, writing image metadata, and sequentially writing the data blocks for each instance. The final generated disk file contains all the OCC semantic segmentation annotation information that can be used for model training.

[0044] In one embodiment of the present invention, a visual preview and editing step is performed before the annotation results are exported. An intermediate annotation data block is loaded and rendered in a graphical user interface. Individual hollow composite graphics are drawn using different visual styles, or the main target graphic and each independent hollow outline graphic in the output graphic set are drawn separately. In response to the user's dragging operation on the vertices of the rendered graphics, the vertex coordinate sequence in the intermediate annotation data block is dynamically updated. This process includes capturing the user's dragging event on a specific vertex of a rendered graphic in the graphical user interface to obtain the new screen coordinates after dragging, converting the new screen coordinates to the corresponding image coordinate system coordinates through a view transformation matrix, finding and replacing the original coordinate values ​​of the vertices in the intermediate annotation data block, and triggering graphic validity verification after replacing the coordinate values ​​to check whether the order of the graphic vertex sequence remains consistent (clockwise or counterclockwise). If the order of the graphic vertex sequence is disordered due to vertex movement, the vertex coordinate sequence is automatically reordered to restore the preset vertex wrapping direction. In response to the user's modification operation on the semantic labels of the rendered graphics, the associated semantic category labels in the intermediate annotation data block are updated. After each update, the data encoding steps for a single cutout composite graphic or a set of output graphics are re-executed to generate updated intermediate annotation data blocks.

[0045] In a practical implementation, within a continuing architectural floor plan annotation example scenario, the system has completed the cutout and shape-retaining processing of room walls, windows, and doorways, generating intermediate annotation data blocks. Before exporting the annotation results, the intermediate annotation data blocks are loaded and rendered in the graphical user interface. These blocks contain the geometric and semantic information of the main target graphic representing the wall, the independent cutout outline graphic W1 representing the window, and the independent cutout outline graphic D1 representing the doorway. Different visual styles are used to draw the main target graphic and each independent cutout outline graphic in the output graphic set. In practice, the main target graphic (wall) may be drawn with a semi-transparent gray fill, while the independent cutout outline graphics W1 (window) and D1 (doorway) may be drawn with solid red borders but not filled, thus visually clearly distinguishing the main structure from the internal cutout outlines.

[0046] In some embodiments, in response to a user's dragging operation on a vertex of a rendered graphic, the vertex coordinate sequence in the intermediate annotation data block is dynamically updated. The dragging event of a specific vertex of a rendered graphic by the user is captured in the graphical user interface, and the new screen coordinates after the drag are obtained. For example, if a user clicks and drags a vertex of a separate hollow outline graphic D1 representing a doorway from the initial screen coordinates (900, 300) to the new screen coordinates (920, 320), the new screen coordinates are converted to the corresponding image coordinate system coordinates using a view transformation matrix. The image coordinate system coordinates are the original coordinate reference stored in the intermediate annotation data block. The transformation relationship can be expressed as:

[0047] Where: symbol and These are the x and y coordinates of the transformed image coordinate system, with symbols... It is the inverse of the view transformation matrix, symbol and These are the new horizontal and vertical coordinates of the screen after dragging. In the intermediate labeled data block, the original coordinate values ​​of the vertices are found and replaced. In the data comparison, the original (900, 300) in the vertex coordinate sequence of the independent hollow outline graphic D1 is updated to the new image coordinate values ​​obtained by transformation calculation.

[0048] In practice, after replacing the coordinate values, a graph validity verification is triggered to check whether the order of the graph vertex sequence remains consistent (clockwise or counterclockwise). This verification calculates the sum of the cross products of all edges of the updated polygon. A positive area indicates a counterclockwise vertex order, while a negative area indicates a clockwise order. The system verifies whether this sign matches the preset wrapping direction. If the vertex sequence order is disrupted due to vertex movement, the vertex coordinate sequence is automatically reordered to restore the preset vertex wrapping direction. For example, during data comparison, user dragging might cause a concave polygon's vertex order to intersect locally. In this case, the system will reorder the vertices according to the polygon convex hull algorithm, generating a new vertex sequence that conforms to the preset counterclockwise direction and has no self-intersections. In response to user modifications to the semantic labels of rendered graphics, the system updates the associated semantic category labels in the intermediate annotation data block. For example, if a user selects the independent hollow outline graphic W1 representing a window in the graphical interface and changes the semantic category label from "window" to "floor-to-ceiling window" from the drop-down menu, the system will update the corresponding semantic category label field value in the intermediate annotation data block.

[0049] Optionally, after each update, whether it's a vertex coordinate update or a semantic label update, the data encoding step for the output graph set is re-executed to generate an updated intermediate annotation data block. In some embodiments, re-encoding means repackaging and generating a new data block conforming to the internal format specification based on the latest vertex sequence, graph identifier, and semantic labels of the current graph, replacing the old data block in memory. During data comparison, drag-and-drop operations and label modification operations may occur consecutively. The system will trigger an encoding update immediately after each operation to ensure that the intermediate annotation data block is always synchronized with the display state in the graphical user interface.

[0050] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.

Claims

1. An OCC semantic segmentation and annotation method based on diverse image matting modes, characterized in that, The method includes: Receive the original OCC image containing at least one object to be labeled; In the graphical user interface, in response to the user's drawing operation, multiple basic polygonal features are generated. These basic polygonal features are used to outline the boundary or internal structure of the object to be labeled, wherein at least two basic polygonal features have a spatial overlap relationship. The graphical user interface provides a cutout mode selection interface, which includes cutout mode options for executing cutout commands and cutout window mode options for executing cutout shape retention commands. When the cutout mode selection interface receives a selection instruction for the cutout mode option, it executes the cutout instruction on the basic polygonal elements that have spatial overlap. The cutout instruction automatically identifies the overlapping area and performs Boolean difference operations to remove the graphic area that overlaps with the superimposed polygon from the base polygon, including: Identify the base polygon features that serve as the reference polygon and the base polygon features that serve as the superimposed polygon; The hollowing-out shape retention instruction is executed. The hollowing-out shape retention instruction performs two processing flows in parallel. The first processing flow executes the Boolean difference operation to subtract the area overlapping with the superimposed polygon from the base polygon to generate the main target graphic. The second processing step extracts the complete geometric contour of the superimposed polygon itself and generates one or more independent hollow contour graphics; The main target graphic is associated with one or more independent hollow outline graphics to form a set of output graphics. Generate a single hollow composite graphic, wherein the single hollow composite graphic is the final geometric graphic after performing the Boolean difference operation, and contains only the target entity region; Associate a semantic category label with the individual hollowed-out composite graphic.

2. The OCC semantic segmentation and annotation method based on diverse image matting modes according to claim 1, characterized in that, The step of executing the cutout command on the basic polygonal features that have spatial overlap, wherein the cutout command automatically identifies the overlapping areas and performs Boolean difference operations, including: Calculate the geometric boundaries of the basic polygonal elements that form the basis of the superimposed polygons; The intersection of the base polygon features, which serve as the reference polygon, and the geometric boundaries of the superimposed polygon is calculated to obtain the overlapping region polygon. Subtract the area covered by the overlapping polygon from the complete geometric region of the base polygon; Perform geometric cleanup on self-intersecting loops or isolated vertices generated after the subtraction operation to ensure that the final generated graphic is a valid single-part polygon; The polygons after geometric cleanup are stored as the single hollowed-out composite graphic.

3. The OCC semantic segmentation and annotation method based on diverse image matting modes according to claim 2, characterized in that, The calculation, which uses the base polygon features as the reference polygon as the intersection of the geometric boundaries of the superimposed polygon, yields the overlapping region polygon, including: Obtain the coordinates of all vertices of the base polygon element that serves as the reference polygon, and construct a list of closed edges of the reference polygon; Obtain the coordinates of all vertices of the base polygon element that forms the superimposed polygon, and construct a list of closed edges of the superimposed polygon. Perform line segment intersection detection on each edge of the base polygon and each edge of the superimposed polygon, and calculate the coordinates of all intersection points; Collect all intersection points on the boundary between the base polygon and the superimposed polygon, and record the order of intersection points on each edge; From the collected intersection points, select the set of points that are simultaneously located inside the base polygon and the superimposed polygon; Connect the selected set of points and generate one or more closed geometric shapes according to the connection rules of polygon vertices; Merge one or more closed geometries into an overlapping region polygon.

4. The OCC semantic segmentation and annotation method based on diverse image matting modes according to claim 3, characterized in that, Generating the one or more independent hollow outline graphics includes: Inspect the geometry of the superimposed polygon itself; If the superimposed polygon is a single simple polygon, then the vertex coordinate sequence of the polygon is directly copied and used as an independent hollow outline graphic. If the superimposed polygon itself is a composite graphic, it is composed of multiple sub-polygons. In this case, the vertex coordinate sequence of each sub-polygon is copied, and each sub-polygon is treated as an independent hollow outline graphic. Record the source information for each individual hollow outline graphic, whereby the source information points to its corresponding original superimposed polygon.

5. The OCC semantic segmentation and annotation method based on diverse image matting modes according to claim 4, characterized in that, The method further includes the step of data encoding the single hollow composite graphic or the set of output graphics: Read the vertex coordinate sequence of the single hollow composite graphic, or read the vertex coordinate sequence of the main target graphic and each independent hollow outline graphic in the output graphic set respectively; Arrange the vertex coordinate sequence in a preset order; A corresponding graphic identifier is attached to the vertex coordinate sequence. The graphic identifier is used to distinguish different independent graphics and the hierarchical relationship between graphics. The vertex coordinate sequence with attached graphic identifier, the associated semantic category label, and the graphic type code are packaged together to form an intermediate annotation data block.

6. The OCC semantic segmentation and annotation method based on diversified image matting modes according to claim 4, characterized in that, The method also includes a step for verifying the overlay relationship of graphics: After generating multiple basic polygon features in response to the user's drawing operation, the positional relationship between any two basic polygon features is detected. When two basic polygon features are detected to have a relationship of inclusion, being included, or intersecting, the detected pair of basic polygon features is marked as a pair of graphics to be processed. In the image cutout mode selection interface, the operation controls related to the image pair to be processed are highlighted; When the image matting mode selection interface receives a mode selection instruction, it executes the corresponding image matting instruction only on the marked image pairs to be processed.

7. The OCC semantic segmentation and annotation method based on diverse image matting modes according to claim 5, characterized in that, The method also includes a step for exporting annotation results: Extract the geometric and semantic information of all graphics from the intermediate labeled data block; According to the specified OCC semantic segmentation data format specification, the geometric information and semantic information are converted into a standardized data structure; In the standardized data structure, the same instance identifier is assigned to the main target graphic and the independent hollow outline graphic that belong to the same physical object but are separated by the hollowing shape retention instruction. The standardized data structure is written to a disk file, and the disk file is in the format of the General Label Exchange Format.

8. The OCC semantic segmentation and annotation method based on diverse image matting modes according to claim 7, characterized in that, The method also includes visual preview and editing steps: Before exporting the annotation results, the intermediate annotation data block is loaded and rendered in the graphical user interface; The individual hollow composite graphic can be drawn using different visual styles, or the main target graphic and each independent hollow outline graphic in the output graphic set can be drawn separately. In response to the user's dragging operation on the vertices of the rendered graphics, the vertex coordinate sequence in the intermediate annotation data block is dynamically updated; In response to a user's modification of the semantic labels of a rendered graphic, update the associated semantic category labels in the intermediate labeled data block; After each update, the data encoding steps for the single hollow composite graphic or the set of output graphics are re-executed to generate updated intermediate annotation data blocks.

9. The OCC semantic segmentation and annotation method based on diversified image matting modes according to claim 8, characterized in that, The step of dynamically updating the vertex coordinate sequence in the intermediate annotation data block in response to a user's dragging operation on the rendered graphics includes: Capture drag events of users on specific vertexes of a rendered graphic in the graphical user interface and obtain the new screen coordinates after dragging; The new screen coordinates are converted into corresponding image coordinate system coordinates using a view transformation matrix; In the intermediate labeled data block, find and replace the original coordinate values ​​of the vertices; After replacing the coordinate values, a graph validity verification is triggered to check whether the order of the graph vertex sequence remains consistent, either clockwise or counterclockwise. If the order of the vertex sequence in the graphic becomes disordered due to vertex movement, the vertex coordinate sequence is automatically reordered to restore the preset vertex wrapping direction.

Citation Information

Patent Citations

  • Image processing method and device

    CN112446380A

  • Automatic space element extraction method based on character recognition and image processing

    CN117152185A