A method, system, terminal, and medium for AI-based frame generation and intelligent layout.

By using a YOLO-based drawing content recognition and intelligent layout method, drawing frames are automatically inserted and optimized, solving the problems of low efficiency and disorder in traditional manual drawing frame insertion, and achieving efficient and standardized drawing generation.

CN121259261BActive Publication Date: 2026-04-03SHENZHEN CAPOL INT & ASSOC CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-04
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

In existing technologies, drawing frames need to be manually inserted after the drawing design is completed. This is inefficient and prone to overlapping positions and misalignment of rows and columns, which affects the professionalism and readability of the drawings. Existing CAD software lacks intelligent perception and drawing frame layout optimization capabilities.

Method used

The AI-based method for generating and intelligently arranging drawing frames utilizes the YOLO model to identify the content area of ​​the drawing, generates a rectangular bounding box, and automatically inserts the drawing frame based on the drawing frame size standard data table, performing avoidance processing and alignment optimization to achieve automatic generation and intelligent arrangement of the target drawing frame.

Benefits of technology

It improves the efficiency and standardization of drawing output, solves the problems of overlapping drawing frames and disordered layout, and ensures the professionalism and visual appeal of the drawings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121259261B_ABST
    Figure CN121259261B_ABST
Patent Text Reader

Abstract

This invention discloses an AI-based method, system, terminal, and medium for generating and intelligently arranging drawing frames. The method includes: exporting PNG images from DWG drawings; performing content recognition and inference on the PNG images based on a target detection model to output several rectangular bounding boxes, which are then mapped onto the DWG drawing to obtain several actual content rectangular areas covered by the rectangular bounding boxes. Based on these actual content rectangular areas and a preset drawing frame size standard data table, several target drawing frames are determined and automatically inserted into the DWG drawing. The inserted target drawing frames undergo avoidance and alignment optimization processing to achieve automatic generation and intelligent arrangement of target drawing frames. This invention solves the problems of overlapping and disordered arrangement of drawing frames by automatically identifying the content areas of the drawing, determining the target drawing frames, and performing optimization steps such as avoidance and alignment, thereby improving the efficiency and standardization of drawing output.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of architectural engineering drawing frame generation and processing technology, and in particular to an AI-based method, system, terminal and medium for generating and intelligently arranging drawing frames. Background Technology

[0002] In the construction industry, after the design of drawings is completed, a standard title block must be inserted into each drawing and title information (such as drawing name, drawing number, designer, and date) must be filled in. This is a necessary step in the drawing production process. Traditionally, title blocks are inserted manually, which is not only inefficient but also prone to problems such as overlapping title blocks, misaligned rows and columns, and non-standard alignment when processing multiple drawings in batches, affecting the professionalism and readability of the drawings. While existing CAD software provides title block insertion functions, it lacks intelligent perception of the drawing content area and automatic optimization capabilities for title block layout, failing to achieve "content-driven" title block arrangement.

[0003] Therefore, existing technologies still have shortcomings. Summary of the Invention

[0004] The technical problem to be solved by this invention is to provide an AI-based method, system, terminal, and medium for generating and intelligently arranging graph frames, addressing the aforementioned deficiencies of existing technologies. The technical solution adopted by this invention is as follows:

[0005] In a first aspect, the present invention provides an AI-based method for generating and intelligently arranging picture frames, the method comprising:

[0006] A PNG image is exported from a DWG drawing. Content recognition and reasoning are performed on the PNG image based on an object detection model to output several rectangular bounding boxes. These rectangular bounding boxes are then mapped back to the DWG drawing to obtain several actual content rectangular regions covered by the rectangular bounding boxes. The object detection model is trained based on the YOLO model.

[0007] Based on several actual content rectangular areas and a preset standard data table of drawing frame dimensions, several target drawing frames are determined and automatically inserted into the DWG drawing.

[0008] After insertion, several target frames are subjected to avoidance and alignment optimization processing to achieve automatic generation and intelligent arrangement of target frames.

