Method and device for generating picture according to commodity view angle, equipment and medium

By combining cutout, image processing and Controlnet model, a stable product background image is generated, which solves the problems of background instability and mismatch in the prior art, and improves the practicality and usage rate of generated images.

CN120070624APending Publication Date: 2025-05-30ZIXUN TECHNOLOGY (FUJIAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510108244.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

In the prior art, the product image with set background is not stable enough, which can easily lead to the product image hanging or the scene image generated is not suitable for placing the product. It is necessary to generate it repeatedly to obtain a better combination effect.

Method used

The main image of the product is obtained by cutting the image, and the image with a gray background is obtained. The image is processed using the Depth and Lineart algorithms, and the product plan and final result image are generated through Controlnet and diffusion models to improve the stability of the generated background.

Benefits of technology

It greatly improves the stability of the generated background, solves the problem of mismatch between the product and the background, makes the generated pictures closer to the actual scene, and increases the usage rate of the pictures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120070624A_ABST
    Figure CN120070624A_ABST
Patent Text Reader

Abstract

The invention provides a method and device for generating a picture according to a commodity view angle, equipment and a medium, and the method comprises the steps: carrying out the matting of a commodity picture, and obtaining a commodity main body picture; processing the commodity main body picture to obtain a first grey bottom picture with a grey bottom as a background; processing the first grey base image to obtain a first depth image; processing the first grey base map to obtain a first line draft map; transmitting the first depth image and the first line draft image into Controlnet, and then drawing through a diffusion model to generate a commodity planar graph; processing the generated commodity plane graph through a depth algorithm to obtain a second depth image; processing the commodity grey base map through a lineart algorithm to obtain a second line draft map; and the second depth image and the second line draft image are sent to the Controlnet, then drawing is carried out through a diffusion model, a result image is generated, picture generation can be carried out according to the view angle of the commodity, and the generated picture is closer to reality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of generating pictures, and particularly relates to a method, device, equipment and medium for generating pictures according to the perspective of a commodity. Background Art

[0002] In the prior art, commodity pictures with a set background are generated by using StableDiffusion, and StableDiffusion generates a corresponding background picture by combining an inpaint model and a prompt; the inpaint model is used for picture restoration, and the prompt is written by technicians. The disadvantage of this method is that the generated scene pictures are often not stable enough, and it is easy to cause the commodity picture to be suspended or the generated scene picture to be inappropriate for placing the commodity. Only by repeatedly generating can pictures with a relatively good combination of the commodity and the background be obtained. Summary of the Invention

[0003] The technical problem to be solved by the present invention is to provide a method, device, equipment and medium for generating pictures according to the perspective of a commodity, which can adapt to the perspective of the commodity to generate pictures, make the generated pictures closer to reality, and facilitate direct use by users.

[0004] In a first aspect, the present invention provides a method for generating pictures according to the perspective of a commodity, including the following steps:

[0005] Step 1: Cut out the commodity picture to obtain the main commodity picture;

[0006] Step 2: Process the main commodity picture to obtain a first gray-bottom picture with a gray background;

[0007] Step 3: Process the first gray-bottom picture through the Depth algorithm to obtain a first depth image; process the first gray-bottom picture through the Lineart algorithm to obtain a first line drawing;

[0008] Step 4: Input the first depth image and the first line drawing into ControlNet, set the redrawing amplitude to 0.85, and set the reference weights of the lineart module and the depth module in ControlNet to 0.5 and 0.6 respectively, and then draw through a diffusion model to generate a commodity floor plan;

[0009] Step 5: Process the generated commodity floor plan through the depth algorithm to obtain a second depth image; process the commodity gray-bottom picture through the lineart algorithm to obtain a second line drawing;

[0010] Step 6: Send the second depth image and the second line drawing to ControlNet respectively, set the redrawing amplitude to 1.0, set the reference weights of the lineart module and the depth module in ControlNet to 0.45 and 0.55 respectively, and then perform drawing through the diffusion model to generate the result image.

[0011] In a second aspect, the present invention provides an apparatus for generating pictures according to the perspective of a commodity, including:

[0012] An object acquisition module that performs matte extraction on the commodity image to obtain the commodity object image;

[0013] A background setting module that processes the commodity object image to obtain a first gray background image with a gray background;

[0014] A first guidance acquisition module that processes the first gray background image through the Depth algorithm to obtain a first depth image; the first gray background image is processed through the Lineart algorithm to obtain a first line drawing;

[0015] A generated guidance module that inputs the first depth image and the first line drawing into ControlNet, sets the redrawing amplitude to 0.85, and sets the reference weights of the lineart module and the depth module in ControlNet to 0.5 and 0.6 respectively, and then performs drawing through the diffusion model to generate a commodity plan view;

[0016] A second guidance acquisition module that processes the generated commodity plan view through the depth algorithm to obtain a second depth image; processes the commodity gray background image through the lineart algorithm to obtain a second line drawing;

[0017] A result generation module that sends the second depth image and the second line drawing to ControlNet respectively, sets the redrawing amplitude to 1.0, sets the reference weights of the lineart module and the depth module in ControlNet to 0.45 and 0.55 respectively, and then performs drawing through the diffusion model to generate the result image.

[0018] In a third aspect, the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, it implements the method described in the first aspect.

[0019] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the method described in the first aspect.

[0020] One or more technical solutions provided by the present invention have at least the following technical effects or advantages:

[0021] The present invention can significantly improve the stability of the generated background and effectively solve the problem of mismatch between the commodity and the background during the generation process;

[0022] According to the actual angle of the commodity main body, the present invention makes the combination of the commodity and the background more natural during the process of image generation, so that the generated image is closer to the actual scene, and the utilization rate of the generated image is improved.

[0023] The above description is only an overview of the technical solution of the present invention. In order to understand the technical means of the present invention more clearly, it can be implemented according to the content of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and understandable, the specific embodiments of the present invention are given below. Brief Description of the Drawings

[0024] The present invention will be further described below with reference to the accompanying drawings in conjunction with the embodiments.

[0025] Figure 1 It is a flowchart of the method in the first embodiment of the present invention;

[0026] Figure 2 It is a structural schematic diagram of the device in the second embodiment of the present invention. Detailed Embodiments

[0027] The overall idea of the technical solution in the embodiments of the present application is as follows:

[0028] ControlNet is a control generation network in the Stable Diffusion diffusion model, which is used to guide the StableDiffusion diffusion model to generate corresponding images;

[0029] BiRefNet is a high-resolution image segmentation framework based on deep learning, which is often used to segment commodity images and backgrounds;

[0030] The composition plugins in the plugins of ControlNet include canny, Depth, Normal, openpose, etc. The functions of these plugins are mainly to set and constrain the style of the image, and are used to control the generation of more image details.

[0031] The algorithm is mainly implemented as follows:

[0032] (1) Through BiRefNet for image matting, the commodity image is matted to obtain a transparent image, and the synthesized area is marked in this way. After that, only the background of the commodity image is processed;

[0033] (2) The transparent image is composited with a grayscale image with a grayscale value of 127, and the background of the transparent image is filled with gray to obtain a commodity with a gray background Figure 2 ;

[0034] (3) Scale the product with a gray background Figure 2 to a resolution of 640*640 to obtain a product with a gray background Figure 1 ;

[0035] (4) Process the product with a gray background Figure 1 through the depth algorithm and the lineart algorithm to obtain depth image 1 and lineart image 1;

[0036] (5) Send depth image 1 and the lineart image to contronet respectively, set the redrawing amplitude to 0.85, set the reference weights of the lineart module and the depth module in contronet to 0.5 and 0.6 respectively, and guide the Stable Diffusion diffusion model to draw and generate a product floor plan. According to the actual needs of the user, a set prompt word can be input into the Stable Diffusion diffusion model, or it can be not input;

[0037] (6) Process the generated product floor plan through the depth algorithm to obtain depth image 2;

[0038] (7) Process the product with a gray background Figure 2 through the lineart algorithm to obtain lineart image 1;

[0039] (8) Send depth image 2 and lineart image 2 to controlnet respectively, set the redrawing amplitude to 1.0, set the reference weights of the lineart module and depth in controlnet to 0.45 and 0.55 respectively, and guide the StableDiffusion diffusion model to draw and produce the final required result image. According to the actual needs of the user, a set prompt word can be input into the Stable Diffusion diffusion model, or it can be not input.

[0040] Example 1

[0041] As Figure 1 shown, this example provides a method for generating pictures according to the perspective of the product, including the following steps:

[0042] Step 1: Cut out the product image to obtain the main product image;

[0043] Step 2: Process the main product image to obtain the first gray-bottomed image with a gray background;

[0044] Step 3: Process the first gray-bottomed image through the Depth algorithm to obtain the first depth image; the first gray-bottomed image is processed through the Lineart algorithm to obtain the first line drawing;

[0045] Step 4: Input the first depth image and the first line drawing into ControlNet, set the redrawing amplitude to 0.85, and set the reference weights of the lineart module and the depth module in ControlNet to 0.5 and 0.6 respectively. Then, perform drawing through the diffusion model to generate a product floor plan.

[0046] Step 5: Process the generated product floor plan through the depth algorithm to obtain a second depth image; process the product gray background image through the lineart algorithm to obtain a second line drawing.

[0047] Step 6: Send the second depth image and the second line drawing to ControlNet respectively, set the redrawing amplitude to 1.0, and set the reference weights of the lineart module and the depth module in ControlNet to 0.45 and 0.55 respectively. Then, perform drawing through the diffusion model to generate a result image.

[0048] In this embodiment, preferably, it further includes Step 7: Use the LaMa elimination algorithm to eliminate the redundant products in the result image to obtain a background image without products; perform matte extraction on the result image to obtain a result main body image; perform image synthesis on the result main body image and the background image to obtain a product fitting image; extract the alpha channel of the result main body image to obtain a main body mask image; perform an inversion operation on the main body mask image, then use the feathering algorithm to beautify the edge, and then perform an inversion operation again to obtain a first edge fusion mask image; process the main body mask image through the dilation and erosion algorithm, and then use the feathering algorithm to beautify the edge to obtain a second edge fusion mask image; input the background image, the product fitting image, and the second edge fusion mask image into the fusion algorithm for fusion to obtain a fusion image; input the product fitting image, the fusion image, and the first edge fusion mask image into the fusion algorithm for fusion to obtain a product optimized image. It is shown that through two fusions, the problems of poor edge fusion degree between the generated background and the product main body and redundant edges are effectively solved; the generated image is quickly repaired, greatly improving the effect and efficiency of image processing.

[0049] In this embodiment, preferably, step 1 is specifically as follows: Determine the pixels of the product image. If the pixels of the product image are less than 2000×2000, directly perform the matting operation through the Visual Intelligence Open Platform to obtain the required product main image. If the pixels of the product image are greater than or equal to 2000×2000, use Imgproc.resize in OpenCV with the Imgproc.INTER_LANCZ0S4 algorithm to perform proportional scaling on the product image to obtain a scaled image. Perform the matting operation on the scaled image through the Visual Intelligence Open Platform to obtain the first mask image. Use Imgproc.resize in OpenCV with the Imgproc.INTER_LANCZ0S4 algorithm to proportionally restore the first mask image to the second mask image of the original size. Read the alpha channel of each pixel point in the product image to obtain the first matrix, read the alpha channel of each pixel point in the second mask image to obtain the second matrix, and call Core.min to merge the first matrix and the second matrix to obtain the third matrix. Replace the alpha channel in the product image with the third matrix to obtain the required product main image.

[0050] Due to the matting size limitation of the Alibaba Cloud Visual Intelligence Open Platform, when the longest side exceeds 2000 pixels, proportional scaling is required. Call Imgproc.resize to use the Imgproc.INTER_LANCZOS4 algorithm for image proportional scaling;

[0051] Call Imgproc.resize to use the Imgproc.INTER_LANCZOS4 algorithm for image proportional scaling. This algorithm can reduce the impact of artifacts while maintaining edge sharpness.

[0052] Obtain the matting result according to the black and white image + original image:

[0053] a. Take out the alpha channel of the original image. Call Core.min, which will take the minimum value of the transparency channels of the mask and the original image, ensuring that the original information of the transparency channel is retained. Through this step of processing, the lines of the obtained matting can be made more perfect;

[0054] b. Remove the alpha channel of the original image and add the black and white image as the new alpha channel for layer merging;

[0055] c. Set the color value of the transparent area to black. This step is to reduce the size of the matting result image and save storage costs.

[0056] The core code is as follows:

[0057] / / Create a fully transparent matrix with the same size as the original image for comparison;

[0058] Mat compareAlpha = new Mat(outImg.size(), CvType.CV_8UC1, Scalar.all(0.0));

[0059] / / Used to save the comparison result;

[0060] Mat compareResult = new Mat();

[0061] / / Compare the alpha channel of the original image with alpha. The positions with a value of 0 in the obtained mask are the transparent positions in the original image;

[0062] Core.compare(outPlanes.get(3), compareAlpha, compareResult, Core.CMP_EQ);

[0063] / / Create a completely black matrix with the same size as the original image;

[0064] Mat black = new Mat(outImg.size(), outImg.type(), Scalar.all(0));

[0065] / / Copy the black color in black to the corresponding positions in outImg according to the mask;

[0066] Core.bitwise_and(black, outImg, outImg, compareResult);

[0067] Through the above method, a ready-made image matting software can be directly used for image matting, and the quality of the image can be ensured not to decline.

[0068] In this embodiment, preferably, the specific step 2 is: synthesize the area of the commodity main body map except for the commodity main body part with a grayscale image with a grayscale value of 127 to obtain a commodity gray background map; process the commodity gray background map to obtain a first gray background map with a resolution of 640 * 640.

[0069] Based on the same inventive concept, the present application also provides a device corresponding to the method in Embodiment 1. For details, see Embodiment 2.

[0070] Embodiment 2

[0071] As Figure 2 shown, in this embodiment, a device for generating pictures according to the commodity perspective is provided, including:

[0072] An acquisition main body module, which performs image matting on the commodity image to obtain a commodity main body image;

[0073] Set up a background module to process the main product image to obtain a first gray-background image with a gray background.

[0074] Obtain a first guidance module, process the first gray-background image through the Depth algorithm to obtain a first depth image; process the first gray-background image through the Lineart algorithm to obtain a first line drawing.

[0075] Generate a guidance module, input the first depth image and the first line drawing into Controlnet, set the redrawing amplitude to 0.85, and set the reference weights of the lineart module and the depth module in Controlnet to 0.5 and 0.6 respectively. Then, perform drawing through the diffusion model to generate a product floor plan.

[0076] Obtain a second guidance module, process the generated product floor plan through the depth algorithm to obtain a second depth image; process the product gray-background image through the lineart algorithm to obtain a second line drawing.

[0077] Generate a result module, send the second depth image and the second line drawing to Controlnet respectively, set the redrawing amplitude to 1.0, set the reference weights of the lineart module and the depth module in Controlnet to 0.45 and 0.55 respectively. Then, perform drawing through the diffusion model to generate a result image.

[0078] In this embodiment, preferably, it further includes an optimized result module. Through the LaMa elimination algorithm, eliminate the redundant products in the result image to obtain a background image without products; perform matte extraction on the result image to obtain a result main body image; perform image synthesis on the result main body image and the background image to obtain a product fitting image; extract the alpha channel of the result main body image to obtain a main body mask image; perform an inversion operation on the main body mask image, then perform edge beautification using the feathering algorithm, and then perform an inversion operation again to obtain a first edge fusion mask image; process the main body mask image through the dilation and erosion algorithm, and then perform edge beautification using the feathering algorithm to obtain a second edge fusion mask image; input the background image, the product fitting image, and the second edge fusion mask image into the fusion algorithm for fusion to obtain a fused image; input the product fitting image, the fused image, and the first edge fusion mask image into the fusion algorithm for fusion to obtain an optimized product image.

[0079] In this embodiment, preferably, the obtaining main body module is specifically as follows: judge the pixels of the product image. If the pixels of the product image are less than 2000×2000, directly perform a matting operation through the visual intelligence open platform to obtain the required product main body image. If the pixels of the product image are greater than or equal to 2000×2000, use the Imgproc.resize in OpenCV with the Imgproc.INTER_LANCZ0S4 algorithm to scale the product image proportionally to obtain a scaled image. Perform a matting operation on the scaled image through the visual intelligence open platform to obtain a first mask image. Use the Imgproc.resize in OpenCV with the Imgproc.INTER_LANCZ0S4 algorithm to proportionally restore the first mask image to a second mask image of the original size. Read the alpha channel of each pixel point in the product image to obtain a first matrix, read the alpha channel of each pixel point in the second mask image to obtain a second matrix, and call Core.min to merge the first matrix and the second matrix to obtain a third matrix. Replace the alpha channel in the product image with the third matrix to obtain the required product main body image.

[0080] In this embodiment, preferably, the setting background module is specifically as follows: synthesize the area other than the product main body part in the product main body image with a grayscale image with a grayscale value of 127 to obtain a product grayscale background image. Process the product grayscale background image to obtain a first grayscale background image with a resolution of 640*640.

[0081] Since the device introduced in the second embodiment of the present invention is the device adopted for implementing the method in the first embodiment of the present invention, based on the method introduced in the first embodiment of the present invention, those skilled in the art can understand the specific structure and variations of the device, so it will not be elaborated here. Any device adopted for the method in the first embodiment of the present invention belongs to the scope protected by the present invention.

[0082] Based on the same inventive concept, this application provides an electronic device embodiment corresponding to Embodiment 1. For details, see Embodiment 3.

[0083] Embodiment 3

[0084] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, any implementation manner in Embodiment 1 can be realized.

[0085] Since the electronic device introduced in this embodiment is the device used to implement the method in Embodiment 1 of this application, based on the method introduced in Embodiment 1 of this application, those skilled in the art can understand the specific implementation manners of the electronic device in this embodiment and its various forms of variation. Therefore, the specific implementation of how this electronic device implements the method in the embodiments of this application will not be introduced in detail here. As long as the device used by those skilled in the art to implement the method in the embodiments of this application belongs to the scope protected by this application.

[0086] Based on the same inventive concept, this application provides a storage medium corresponding to Embodiment 1, as detailed in Embodiment 4.

[0087] Embodiment 4

[0088] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, any implementation manner in Embodiment 1 can be implemented.

[0089] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0090] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the processes and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the specified functions in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0091] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured product including an instruction device, and the instruction device implements the specified functions in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0092] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are executed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions for implementing the steps of the function specified in one process or a plurality of processes and / or blocks Figure 1 one process or a plurality of processes and / or blocks Figure 1 in one block or a plurality of blocks.

