With AI intelligent painting, I can also become a painting master - the world's largest Chinese cross-modal generation model ERNIE-ViLG

I know nothing about painting, but I also like to watch anime. When I see some beautiful paintings, I would sigh, if only I could draw. Now I finally have the opportunity to help me realize this idea. I accidentally saw AI A new application of AI Painting, which has been very popular recently, fully aroused my interest, so I decided to try several mainstream ones on the market, including ERNIE-ViLG, DALL·E, Imagen, Midjourney, Disco Diffusion from From installation to simple use, let's take a look at the text-to-picture model ERNIE-ViLG that supports Chinese. How fun it is.

  • The installation environment is as follows

win10,python3.8

  • ERNIE-ViLG Introduction

Wenxin ERNIE-ViLG was developed by Baidu, with a parameter scale of 10 billion. It is the largest Chinese cross-modal generation model in the world so far. You can input a text description and generation style, and the model will automatically create a product that meets the requirements based on the input content. Image. github address

https://github.com/PaddlePaddle/PaddleHub/tree/develop/modules/image/text_to_image/ernie_vilg

  • Installation process of open source pre-trained model version

Install according to the steps. I am using the cpu version. If the system environment variable pip path is pip under python3.8, you can directly use the following command to install it.

To install paddlepaddle, the version needs to be greater than 2.0.0. The version installed directly meets the requirements.

pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple/

Install paddlehub. The version needs to be greater than 2.2.0. The directly installed version meets the requirements.

pip install paddlehub -i https://mirror.baidu.com/pypi/simple/

Install paddlepaddle’s ernie_vilg module

hub install ernie_vilg

  • test

After installing the pre-trained model, you can directly use the following code to conduct a simple test. The result will be 6 oil paintings.

import paddlehub as hub

module = hub.Module(name="ernie_vilg")

text_prompts = ["炎热的夏日,蓝天白云,公路边上一望无垠金黄色的稻田,戴着草帽的农夫在稻田里收割水稻"]

#参数介绍,text_prompts是要画的内容描述,style是画的风格,output_dir是结果的输出目录,里面最为关键的是text_prompts参数

images = module.generate_image(text_prompts=text_prompts, style='油画',

output_dir='./ernie_vilg_out/')

According to the output, there are no details of farmers harvesting in the rice fields in the five paintings, but it feels good to be able to produce such an effect with just such a sentence.

That’s it for the brief introduction. If you still want to know more about how to draw better and more beautiful pictures, you can click on the link below to view the specific content.

With AI intelligent painting, I can also become a painting master - the world's largest Chinese cross-modal generation model ERNIE-ViLG

If you like it, you can also follow the WeChat public account PythonerLeague below. More high-quality python technical articles will be published. Let us make progress together. If you have any questions, you can ask questions and discuss and help each other.

Guess you like

Origin blog.csdn.net/qq_21372359/article/details/127044998