[0009] In one implementation, several rectangular bounding boxes are mapped onto a DWG drawing to obtain several actual content rectangular regions covered by the rectangular bounding boxes, including:

[0010] The rectangular bounding boxes are mapped to a DWG drawing, and the overlapping parts of the rectangular bounding boxes are merged to obtain the merged rectangular bounding boxes.

[0011] Based on the merged rectangular bounding boxes, several minimum bounding boxes covering the actual elements in the DWG drawing are obtained, and several actual content rectangular regions are obtained based on these minimum bounding boxes.

[0012] In one implementation, several target frames are determined based on several actual content rectangular regions and a preset standard data table of frame dimensions, including:

[0013] Several actual content rectangular areas are matched sequentially with the standard data table of map frame dimensions to determine the map size corresponding to each actual content rectangular area. The standard data table of map frame dimensions includes the outer frame size, inner frame size, margin parameters, and the maximum range of the inner map frame under the matching scale for different map sizes.

[0014] Based on the map area, several target map frames are determined.

[0015] In one implementation, several target frames after insertion are subjected to avoidance and alignment optimization processing to achieve automatic generation and intelligent arrangement of target frames, including:

[0016] The inserted target frames are then processed by row and column splitting to obtain a spatial grid index.

[0017] Based on the spatial grid index, all target frames are grouped by row and by column respectively to obtain frame row groups and frame column groups;

[0018] Based on the frame row group and frame column group, avoidance processing and alignment optimization processing are performed.

[0019] In one implementation, the inserted target frames are processed by row and column splitting to obtain a spatial grid index, including:

[0020] Extract the Y-coordinate values ​​of the center points of each inserted target frame and sort them in ascending order. Use the average height of all target frames as the row height threshold, and perform row-by-row processing on the inserted target frames based on the row height threshold.

[0021] Extract the X-coordinate values ​​of the center points of each inserted target frame and sort them in ascending order. Use the average width of all target frames as the column width threshold, and then perform column splitting on the inserted target frames based on the column width threshold.

[0022] In one implementation, avoidance and alignment optimization are performed based on the frame row group and frame column group, including:

[0023] Based on the frame row group, for all target frames in each row, with the row center line as the reference, the target frames located to the left of the row center point are shifted to the left and the target frames located to the right of the row center point are shifted to the right to achieve horizontal avoidance.

[0024] Based on the frame column group, for all target frames in each column, the column center line is used as the reference. Target frames above the column center point are shifted upwards and their positions are adjusted, while target frames below the column center point are shifted downwards to achieve vertical avoidance.

[0025] In one implementation, avoidance and alignment optimization are performed based on the frame row group and frame column group, including:

[0026] Based on the frame row group, for all target frames in each row, extract the Y coordinate of the insertion point of each target frame, determine the minimum and maximum values ​​of the Y coordinate of each row and calculate the average value of the Y coordinate, and uniformly adjust the Y coordinate of the insertion points of all target frames in each row to the average value of the Y coordinate of that row to achieve horizontal alignment within the row;

[0027] Based on the frame column group, for all target frames in each column, the X coordinate of the insertion point of each target frame is extracted, the minimum and maximum values ​​of the X coordinate of each column are determined and the average value of the X coordinate is calculated, and the X coordinates of the insertion points of all target frames in each column are uniformly adjusted to the average value of the X coordinate of that column to achieve vertical alignment within the column.

[0028] Secondly, embodiments of the present invention also provide an AI-based frame generation and intelligent layout system, the system being used to implement the steps of the AI-based frame generation and intelligent layout method described in any of the above solutions, the system comprising:

[0029] The reasoning and mapping module is used to export PNG images based on DWG drawings, perform content recognition and reasoning on the PNG images based on the object detection model, output several rectangular bounding boxes, and map the several rectangular bounding boxes to the DWG drawings to obtain several actual content rectangular regions covered by the rectangular bounding boxes. The object detection model is trained based on the YOLO model.