[0093] Although the specific embodiments of the present invention have been described above, those skilled in the art of this technology should understand that the specific embodiments we described are illustrative only and not used to limit the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should be covered by the scope of protection of the claims of the present invention.

Claims

1. A method for generating an image based on a product perspective, characterized in that: The steps include: Step 1: Cut out the product image to obtain the main image of the product; Step 2: Process the main image of the product to obtain a first gray background image with a gray background; Step 3: Process the first gray background image by using a Depth algorithm to obtain a first depth image; process the first gray background image by using a Lineart algorithm to obtain a first line drawing; Step 4: The first depth image and the first line drawing are passed into Controlnet, the redrawing amplitude is set to 0.85, and the reference weights of the lineart module and the depth module in Controlnet are set to 0.5 and 0.6 respectively. Then, the diffusion model is used for drawing to generate a product plan view. Step 5: Process the generated product plan view through the depth algorithm to obtain a second depth image; process the product gray background image through the lineart algorithm to obtain a second line drawing; Step 6. Send the second depth image and the second line drawing to Controlnet respectively, set the redrawing amplitude to 1.0, set the reference weights of the lineart module and the depth module in Controlnet to 0.45 and 0.55 respectively, and then draw through the diffusion model to generate the result image.

2. The method for generating pictures according to the product perspective according to claim 1, characterized in that: The method also includes step 7, eliminating the extra products in the result image through the LaMa elimination algorithm to obtain a background image without the products; cutting out the result image to obtain a result main image; synthesizing the result main image and the background image to obtain a product fitting image; extracting the alpha channel of the result main image to obtain a main mask image; inverting the main mask image, then using a feathering algorithm to beautify the edges, and then inverting it again to obtain a first edge fusion mask image; processing the main mask image through an expansion and corrosion algorithm, and then beautifying the edges through a feathering algorithm to obtain a second edge fusion mask image; inputting the background image, the product fitting image and the second edge fusion mask image into the fusion algorithm for fusion to obtain a fusion image; inputting the product fitting image, the fusion image and the first edge fusion mask image into the fusion algorithm for fusion to obtain a product optimization image.

