Method, device and equipment for generating two-dimensional sketch of ship grillage based on image generation type model
Through the method based on the image generation model, the ship mount structure is generated and adjusted, which solves the shortcomings of traditional CAD software in the diversified needs and adjustment process, and achieves efficient and accurate mount structure generation and adjustment.
Patent Information
- Application Number
- CN202411776521.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-03-25
AI Technical Summary
When traditional CAD software generates and adjusts the structure of ship mounts, it is difficult to meet diverse needs. The adjustment process is cumbersome, time-consuming and prone to parameter errors.
Using an image generation model method, a literary picture data set is constructed by collecting board rack sketches, SD fine-tuning model is trained, target board rack sketches are generated, and CAD modeling instructions are obtained through structure recognition and transformation to generate the target board rack internal structure.
The batch generation of the target board frame internal structure is realized, which improves the selectivity and efficiency of drawing, and reduces the time and error rate of manual adjustment.
Smart Images

Figure CN119691900A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of image generation model and image recognition, and in particular to a method, device and equipment for generating a two-dimensional sketch of a ship frame based on an image generation model. Background Art
[0002] CAD ship frame refers to the use of CAD software to draw and design ship frame structures in ship design. Ship frame structures mainly include several main types such as bottom frame, side frame, deck frame and bulkhead frame. The structures of various parts of the ship are usually composed of plates and profiles combined and firmly connected according to certain structural requirements. This plane structure of various parts of the hull composed of plates and profiles is called frame structure. Bottom frame structure, side frame structure, deck frame structure and bulkhead frame structure are the main types of hull frame structures. CAD technology is widely used in ship design. It can help designers to make accurate drawings and calculations, and improve design efficiency and accuracy. Through CAD software, designers can easily import lines, calculate rib positions, and conduct various structural analyses to ensure the rationality and safety of the design.
[0003] Plate frame modeling can be generated through CAD software, but only one plate frame modeling can be generated at a time. The requirements for ship frame structures are diverse, and the modeling needs to be adjusted frequently. The traditional adjustment method relies on manual adjustment by designers, and can only meet a single adjustment requirement. When there are many adjustment requirements, multiple repeated modeling is required, which consumes a lot of time and energy. In addition, the adjusted plate frame modeling is difficult to meet multiple requirements, and parameter errors are prone to occur, which is insufficient. Summary of the invention
[0004] (I) Purpose of the invention
[0005] In order to solve the technical problems existing in the background technology, the present invention proposes a method, device and equipment for generating a two-dimensional sketch of a ship frame based on an image generation model, which has the characteristics of batch generating the internal structure of the target frame and improving the number of drawing options.
[0006] (II) Technical solution
[0007] In order to solve the above technical problems, the present invention provides a method for generating a two-dimensional sketch of a ship frame based on an image generation model, comprising:
[0008] Collect the board frame sketches to build a Wensheng image dataset, which includes board frame images and corresponding prompt word description files and feature point coordinates;
[0009] Train the SD fine-tuning model, build a prediction workflow for the Wensheng map, deploy the trained model on the prediction workflow, and implement the local redrawing task;
[0010] Obtain the frame context modeling in the CAD software, convert the frame context modeling features into corresponding target prompt words, and extract the target feature point coordinates;
[0011] Draw the context modeling image on a blank canvas and mark the redrawn region mask image to assist SD fine-tuning model reasoning;
[0012] The context modeling image, the labeled redrawn region mask image, and the target cue word are input into the prediction workflow deployed by the SD fine-tuning model to generate the target board sketch;
[0013] Identify, match and convert the generated target frame sketch, and determine the redrawn part after threshold confirmation with the input context modeling image;
[0014] Perform structural recognition, matching and conversion on the redrawn part, extract the coordinates of the structural feature points of the redrawn part, match them with the coordinates of the target feature points, set them according to the rules and constraints of the panel design to obtain the target structure modeling, and convert them into CAD modeling instructions;
[0015] Call the CAD modeling command to generate the internal structure of the target board frame in CAD.
[0016] Preferably, the prompt word description file corresponding to the rack image includes:
[0017] Subject description: the position, details, color, material and subject movement of the board frame;
[0018] Feature description: describes the size ratio, resolution, and shape of the image.
[0019] In the Wensheng diagram dataset, the feature point coordinates are the endpoint coordinates of the inner reinforcement of the panel frame.
[0020] Preferably, in the SD fine-tuning model training, the base models include SD1.5, SDXL and Flux, the training methods include full fine-tuning and Lora fine-tuning, and the training data source is the Wenshengtu dataset;
[0021] The prediction workflow is a Wenshengtu image processing workflow, and the trained model is deployed on the prediction workflow to complete the model deployment.
[0022] The steps of drawing the context modeling image and marking the redrawing region mask image also include:
[0023] The redraw area mask image is a black area, which is used to identify the part that needs to be modified or redrawn;
[0024] In image processing, the target redrawing area is marked according to the requirements, and the boundary pixels and thresholds of the mask image are recorded.
[0025] Preferably, identifying, matching and converting the generated target frame sketch further comprises:
[0026] Perform boundary recognition between the generated target board sketch and the input context modeling image to confirm whether they are the same except for the redrawn area;
[0027] The generated target frame sketch is matched and compared with the input context modeling image to preliminarily confirm the redrawn part corresponding to the redrawn area mask;
[0028] The preliminarily confirmed redrawn part is converted, and the converted data is subjected to pixel difference calculation and threshold filtering to confirm whether the difference meets the threshold requirement. The part where the difference exceeds the threshold is identified as the final redrawn part.
[0029] Preferably, the target rack sketch is generated as at least one until the final redrawn portion meets the threshold requirement;
[0030] When there are multiple target plate frame sketches, multiple final redrawn parts that meet the threshold requirements are sorted according to the threshold size, and the redrawn parts are screened according to the structure recognition and matching by performing structure recognition, matching and transformation to obtain the best target structure modeling.
[0031] Preferably, the steps of structurally identifying, matching and converting the redrawn part further include:
[0032] Extract and redraw the coordinates of the structural feature points, match them with the target feature point coordinates, set them according to the rules and constraints of the panel design to obtain the target structure modeling, and convert them into CAD modeling instructions;
[0033] Through traditional image recognition algorithms such as Hough transform, structures such as straight lines and circular holes can be recognized. For duplicate structural styles, deep learning algorithms such as Yo Lo are used for target recognition to extract the coordinates of the recognized structural feature points.
[0034] The extracted and identified structural feature point coordinates are matched with the context target feature point coordinates, set according to the rules and constraints of the panel design, filtered and adjusted based on the rules of collision detection between structures, constraint distance, standard aperture of lightening holes, etc., to obtain the target structure modeling;
[0035] The acquired target structure model is converted into CAD modeling instructions.
[0036] The present invention also provides a two-dimensional sketch generation device for a ship frame based on an image generation model, comprising: a collection module, a training deployment module, a target acquisition module, a target drawing module, a reasoning redrawing module, a frame sketch preprocessing module, a redrawing structure processing module and a generation module;
[0037] A collection module collects the board frame sketches to construct a Wensheng image dataset, which includes the board frame image and the corresponding prompt word description file and feature point coordinates;
[0038] Train the deployment module, train the SD fine-tuning model, build a prediction workflow for the text map, deploy the trained model on the prediction workflow, and implement the local redrawing task;
[0039] The target acquisition module acquires the frame context modeling in the CAD software, converts the frame context modeling features into corresponding target prompt words, and extracts the target feature point coordinates;
[0040] The target drawing module draws the context modeling image on a blank canvas and marks the redrawn area mask image to assist the SD fine-tuning model reasoning;
[0041] The inference redrawing module inputs the context modeling image, the labeled redrawing region mask image, and the target prompt word into the prediction workflow deployed by the SD fine-tuning model to generate the target board sketch;
[0042] The board sketch preprocessing module recognizes, matches and converts the generated target board sketch, and determines the redrawn part after threshold confirmation with the input context modeling image;
[0043] The redrawing structure processing module performs structural recognition, matching and conversion on the redrawn part, extracts the coordinates of the structural feature points of the redrawn part, matches them with the coordinates of the target feature points, and sets the target structure modeling according to the rules and constraints of the plate frame design, and converts them into CAD modeling instructions;
[0044] Generate modules and call CAD modeling commands to generate the internal structure of the target frame in CAD.
[0045] The present invention also provides a two-dimensional sketch generation device for a ship frame based on an image generation model, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in any one of claims 1 to 8 when executing the program.
[0046] The above-mentioned technical scheme of the present invention has the following beneficial technical effects: a model capable of image generation is trained based on a massive amount of Vincent image data sets. When the panel frame needs to be adjusted, multiple target panel frame sketches can be generated in the model according to the conversion of the initial modeling image-Vencent image data-target panel frame sketch. Multiple qualified structural modeling is obtained through step-by-step processing of the target panel frame sketch. The CAD modeling instruction conversion of the target structure modeling is performed under the premise of meeting the process requirements, which improves the convenience of changing the CAD panel frame model and increases the selectivity of changing the CAD panel frame model. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a schematic diagram of the method of the present invention;
[0048] Figure 2 It is a schematic diagram of the process of the present invention. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present invention. In addition, in the following description, the description of well-known structures and technologies is omitted to avoid unnecessary confusion of the concept of the present invention.
[0050] like Figure 1 As shown, the present invention proposes a method for generating a two-dimensional sketch of a ship frame based on an image generation model, comprising the following steps:
[0051] S101, collecting the board frame sketch to construct a Wensheng image dataset, where the Wensheng image dataset includes the board frame image and the corresponding prompt word description file and feature point coordinates;
[0052] Among them, the prompt word description file corresponding to the rack image includes:
[0053] Subject description: the position, details, color, material and subject movement of the board frame;
[0054] Feature description: describes the size ratio, resolution, and shape of the image;
[0055] The prompt word description file corresponding to the plate frame image helps the SD fine-tuning model to better understand the structure and behavior of the ship plate frame, so as to perform simulation and prediction.
[0056] It should be noted that in the Wensheng map data set, the feature point coordinates are the endpoint coordinates of the frame context ribs. The frame structure boundary can be confirmed by the endpoint coordinates of the frame context ribs, and the part of the frame that needs to be adjusted can be limited to the initial endpoint coordinates.
[0057] S102, training the SD fine-tuning model, building a prediction workflow for the Wensheng map, deploying the trained model on the prediction workflow, and implementing the local redrawing task;
[0058] Among them, in the SD fine-tuning model training, the SD fine-tuning model is an image generation model based on the SD1.5, SDXL and Flux models, which is mainly used to convert text descriptions into images. Its training methods include full fine-tuning and Lora fine-tuning, and its training data source is the Wenshengtu dataset;
[0059] The prediction workflow is a Wenshengtu image processing workflow. The trained model is deployed on the prediction workflow to complete the model deployment and perform the local redrawing task of the target frame.
[0060] Take the simulation of partial redrawing as an example: the rack image and the corresponding prompt word description file and feature point coordinates are input into the prediction workflow to generate a redrawn simulated rack image, where the simulated rack image includes the redrawn part.
[0061] S103, obtaining the frame context modeling in the CAD software, converting the frame context modeling features into corresponding target prompt words, and extracting the target feature point coordinates;
[0062] The step of drawing the context modeling image and marking the redrawing area mask image further includes:
[0063] The redraw area mask image is a black area, which is used to identify the part that needs to be modified or redrawn;
[0064] In image processing, the target redrawing area is marked as required, and the boundary pixels and thresholds of the mask image are recorded for pixel difference calculation and threshold filtering in subsequent steps.
[0065] S104, drawing a context modeling image on a blank canvas and marking a redrawn region mask image to assist SD fine-tuning model reasoning;
[0066] S105, inputting the context modeling image, the marked redrawn region mask image and the target prompt word into the prediction workflow deployed by the SD fine-tuning model to generate a target plate frame sketch;
[0067] The step of generating a target rack sketch is achieved through a prediction workflow of a context modeling image, a labeled redrawn area mask image, a target prompt word, and a trained and deployed SD fine-tuning model, and at least one target rack sketch is generated according to the target prompt word.
[0068] S106, identifying, matching and converting the generated target frame sketch, and determining the redrawn part after performing threshold verification with the input context modeling image;
[0069] Recognition, matching and conversion of the generated target board sketch also include:
[0070] Perform boundary recognition between the generated target board sketch and the input context modeling image to confirm whether they are the same except for the redrawn area;
[0071] The generated target frame sketch is matched and compared with the input context modeling image to preliminarily confirm the redrawn part corresponding to the redrawn area mask;
[0072] The preliminarily confirmed redrawn part is converted, and the converted data is subjected to pixel difference calculation and threshold filtering to confirm whether the difference meets the threshold requirement. The part where the difference exceeds the threshold is identified as the final redrawn part.
[0073] It is understood that the target board frame sketch is generated as at least one until the final redrawing part meets the threshold requirement;
[0074] When there are multiple target frame sketches, multiple final redrawn parts that meet the threshold requirements are sorted according to the threshold size, and the redrawn parts are screened according to the structure recognition and matching to obtain the best target structure modeling by performing structure recognition, matching and conversion on the redrawn parts;
[0075] The coordinates of the boundary feature points of the redrawn part of the target frame sketch should be close to the coordinates of the initial feature points, so similarity matching can be performed through the boundary.
[0076] S107, perform structural recognition, matching and conversion on the redrawn part, extract the coordinates of the structural feature points of the redrawn part, match them with the coordinates of the target feature points, set them according to the rules and constraints of the panel design to obtain the target structure modeling, and convert them into CAD modeling instructions;
[0077] The steps of structural recognition, matching and conversion of the redrawn part also include:
[0078] Extract and redraw the coordinates of the structural feature points, match them with the target feature point coordinates, set them according to the rules and constraints of the panel design to obtain the target structure modeling, and convert them into CAD modeling instructions;
[0079] Through traditional image recognition algorithms such as Hough transform, structures such as straight lines and circular holes can be recognized. For duplicate structural styles, deep learning algorithms such as Yo Lo are used for target recognition to extract the coordinates of the recognized structural feature points.
[0080] The extracted and identified structural feature point coordinates are matched with the context target feature point coordinates, set according to the rules and constraints of the panel design, filtered and adjusted based on the rules of collision detection between structures, constraint distance, standard aperture of lightening holes, etc., to obtain the target structure modeling;
[0081] The acquired target structure model is converted into CAD modeling instructions.
[0082] Among them, when there are multiple target panel frame sketches, there are also multiple redrawn parts that meet the threshold requirements. At this time, in the collection of redrawn part structures that meet the threshold requirements, the structural feature point coordinates corresponding to each special point are matched with the initial feature point coordinates, and separate rules and constraints and other restriction conditions are set for each feature point coordinate. The coordinates of each structural feature point are traversed and compounded with the initial feature point coordinates. The qualified structure modeling meets all the requirements, and the appropriate target structure modeling can be selected from the qualified structure modeling for the conversion of CAD modeling commands.
[0083] S108, calling a CAD modeling command to generate the internal structure of the target panel rack in CAD.
[0084] In this embodiment, a model capable of image generation is trained based on a massive amount of Wensheng image data sets. When the panel frame needs to be adjusted, multiple target panel frame sketches can be generated in the model based on the conversion of initial modeling image-Wensheng image data-target panel frame sketch. Through step-by-step processing of the target panel frame sketch, multiple qualified structural modeling is obtained, and CAD modeling instruction conversion of target structure modeling is performed under the premise of meeting process requirements, which improves the convenience of changing the CAD panel frame model and increases the selectivity of changing the CAD panel frame model.
[0085] A ship frame two-dimensional sketch generation device based on an image generation model, comprising: a collection module, a training deployment module, a target acquisition module, a target drawing module, a reasoning redrawing module, a frame sketch preprocessing module, a redrawing structure processing module and a generation module;
[0086] A collection module collects the board frame sketches to construct a Wensheng image dataset, which includes the board frame image and the corresponding prompt word description file and feature point coordinates;
[0087] Train the deployment module, train the SD fine-tuning model, build a prediction workflow for the text map, deploy the trained model on the prediction workflow, and implement the local redrawing task;
[0088] The target acquisition module acquires the frame context modeling in the CAD software, converts the frame context modeling features into corresponding target prompt words, and extracts the target feature point coordinates;
[0089] The target drawing module draws the context modeling image on a blank canvas and marks the redrawn area mask image to assist the SD fine-tuning model reasoning;
[0090] The inference redrawing module inputs the context modeling image, the labeled redrawing region mask image, and the target prompt word into the prediction workflow deployed by the SD fine-tuning model to generate the target board sketch;
[0091] The board sketch preprocessing module recognizes, matches and converts the generated target board sketch, and determines the redrawn part after threshold confirmation with the input context modeling image;
[0092] The redrawing structure processing module performs structural recognition, matching and conversion on the redrawn part, extracts the coordinates of the structural feature points of the redrawn part, matches them with the coordinates of the target feature points, and sets the target structure modeling according to the rules and constraints of the plate frame design, and converts them into CAD modeling instructions;
[0093] Generate modules and call CAD modeling commands to generate the internal structure of the target frame in CAD.
[0094] A device for generating a two-dimensional sketch of a ship frame based on an image generation model, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, steps of a method for generating a two-dimensional sketch of a ship frame based on an image generation model are implemented.
[0095] It should be understood that the above specific embodiments of the present invention are only used to illustrate or explain the principles of the present invention, and do not constitute a limitation of the present invention. Therefore, any modifications, equivalent substitutions, improvements, etc. made without departing from the spirit and scope of the present invention should be included in the protection scope of the present invention. In addition, the appended claims of the present invention are intended to cover all changes and modifications that fall within the scope and boundaries of the appended claims, or the equivalent forms of such scope and boundaries.
Claims
1. A method for generating a two-dimensional sketch of a ship frame based on an image generation model, characterized in that: include: Collect the board frame sketches to build a Wensheng image dataset, which includes board frame images and corresponding prompt word description files and feature point coordinates; Train the SD fine-tuning model, build a prediction workflow for the Wensheng map, deploy the trained model on the prediction workflow, and implement the local redrawing task; Obtain the frame context modeling in the CAD software, convert the frame context modeling features into corresponding target prompt words, and extract the target feature point coordinates; Draw the context modeling image on a blank canvas and mark the redrawn region mask image to assist SD fine-tuning model reasoning; The context modeling image, the labeled redrawn region mask image, and the target cue word are input into the prediction workflow deployed by the SD fine-tuning model to generate the target board sketch; Identify, match and convert the generated target frame sketch, and determine the redrawn part after threshold confirmation with the input context modeling image; Perform structural recognition, matching and conversion on the redrawn part, extract the coordinates of the structural feature points of the redrawn part, match them with the coordinates of the target feature points, set them according to the rules and constraints of the panel design to obtain the target structure modeling, and convert them into CAD modeling instructions; Call the CAD modeling command to generate the internal structure of the target board frame in CAD.
2. The method for generating a two-dimensional sketch of a ship frame based on an image generation model according to claim 1, characterized in that: The prompt word description files corresponding to the rack image include: Subject description: the position, details, color, material and subject movement of the board frame; Feature description: describes the size ratio, resolution, and shape of the image.
3. The method for generating a two-dimensional sketch of a ship frame based on an image generation model according to claim 1, characterized in that: In the Wensheng diagram dataset, the feature point coordinates are the end point coordinates of the reinforcement inside the panel frame.
4. The method for generating a two-dimensional sketch of a ship frame based on an image generation model according to claim 1, characterized in that: In the SD fine-tuning model training, the base models include SD1.5, SDXL and Flux, and the training methods include full fine-tuning and Lora fine-tuning. The training data source is the Wenshengtu dataset; The prediction workflow is a Wenshengtu image processing workflow, and the trained model is deployed on the prediction workflow to complete the model deployment.
5. The method for generating a two-dimensional sketch of a ship frame based on an image generation model according to claim 1, characterized in that: The steps of drawing the context modeling image and marking the redrawing region mask image also include: The redraw area mask image is a black area, which is used to identify the part that needs to be modified or redrawn; In image processing, the target redrawing area is marked according to the requirements, and the boundary pixels and thresholds of the mask image are recorded.
6. The method for generating a two-dimensional sketch of a ship frame based on an image generation model according to claim 1, characterized in that: Recognition, matching and conversion of the generated target board sketch also include: Perform boundary recognition between the generated target frame sketch and the input context modeling image to confirm whether they are the same except for the redrawn area; The generated target frame sketch is matched and compared with the input context modeling image to preliminarily confirm the redrawn part corresponding to the redrawn area mask; The preliminarily confirmed redrawn part is converted, and the converted data is subjected to pixel difference calculation and threshold filtering to confirm whether the difference meets the threshold requirement. The part where the difference exceeds the threshold is identified as the final redrawn part.
7. The method for generating a two-dimensional sketch of a ship frame based on an image generation model according to claim 1, characterized in that: The target board frame sketch is generated to be at least one until the final redrawn part meets the threshold requirement; When there are multiple target plate frame sketches, multiple final redrawn parts that meet the threshold requirements are sorted according to the threshold size, and the redrawn parts are screened according to the structure recognition and matching by performing structure recognition, matching and transformation to obtain the best target structure modeling.
8. The method for generating a two-dimensional sketch of a ship frame based on an image generation model according to claim 1, characterized in that: The steps of structural recognition, matching and conversion of the redrawn part also include: Extract and redraw the coordinates of the structural feature points, match them with the target feature point coordinates, set them according to the rules and constraints of the panel design to obtain the target structure modeling, and convert them into CAD modeling instructions; The recognition of structures such as straight lines and circular holes is achieved through traditional image recognition algorithms such as Hough transform. For duplicate structural styles, deep learning algorithms such as YOLO are used for target recognition to extract the coordinates of the identified structural feature points. The extracted and identified structural feature point coordinates are matched with the context target feature point coordinates, set according to the rules and constraints of the panel design, filtered and adjusted based on the rules of collision detection between structures, constraint distance, standard aperture of lightening holes, etc., to obtain the target structure modeling; The acquired target structure model is converted into CAD modeling instructions.
9. A device for generating a two-dimensional sketch of a ship frame based on an image generation model, characterized in that: include: Collection module, training deployment module, target acquisition module, target drawing module, reasoning redrawing module, board sketch preprocessing module, redrawing structure processing module and generation module; A collection module collects the board frame sketches to construct a Wensheng image dataset, which includes the board frame image and the corresponding prompt word description file and feature point coordinates; Train the deployment module, train the SD fine-tuning model, build a prediction workflow for the text map, deploy the trained model on the prediction workflow, and implement the local redrawing task; The target acquisition module acquires the frame context modeling in the CAD software, converts the frame context modeling features into corresponding target prompt words, and extracts the target feature point coordinates; The target drawing module draws the context modeling image on a blank canvas and marks the redrawn area mask image to assist the SD fine-tuning model reasoning; The inference redrawing module inputs the context modeling image, the labeled redrawing region mask image, and the target prompt word into the prediction workflow deployed by the SD fine-tuning model to generate the target board sketch; The board sketch preprocessing module recognizes, matches and converts the generated target board sketch, and determines the redrawn part after threshold confirmation with the input context modeling image; The redrawing structure processing module performs structural recognition, matching and conversion on the redrawn part, extracts the coordinates of the structural feature points of the redrawn part, matches them with the coordinates of the target feature points, and sets the target structure modeling according to the rules and constraints of the plate frame design, and converts them into CAD modeling instructions; Generate modules and call CAD modeling commands to generate the internal structure of the target frame in CAD.
10. A device for generating a two-dimensional sketch of a ship frame based on an image generation model, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 8 when executing the program.