[0030] The title block determination module is used to determine several target title blocks based on several actual content rectangular areas and a preset title block size standard data table, and automatically insert the target title blocks into the DWG drawing;

[0031] The intelligent layout module is used to perform avoidance and alignment optimization on several inserted target frames, so as to realize the automatic generation and intelligent layout of target frames.

[0032] Thirdly, embodiments of the present invention also provide a terminal, wherein the terminal includes a memory, a processor, and an AI-based frame generation and intelligent layout program stored in the memory and executable on the processor. When the processor executes the AI-based frame generation and intelligent layout program, it implements the steps of the AI-based frame generation and intelligent layout method of any of the above solutions.

[0033] Fourthly, embodiments of the present invention also provide a computer-readable storage medium, wherein the computer-readable storage medium stores an AI-based frame generation and intelligent layout program, the AI-based frame generation and intelligent layout program implementing the steps of the AI-based frame generation and intelligent layout method described in any one of the above schemes on the computer-readable storage medium.

[0034] Beneficial Effects: Compared with existing technologies, this invention provides an AI-based method for generating and intelligently arranging drawing frames. First, a PNG image is exported from a DWG drawing. Then, a target detection model is used to perform content recognition and inference on the PNG image, outputting several rectangular bounding boxes. These bounding boxes are then mapped onto the DWG drawing, resulting in several actual content rectangular regions covered by the bounding boxes. The target detection model is trained based on the YOLO model. Next, based on these actual content rectangular regions and a preset drawing frame size standard data table, several target drawing frames are determined and automatically inserted into the DWG drawing. Finally, the inserted target drawing frames undergo avoidance and alignment optimization processing, achieving automatic generation and intelligent arrangement of target drawing frames. This invention solves the problems of overlapping and misaligned drawing frames by automatically identifying the content areas of the drawing, determining the target drawing frames, and performing avoidance and alignment optimization steps, thereby improving the efficiency and standardization of drawing output. Attached Figure Description

[0035] Figure 1 This is a flowchart illustrating a preferred embodiment of the AI-based frame generation and intelligent layout method provided in this invention.

[0036] Figure 2 This is a technical principle framework diagram of the AI-based frame generation and intelligent arrangement method provided in the embodiments of the present invention.

[0037] Figure 3 This is a schematic diagram of the standard data table for the frame size in the AI-based frame generation and intelligent layout method provided in the embodiments of the present invention.

[0038] Figure 4 This is a schematic diagram of the AI-based frame generation and intelligent layout system provided in an embodiment of the present invention.

[0039] Figure 5A schematic diagram of a terminal provided in an embodiment of the present invention. Detailed Implementation

[0040] To make the objectives, technical solutions, and effects of this invention clearer and more explicit, 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 of the invention and are not intended to limit the invention.

[0041] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content, operations, or steps, nor does it require execution in the described order. For example, some operations or steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.

[0042] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0043] It should be understood that, in order to clearly describe the technical solutions of the embodiments of the present invention, the terms "first" and "second" are used in the embodiments of the present invention to distinguish identical or similar items with essentially the same function and effect. For example, "first control information" and "second control information" are only used to distinguish different control information and do not limit their order.

[0044] Those skilled in the art will understand that the words "first" and "second" do not limit the quantity or the order of execution, and that the words "first" and "second" do not necessarily imply that they are different.