3. The method for generating pictures according to the product perspective according to claim 1, characterized in that: The step 1 is specifically as follows: judging the pixels of the product image, if the pixels of the product image are less than 2000×2000, directly performing a cutout operation through the visual intelligence open platform to obtain the required product main body image; if the pixels of the product image are greater than or equal to 2000×2000, using Imgproc.resize in OpenCV and using the Imgproc.INTER_LANCZ0S4 algorithm to scale the product image in proportion to obtain a scaled image; performing a cutout operation on the scaled image through the visual intelligence open platform to obtain a first mask image; using Imgproc.resize in OpenCV and using the Imgproc.INTER_LANCZ0S4 algorithm to proportionally restore the first mask image to a second mask image of the original size; reading out the transparent channel of each pixel in the product image to obtain a first matrix, reading out the transparent channel of each pixel in the second mask image to obtain a second matrix, calling Core.min to merge the first matrix with the second matrix to obtain a third matrix; The transparent channel in the product image is replaced by the third matrix to obtain the desired product main image.

4. The method for generating pictures according to the product viewing angle according to claim 1, characterized in that: The step 2 specifically includes: synthesizing the area of ​​the product main body image except the product main body with a grayscale image with a grayscale value of 127 to obtain a product gray background image; processing the product gray background image to obtain a first gray background image with a resolution of 640*640.

