ModelArts-based StyleGAN3 generates high-definition images_[HUAWEI CLOUD is simple and far]

[Summary] Introduction to ModelArts ModelArts is a developer-oriented one-stop AI development platform that provides massive data preprocessing and interactive intelligent labeling for machine learning and in-depth learning, large-scale distributed training, automated model generation, and on-demand deployment capabilities of end-edge-cloud models to help users quickly create and deploy models and manage full-cycle AI workflows. In addition, ModelArts has the characteristics of low threshold, high efficiency, high performance, and easy operation and maintenance. That is, ModelArts can be used out of the box, and it can build AI models in 3 steps from zero foundation; AI development...

Introduction to ModelArts

ModelArts is a developer-oriented one-stop AI development platform that provides massive data preprocessing and interactive intelligent labeling for machine learning and in-depth learning, large-scale distributed training, automated model generation, and on-demand deployment of end-edge-cloud models to help users quickly create and deploy models and manage full-cycle AI workflows. In addition, ModelArts has the characteristics of low threshold, high efficiency, high performance, and easy operation and maintenance. That is to say, ModelArts can be used out of the box, and AI models can be built in 3 steps with zero foundation; The whole process of AI development can be visualized and managed, the production efficiency can be improved by a hundred times, and it can flexibly support the unified management of multi-vendor, multi-frame and multi-functional models.

The following uses ModelArts, based on StyleGAN3, to generate high-definition images.

The first step, click the link to enter the case page of ACGAN-Animation Avatar Automatic Generation, and complete the basic configuration.

AI Gallery_Notebook Details_Developer_HUAWEI CLOUD

Click Run in ModelArts to enter the JupyterLab page.

JupyterLab page:

According to Automatic generation of anime avatars based on ModelArts Step, configure the current operating environment and switch specifications.

The second step is to install dependencies

Select the following code and click Run.

This code takes a long time to run. After waiting for the running to complete, the results are as follows:

The third step is to generate a picture

Run the following code:

  • Generate images using pretrained AFHQv2 model
# Generate images using pretrained AFHQv2 model
!python gen_images.py --outdir=out_0 --trunc=1 --seeds=2 \
    --network=stylegan3-r-afhqv2-512x512.pkl
# Display of results
display(Image(filename='./out_0/seed0002.png'))  

  • Generate images using pretrained FFHQ model
# Generate images using pretrained FFHQ model
!python gen_images.py --outdir=out_1 --trunc=1 --seeds=2 \
    --network=stylegan3-r-ffhq-1024x1024.pkl
# Display of results
display(Image(filename='./out_1/seed0002.png')) 
  • Generate images using pretrained metfaces model
# Generate images using pretrained metfaces model
!python gen_images.py --outdir=out_2 --trunc=1 --seeds=2 \
    --network=stylegan3-r-metfaces-1024x1024.pkl
# Display of results
display(Image(filename='./out_2/seed0002.png')) 

The fourth step is to generate an interpolated video

Use the pre-trained AFHQv2 model, FFHQ model, and metfaces model to generate videos respectively.

  • AFHQv2 model

# Display of results
outpath = "lerp.mp4"
mp4 = open(outpath,'rb').read()
data_url = "data:video/mp4;base64," + b64encode(mp4).decode()
HTML("""
<video width=400 controls>
      <source src="%s" type="video/mp4">
</video>
""" % data_url)
  • FFHQ model

# Display of results
outpath = "ffhq.mp4"
mp4 = open(outpath,'rb').read()
data_url = "data:video/mp4;base64," + b64encode(mp4).decode()
HTML("""
<video width=400 controls>
      <source src="%s" type="video/mp4">
</video>
""" % data_url)
  • metfaces model

# Display of results
outpath = "met.mp4"
mp4 = open(outpath,'rb').read()
data_url = "data:video/mp4;base64," + b64encode(mp4).decode()
HTML("""
<video width=400 controls>
      <source src="%s" type="video/mp4">
</video>
""" % data_url)

-END-

references

[Huawei Cloud to Jane Zhiyuan] Prize-winning essays are in full swing: [Awarded Essay Issue No. 13] Zhiyuan Zhijian, "Cloud" is making waves in the world, boldly show your HUAWEI CLOUD technology proposition, and high incentives are waiting for you-Cloud Community-HUAWEI CLOUD

For more information about HUAWEI CLOUD products, please contact us:

Tel: 950808 Press 0 to 1

Tags: AI Deep Learning

Posted by chelnov63 on Thu, 22 Sep 2022 20:59:08 +0300