[0045] It should also be understood that the term “and / or” as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0046] In recent years, object detection technology (such as the YOLO series models, which are real-time object detection models) has made significant progress in the field of image recognition and can be used to automatically identify valid content areas in drawings. However, there is still no mature solution for how to intelligently generate drawing frames based on content areas, number and sort them, avoid overlaps, and achieve aesthetic alignment. To address this, this embodiment provides an AI-based method for generating and intelligently arranging drawing frames. The method in this embodiment can automatically identify the content areas of the drawing, determine the target drawing frames, and perform optimization steps such as avoidance and alignment to solve the problems of overlapping and disordered arrangement of drawing frames, thereby improving the efficiency and standardization of drawing output. In specific applications, this embodiment exports PNG images based on DWG drawings. DWG drawings are .dwg format drawings output by drawing software, and PNG images are .png format images. Then, based on the object detection model, content recognition and inference are performed on the PNG images to output several rectangular bounding boxes. These rectangular bounding boxes are then mapped onto the DWG drawings to obtain several actual content rectangular areas covered by the rectangular bounding boxes. The object detection model is trained based on the YOLO model. Then, based on several actual content rectangular areas and a preset standard data table of drawing frame dimensions, several target drawing frames are determined and automatically inserted into the DWG drawing. Finally, the inserted target drawing frames undergo avoidance and alignment optimization processing to achieve automatic generation and intelligent arrangement of target drawing frames.

[0047] The AI-based frame generation and intelligent arrangement method of this embodiment can be applied to terminals, such as computers and other intelligent product terminals. Specifically, for example... Figure 1 As shown in the figure, the AI-based frame generation and intelligent layout method of this embodiment includes the following steps:

[0048] Step S100: Export a PNG image based on the DWG drawing, perform content recognition and reasoning on the PNG image based on the object detection model, output several rectangular bounding boxes, and map the several rectangular bounding boxes to the DWG drawing to obtain several actual content rectangular regions covered by the rectangular bounding boxes. The object detection model is trained based on the YOLO model.

[0049] Before generating the bounding box, this embodiment needs to perform content recognition on the DWG drawing and determine the most suitable bounding box. The DWG drawing is a drawing created using CAD software. Therefore, this embodiment uses an object detection model trained on the YOLO model to perform content recognition on the DWG drawing, thereby inferring the rectangular bounding box. Specifically, combined with... Figure 2As shown, this embodiment first derives a PNG image from the model space and layout space of the DWG drawing, and simultaneously records the coordinate transformation matrix between the DWG coordinate system in the DWG drawing and the pixel coordinates in the PNG image, so as to achieve spatial mapping between the DWG drawing and the PNG image later. After obtaining the PNG image, this embodiment can use an object detection model to locate and identify several primitive contents in the PNG image and infer several rectangular bounding boxes. The training process of the YOLO model in this embodiment includes:

[0050] 1. Data preparation: Collect over 1,000 DWG drawings covering more than 10 categories, including catalogs, descriptions, and floor plans. After manually removing the original drawing frames, export standardized PNG images and label the drawing frame range and type according to multiple dimensions such as content modality, profession, and number of drawing frames.

[0051] 2. Model Training: Configure the YOLO dataset YAML file (a data serialization language file), use a graphics processor to accelerate training for 300-500 rounds, set the resolution to 1024×1024, monitor metrics such as box_loss (boundary box regression loss) and cls_loss (classification loss) to ensure convergence and generalization, so that the YOLO model learns the correspondence between the exported PNG image and the bounding box range.

[0052] 3. Model Validation: The trained target detection model is derived by manually verifying its effectiveness on the validation set.

[0053] The object detection model can export PNG images based on the input DWG drawings and output the bounding box range inference results, which are the aforementioned rectangular bounding boxes.