5. A device for generating pictures according to the perspective of a product, characterized in that: include: Get the main module, cut out the product image, and get the main product image; Setting a background module to process the main image of the product to obtain a first gray background image with a gray background; Obtain a first guidance module, process the first gray background image through a Depth algorithm, and obtain a first depth image; The first gray background image is processed by a Lineart algorithm to obtain a first line drawing; Generate a guidance module, pass the first depth image and the first line drawing to Controlnet, set the redrawing amplitude to 0.85, and set the reference weights of the lineart module and the depth module in Controlnet to 0.5 and 0.6 respectively, and then draw through the diffusion model to generate a product plan view; Obtain a second guidance module, process the generated product plan view through a depth algorithm to obtain a second depth image; process the product gray background image through a lineart algorithm to obtain a second line drawing; Generate the result module, send the second depth image and the second line drawing to Controlnet respectively, set the redrawing amplitude to 1.0, set the reference weights of the lineart module and the depth module in Controlnet to 0.45 and 0.55 respectively, and then draw through the diffusion model to generate the result map.

6. The device for generating pictures according to the product viewing angle according to claim 5, characterized in that: The method also includes an optimization result module, which eliminates the extra products in the result image through the LaMa elimination algorithm to obtain a background image without the products; cuts out the result image to obtain a result main image; synthesizes the result main image and the background image to obtain a product fitting image; extracts the alpha channel of the result main image to obtain a main mask image; inverts the main mask image, then uses a feathering algorithm to beautify the edges, and then inverts it again to obtain a first edge fusion mask image; processes the main mask image through an expansion and corrosion algorithm, and then uses a feathering algorithm to beautify the edges to obtain a second edge fusion mask image; inputs the background image, the product fitting image and the second edge fusion mask image into the fusion algorithm for fusion to obtain a fusion image; inputs the product fitting image, the fusion image and the first edge fusion mask image into the fusion algorithm for fusion to obtain a product optimization image.

