[PYTHON] I tried to let VAE learn motion graphics

What is motion graphics?

** It is a cool movement of figures, logos, illustrations, etc. **. It's a pretty vague definition, isn't it? I don't think there is actually a clear definition. Motion graphics are often used for the so-called emo image. It is often used in artist MVs and corporate commercials. If you search for "motion graphics" on YouTube etc., you will find a lot of cool images, so please take a look.

I want to automatically generate motion graphics!

Most of the motion graphics are created by the creators by hand. This is a very time-consuming and difficult task. So recently, I wondered if it could be generated using the spear AI. Wouldn't it be fun to train AI to generate motion graphics?

data set

Even if it is generated, a data set for training is required. However, according to my research results, ** motion graphics datasets did not exist. ** So you need to create your own dataset. However, it takes a huge amount of time to create a large data set, so this time I simply created motion graphics of 6 types of particles. I used Adobe's Africa Effects to create the dataset.

Created dataset

123456
ae.png

Model used for learning

Now that we've created the dataset (aside from whether it's fairly small and can be called a dataset), the next thing to think about is the model. There are several generative models, and the current mainstream is GAN or VAE. GAN is difficult to learn, and if the data set is small like this time, there is a high possibility that it will not learn well, so we adopted VAE. VAE is a derivative system of AE, and the distribution of latent variables is acquired by compressing and restoring the data set. After training, it can be generated by giving noise z to the decoder part. For AE and VAE, the following articles will be helpful. Variational Autoencoder Thorough Explanation Since this time we will generate a video, VAE built a model of Unet structure by 3D convolution. Learn the spatiotemporal information of moving images by 3D convolution. The transpose conv in the decoder part is a transpose convolution. Transpose convolution is explained in an easy-to-understand manner with a video in the article [here](ttps: //qiita.com/kenmatsu4/items/b029d697e9995d93aa24 "Transpose convolution").

models figure (1).png

Learning

Since the data set is small, the training ended immediately. I judged that it could be generated at about 200 epoch, so I ended the training there. It took about an hour with GTX1080Ti.

Experiment details

Video size epoch number Framework GPU
128x128x32 200 PyTorch GTX1080Ti

Generation result

gen1.gif gen2.gif gen3.gif gen4.gif

Motion graphics that look like learning data have been generated properly.

Morphing By complementing the noise vector z given to the decoder between the motion graphics, it is possible to generate motion graphics between the two motion graphics. This is a video version of what is often generated by GAN and changes little by little. 111111

Intermediate motion graphics are generated by complementing the latent variable z between motion graphics as shown in the following equation.

z = t z_1 + (1-t)z_2 \\
0 < t < 1

Summary

I was able to generate motion graphics using deep learnig. This time, there was no diversity in the generation because it was a fairly small dataset. If you have a large motion graphics dataset, I would love to experiment. (Can someone make it?) However, it is interesting to be able to generate intermediate things with Mophing etc. In this experiment, we found that Morphig can be created even with a small data set.

reference

Variational Autoencoder Thorough Explanation [Deconvolution in Neural Networks](ttps: //qiita.com/kenmatsu4/items/b029d697e9995d93aa24 "Transpose Convolution")

Recommended Posts

I tried to let VAE learn motion graphics
I tried to learn PredNet
I tried to let optuna solve Sudoku
I tried to learn logical operations with TF Learn
I tried to detect motion quickly with OpenCV
I tried to debug.
I tried to paste
I tried to learn the sin function with chainer
I tried to implement and learn DCGAN with PyTorch
I tried to organize SVM.
I tried to implement PCANet
I tried to reintroduce Linux
I tried to introduce Pylint
I tried to summarize SparseMatrix
I tried to touch jupyter
I tried to implement StarGAN (1)
I tried to implement Deep VQE
I tried to create Quip API
I tried to touch Python (installation)
I tried to implement adversarial validation
I tried to explain Pytorch dataset
I tried Watson Speech to Text
I tried to touch Tesla's API
I tried to implement hierarchical clustering
I want to scrape images to learn
I tried to organize about MCMC.
I tried to implement Realness GAN
I tried to move the ball
I tried to estimate the interval.
I tried to let Pepper talk about event information and member information
I tried to predict by letting RNN learn the sine wave
I tried to create a linebot (implementation)
I tried to summarize Python exception handling
I tried to implement PLSA in Python
I tried using Azure Speech to Text.
I tried to implement Autoencoder with TensorFlow
I tried to summarize the umask command
I tried to implement permutation in Python
I tried to create a linebot (preparation)
I tried to recognize the wake word
I tried to get started with Hy
I tried to implement PLSA in Python 2
I tried to classify text using TensorFlow
I tried to summarize the graphical modeling.
I tried adding post-increment to CPython Implementation
I tried to implement ADALINE in Python
I tried to learn the angle from sin and cos with chainer
I tried to estimate the pi stochastically
I tried to touch the COTOHA API
I tried to implement PPO in Python
I tried to implement CVAE with PyTorch
I tried to make a Web API
I tried to solve TSP with QAOA
[Python] I tried to calculate TF-IDF steadily
I tried to touch Python (basic syntax)
I tried my best to return to Lasso
I tried to summarize Ansible modules-Linux edition
I tried to predict Covid-19 using Darts
[Azure] I tried to create a Linux virtual machine in Azure of Microsoft Learn
I tried to predict next year with AI
I tried to build a super-resolution method / ESPCN