[0054] Next, this embodiment maps all the rectangular bounding boxes inferred by the target detection model to the DWG drawing, obtaining several actual content rectangular areas covered by the rectangular bounding boxes. In specific applications, in the world coordinate system of CAD software, the coordinate origin is located at the lower left corner of the view, with the X-axis extending to the right and the Y-axis extending upward. However, in the pixel coordinate system of a PNG image, the coordinate origin is usually located at the upper left corner of the image, with the X-axis extending to the right and the Y-axis extending downward. To achieve the conversion between the two coordinate systems, it is first necessary to determine the minimum bounding rectangle of the DWG drawing's export range and obtain the world coordinates (minX, maxY) of its upper left corner point, which will serve as the reference origin for subsequent coordinate transformations. Next, a scaling factor, `scale`, is set. Its value is equal to the ratio of the width of the exported target image (`imgWidth`) to the actual width of the exported area of ​​the DWG drawing (`width`), i.e., `scale = width / imgWidth`. During coordinate transformation, the Y coordinates of the PNG image are first inverted (i.e., multiplied by -1) to align their direction with the Y-axis in the DWG drawing. Then, the X and Y components are scaled by multiplying by `scale`. Finally, the origin of the coordinate system is moved to (`minX`, `maxY`) through a translation operation, completing the mapping from the pixel coordinates of the PNG image to the world coordinates of the architectural drawing, thus obtaining the coordinate transformation matrix. Therefore, based on the coordinate transformation matrix, this embodiment maps all rectangular bounding boxes to the world coordinate system of the DWG drawing, thereby obtaining several actual content rectangular areas.

[0055] Furthermore, during the mapping process, this embodiment also merges the intersecting portions of several rectangular bounding boxes to obtain merged rectangular bounding boxes. Then, based on the merged rectangular bounding boxes, several minimum bounding boxes covering the actual primitives in the DWG drawing are determined to eliminate any random gaps that may exist between the rectangular bounding boxes inferred by the target detection model and the actual content area. This results in several accurate rectangular areas of the actual content based on the minimum bounding boxes, ensuring that the subsequently determined target frames conform to the actual design content and improving the accuracy and professionalism of the layout.

[0056] Step S200: Based on several actual content rectangular areas and a preset standard data table of drawing frame dimensions, determine several target drawing frames and automatically insert these target drawing frames into the DWG drawing.

[0057] In practical applications, this embodiment sequentially matches several actual content rectangular areas with the standard data table of map frame dimensions to determine the map size corresponding to each actual content rectangular area. The standard data table of map frame dimensions includes the outer frame size, inner frame size, margin parameters (i.e., the gap between the inner and outer map frames: top / bottom / left / right), and the maximum range of the inner map frame under the corresponding scale (i.e., the matching range of the map frame). Specifically, as follows... Figure 3As shown in the figure, the standard data table for drawing frame dimensions has a clear structure, supports quick retrieval by drawing sheet number, and automatically adapts to the scale and output requirements of the current drawing, providing a standardized dimensional basis for subsequent drawing frame generation and ensuring that the layout conforms to industry drafting standards. The drawing sheet determined in this embodiment best matches the content scope, is proportionally coordinated, and meets drafting standards, ensuring that the drawing frame boundary closely fits the drawing content. Therefore, based on the matched drawing sheet, several target drawing frames can be determined and automatically inserted into the DWG drawing.

[0058] Step S300: Perform avoidance and alignment optimization on the inserted target frames to achieve automatic generation and intelligent arrangement of target frames.

[0059] Because the target title frame is centered within the content area by default during insertion, multiple inserted target title frames are prone to overlapping or misalignment in spatial layout. For example, their vertical, horizontal, and other positions may become disordered, deviating from the neat arrangement expected of nested title frames and severely impacting the overall visual appeal and professional presentation of the drawing. Therefore, this embodiment requires avoidance and alignment optimization processing for the inserted target title frames.

[0060] To achieve a structured layout of the target frames and subsequent intelligent obstacle avoidance alignment, this embodiment first assigns row and column numbers to all inserted target frames. Specifically, this embodiment performs row and column splitting on the inserted target frames to obtain a spatial grid index. Row splitting includes: extracting the Y-coordinate values ​​of the center points of each inserted target frame and sorting them in ascending order; using the average height of all target frames as a row height threshold; and splitting the inserted target frames into rows based on the row height threshold, such as treating all target frames within a certain row height threshold as the same row. Column splitting includes: extracting the X-coordinate values ​​of the center points of each inserted target frame and sorting them in ascending order; using the average width of all target frames as a column width threshold; and splitting the inserted target frames into columns based on the column width threshold, such as treating all target frames within a certain column width threshold as the same column. Using the spatial clustering algorithm described above, this embodiment assigns a unique row and column identifier (such as "first row, third column") to each target drawing frame, realizing row and column numbering and constructing a clear spatial grid index. This provides an accurate data foundation for subsequent overlap detection, intelligent avoidance, and alignment optimization, comprehensively improving the standardization and visual aesthetics of drawing layout.