7. The device for generating pictures according to the product viewing angle according to claim 5, characterized in that: The acquisition main body module is specifically as follows: judging the pixels of the product image, if the pixels of the product image are less than 2000×2000, directly performing a cutout operation through the visual intelligence open platform to obtain the required product main body image; if the pixels of the product image are greater than or equal to 2000×2000, using Imgproc.resize in OpenCV and using the Imgproc.INTER_LANCZ0S4 algorithm to scale the product image in proportion to obtain a scaled image; performing a cutout operation on the scaled image through the visual intelligence open platform to obtain a first mask image; using Imgproc.resize in OpenCV and using the Imgproc.INTER_LANCZ0S4 algorithm to proportionally restore the first mask image to a second mask image of the original size; reading out the transparent channel of each pixel in the product image to obtain a first matrix, reading out the transparent channel of each pixel in the second mask image to obtain a second matrix, calling Core.min to merge the first matrix with the second matrix to obtain a third matrix; The transparent channel in the product image is replaced by the third matrix to obtain the desired product main image.

8. The device for generating pictures according to the perspective of a commodity according to claim 5, characterized in that: The background setting module specifically comprises: synthesizing the area of ​​the product main body image except the product main body with a grayscale image with a grayscale value of 127 to obtain a product gray background image; processing the product gray background image to obtain a first gray background image with a resolution of 640*640.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 4 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.