[0061] Next, after dividing the target frames into rows and columns, this embodiment uses a spatial grid index to group all target frames by row and by column, resulting in frame row groups and frame column groups. Then, based on the frame row groups and frame column groups, avoidance and alignment optimization processes are performed. Specifically, during the avoidance process, this embodiment uses the frame row group as a reference. For all target frames in each row, the row center line is used as a reference. Target frames located to the left of the row center point are shifted to the left to ensure they are separated and do not overlap. Target frames located to the right of the row center point are shifted to the right to ensure they are separated and do not overlap. This bidirectional avoidance in the horizontal direction ensures that adjacent target frames in the same row do not overlap. Based on the frame column grouping, for all target frames within each column, using the column center line as a reference, target frames above the column center point are shifted upwards to ensure they are spaced out and do not overlap. Target frames below the column center point are shifted downwards to ensure they are also spaced out and do not overlap. This bidirectional vertical avoidance ensures that adjacent target frames within the same column do not overlap. This embodiment adopts a "horizontal first, then vertical, centrally symmetrical avoidance" approach, achieving a globally non-overlapping layout while minimizing frame displacement, balancing efficiency and visual neatness, and laying a stable foundation for subsequent alignment optimization.

[0062] During alignment, based on the row groups of title frames, for all target title frames within each row, the Y-coordinate of the insertion point of each target title frame is extracted. The minimum and maximum values ​​of the Y-coordinates for each row are determined, and the average Y-coordinate is calculated. This average Y-coordinate is used as the alignment benchmark for each row, and the Y-coordinates of the insertion points of all target title frames in each row are uniformly adjusted to the average Y-coordinate of that row. This ensures that the target title frames in each row are horizontally aligned within the row. Based on the column groups of title frames, for all target title frames within each column, the X-coordinate of the insertion point of each target title frame is extracted. The minimum and maximum values ​​of the X-coordinates for each column are determined, and the average X-coordinate is calculated. This average X-coordinate is used as the alignment benchmark for each column, and the X-coordinates of the insertion points of all target title frames in each column are uniformly adjusted to the average X-coordinate of that column. This ensures that the target title frames in each column are vertically aligned within the column. Through this dual optimization of horizontal and vertical alignment, it is ensured that the layout of all inserted target title frames is neat and orderly, with clear rows and columns, significantly improving the standardization and visual aesthetics of the drawings.

[0063] In summary, this embodiment first exports a PNG image from a DWG drawing. Then, it performs content recognition and inference on the PNG image using a target detection model, outputting several rectangular bounding boxes. These bounding boxes are then mapped onto the DWG drawing, resulting in several actual content rectangular regions covered by the bounding boxes. The target detection model is trained using the YOLO model. Next, based on these actual content rectangular regions and a preset standard data table of drawing frame dimensions, several target drawing frames are determined and automatically inserted into the DWG drawing. Finally, the inserted target drawing frames undergo avoidance and alignment optimization, achieving automatic generation and intelligent arrangement of target drawing frames. This embodiment solves the problems of overlapping and misaligned drawing frames by automatically identifying the content areas of the drawing, determining the target drawing frames, and performing avoidance and alignment optimization steps, thereby improving the efficiency and standardization of drawing output.

[0064] Based on the above embodiments, the present invention also provides an AI-based frame generation and intelligent layout system, which is used to implement the above method embodiments. Specifically, as follows... Figure 4 As shown, the system in this embodiment includes: an inference and mapping module 10, a frame determination module 20, and an intelligent layout module 30. Specifically, the inference and mapping module 10 is used to export PNG images based on DWG drawings, perform content recognition and inference on the PNG images based on a target detection model, output several rectangular bounding boxes, and map the several rectangular bounding boxes onto the DWG drawings to obtain several actual content rectangular areas covered by the rectangular bounding boxes. The target detection model is trained based on the YOLO model. The frame determination module 20 is used to determine several target frames based on the several actual content rectangular areas and a preset frame size standard data table, and automatically insert the several target frames into the DWG drawings. The intelligent layout module 30 is used to perform avoidance processing and alignment optimization processing on the inserted target frames to achieve automatic generation and intelligent layout of the target frames.

[0065] The AI-based frame generation and intelligent arrangement method in this embodiment is the same as the principle of each terminal and module in the above system embodiment, and will not be repeated here.

[0066] Based on the above embodiments, the present invention also provides a terminal, the principle block diagram of which can be as follows: Figure 5 As shown. The terminal may include one or more processors 100 ( Figure 5(Only one is shown in the image), memory 101, and computer program 102 stored in memory 101 and executable on one or more processors 100. For example, an AI-based frame generation and intelligent layout program. When one or more processors 100 execute computer program 102, they can implement various steps in the AI-based frame generation and intelligent layout method embodiment. Alternatively, when one or more processors 100 execute computer program 102, they can implement the functions of various modules / units in the AI-based frame generation and intelligent layout system embodiment, without limitation here.

[0067] In one embodiment, the processor 100 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0068] In one embodiment, memory 101 may be an internal storage unit of an electronic device, such as a hard drive or RAM. Memory 101 may also be an external storage device of the electronic device, such as a plug-in hard drive, smart media card (SMC), secure digital card (SD), flash card, etc. Furthermore, memory 101 may include both internal and external storage units. Memory 101 is used to store computer programs and other programs and data required by the terminal. Memory 101 can also be used to temporarily store data that has been output or will be output.

[0069] Those skilled in the art will understand that Figure 5 The block diagram shown is merely a partial structural diagram related to the present invention and does not constitute a limitation on the terminal to which the present invention is applied. A specific terminal may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0070] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, operational databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual operating data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0071] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for generating and intelligently arranging picture frames based on AI, characterized in that, The method includes: A PNG image is exported from a DWG drawing. Content recognition and reasoning are performed on the PNG image based on an object detection model to output several rectangular bounding boxes. These rectangular bounding boxes are then mapped back to the DWG drawing to obtain several actual content rectangular regions covered by the rectangular bounding boxes. The object detection model is trained based on the YOLO model. Based on several actual content rectangular areas and a preset standard data table of drawing frame dimensions, several target drawing frames are determined and automatically inserted into the DWG drawing. After insertion, several target frames are subjected to avoidance and alignment optimization to achieve automatic generation and intelligent arrangement of target frames; Based on several actual content rectangular areas and a preset standard data table of drawing frame dimensions, several target drawing frames are determined, including: Several actual content rectangular areas are matched sequentially with the standard data table of drawing frame size to determine the drawing sheet corresponding to each actual content rectangular area. The standard data table of drawing frame size includes the outer frame size, inner frame size, margin parameters, and maximum range of the inner frame under the matching scale for different drawing sheets. The standard data table of drawing frame size has a clear structure, supports quick retrieval by drawing sheet number, and automatically adapts to the scale and output requirements of the current drawing. Based on the map area, several target map frames are determined; After insertion, several target frames are subjected to avoidance and alignment optimization processing to achieve automatic generation and intelligent arrangement of target frames, including: After insertion, the target frames are divided into rows and columns, and each target frame is assigned a unique row and column identifier to achieve row and column numbering and obtain the spatial grid index. Based on the spatial grid index, all target frames are grouped by row and by column respectively to obtain frame row groups and frame column groups; Based on the frame row group and frame column group, avoidance and alignment optimization are performed; After inserting several target frames, perform row and column splitting to obtain a spatial grid index, including: Extract the Y-coordinate values ​​of the center points of each inserted target frame and sort them in ascending order. Use the average height of all target frames as the row height threshold, and perform row-by-row processing on the inserted target frames based on the row height threshold. Extract the X-coordinate values ​​of the center points of each inserted target frame and sort them in ascending order. Use the average width of all target frames as the column width threshold, and then perform column splitting on the inserted target frames based on the column width threshold. Based on the frame row group and frame column group, avoidance and alignment optimization processes are performed, including: Based on the frame row group, for all target frames in each row, with the row center line as the reference, the target frames located to the left of the row center point are shifted to the left and the target frames located to the right of the row center point are shifted to the right to achieve horizontal avoidance. Based on the frame column group, for all target frames in each column, with the column center line as the reference, the target frames above the column center point are shifted upwards and their positions are adjusted, and the target frames below the column center point are shifted downwards and their positions are adjusted, so as to achieve vertical avoidance. Based on the frame row group, for all target frames in each row, extract the Y coordinate of the insertion point of each target frame, determine the minimum and maximum values ​​of the Y coordinate of each row and calculate the average value of the Y coordinate, and uniformly adjust the Y coordinate of the insertion points of all target frames in each row to the average value of the Y coordinate of that row to achieve horizontal alignment within the row; Based on the frame column group, for all target frames in each column, the X coordinate of the insertion point of each target frame is extracted, the minimum and maximum values ​​of the X coordinate of each column are determined and the average value of the X coordinate is calculated, and the X coordinates of the insertion points of all target frames in each column are uniformly adjusted to the average value of the X coordinate of that column to achieve vertical alignment within the column.

2. The AI-based frame generation and intelligent arrangement method according to claim 1, characterized in that, Mapping the aforementioned rectangular bounding boxes onto a DWG drawing yields several actual content rectangular regions covered by the rectangular bounding boxes, including: The rectangular bounding boxes are mapped to a DWG drawing, and the overlapping parts of the rectangular bounding boxes are merged to obtain the merged rectangular bounding boxes. Based on the merged rectangular bounding boxes, several minimum bounding boxes covering the actual elements in the DWG drawing are obtained, and several actual content rectangular regions are obtained based on these minimum bounding boxes.

3. An AI-based frame generation and intelligent layout system, characterized in that, The system is used to implement the steps of the AI-based frame generation and intelligent arrangement method according to any one of claims 1-2, and the system includes: The reasoning and mapping module is used to export PNG images based on DWG drawings, perform content recognition and reasoning on the PNG images based on the object detection model, output several rectangular bounding boxes, and map the several rectangular bounding boxes to the DWG drawings to obtain several actual content rectangular regions covered by the rectangular bounding boxes. The object detection model is trained based on the YOLO model. The title block determination module is used to determine several target title blocks based on several actual content rectangular areas and a preset title block size standard data table, and automatically insert the target title blocks into the DWG drawing; The intelligent layout module is used to perform avoidance and alignment optimization on several inserted target frames, so as to realize the automatic generation and intelligent layout of target frames.

4. A terminal, characterized in that, The terminal includes a memory, a processor, and an AI-based frame generation and intelligent layout program stored in the memory and executable on the processor. When the processor executes the AI-based frame generation and intelligent layout program, it implements the steps of the AI-based frame generation and intelligent layout method as described in any one of claims 1-2.

5. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores an AI-based frame generation and intelligent layout program, which implements the steps of the AI-based frame generation and intelligent layout method as described in any one of claims 1-2 on the computer-readable storage medium.

Citation Information

Patent Citations

  • Method, system and device for inserting picture frame and storage medium

    CN111739119A

  • CAD file auxiliary processing method and system for air conditioner industry

    CN115146327A

  • Drawing generation method and device, electronic equipment and storage medium

    CN116363255A

  • Space identification method and system based on YOLO model, terminal and medium

    CN120997866A