How I Made my Own NFTs with Deep Learning

Nalin Nagar
Analytics Vidhya
Published in
5 min readFeb 25, 2022

Non-fungible tokens (NFTs) represent a type of cryptocurrency that is unique and indivisible. Each NFT has unique characteristics and values, and they often come in limited quantities represented through different data formats such as MP4, JPG, or PDF.

Crypto and blockchain are upcoming technologies and so is deep learning. Combining these two technologies could yield an interesting results. I decided to try it out and started brainstorming unique usage of deep learning and NFT.

I came up with idea of of crypto art. Utilizing the logo representing of cryptocurrencies such as Ethereum and Bitcoin and turning it into unique pieces of art using deep learning models.

The deep learning part was going to be turning these logos into some form of art that was creative and unique. Creativity needs to be dervided from a deep learning model. I searched for models in a open sea of deep learning papers. Finally I found what seemed to be what I needed: Stylized Neural Painting(Link to paper).

What is Stylized Neural Painting?

Creating paintings in one of the ways humans are able to define and express themselves. With Stylized Neural Painting this process is automated and looks humanly natural with its progressive strokes.

You might already be thinking a GAN architecture is behind this, but you would be wrong. Most generative networks make use of pixel-wise mapping or continuous optimization methods in their architecture however this paper adds another dimension to this type of generation with the idea of stroke prediction.

Stroke prediction is a parameter searching process that aims to maximize the similarity between the input image and its given “canvas”. Another change implemented is a rasterization network and a shading network instead of your usual generator and discriminators. The proposed renderer better deals with the disentanglement of the shape and color, and this new architecture outperforms other methods of painting with deep learning by a large margin.

Network Architecture (https://arxiv.org/pdf/2011.08114.pdf)

The soft blending is defined as follows:

Soft blending

Where h is the canvas, α is defined as the alpha matte, and s is defined as the stroke foreground.

Gradient descent is used to update the strokes and is defined as follows:

Gradient descent

Suppose h of T is the canvas and h hat is the reference picture and, ℒ is a loss function that minimizes differences in h of T and h hat, x is the collection of all stroke parameters, and µ is a predefined learning rate.

This optimization used to optimize the model architecture mentioned below:

Shading network and rasterization network architecture

These model parameters can be optimized for different types of strokes including oil pastel, watercolor, markerpen, and box/rectangle, and I made use of this which I will explain later. This is a very basic overview of Neural Stylized Painting and if you want a deeper dive into what is actually going on I recommend reading the paper and looking through the code which I will link below:

Arxiv: https://arxiv.org/pdf/2011.08114.pdf

How Did I Make Use of the Model?

I used their code implementation on Github and pretrained models that the creators so kindly provided to provide unique inputs to create various NFTs.

OpenSea and Posting the NFTs

After I had gotten all the code working, all I had to do was pick base image, , choose a style, and set a few hyperparameters to get the final result.

The output was progressive painting in gif form depecting painting strokes and making the NFT look even cooler. Below are some unique and vogue GIFs that I created with my idea of making crypto themed art:

BitLocker with Box Style by Author
EthHandOG with Oil Pastel Style by Author
BlueEth with MarkerPen Style by Author

I needed to find a place to mint the NFTs and post them for sale for art lovers. For this I chose the platform OpenSea. OpenSea is a peer-to-peer marketplace for NFTs where you can buy, sell, and auction your digital collectibles. OpenSea makes it extremely easy to mint your NFTs and then post them for auction.

I decided to name my collection CryptoArt AI.

What Did I Learn?

I learned a ton about both of these upcoming technologies from this project and I’m excited to use them even more.

Stylized Neural Painting redefined how we think about art generation in the world of deep learning which opens the door for many new exciting possibilities. Learning about this new architecture and looking through the actual code implementation helped me learn a lot about the new rasterization and shading architecture which I could possibly use in the future for my own personal endeavors.

Learning how to use OpenSea was also a critical step in learning the new technologies that are fueling our world today. I’m excited to post new NFTs on OpenSea, and possibly list them for sale(stay tuned!). I am most excited to learn about code development in a blockchain environment and its usages.

What do you think of this article and the technology used? I would love to hear and connect with you on these topics.

Links:

My OpenSea Collection: https://opensea.io/collection/cryptoart-ai(Check it out and if you find it interesting give it a like and if you’re a collector it’s also for sale.)

Stylized Neural Painting: https://arxiv.org/pdf/2011.08114.pdf

Discord Server for NFTs: https://discord.gg/hHW2kSzp

My Personal Website: https://personal-website-nndev1.vercel.app/

Thanks for Reading and do give me few claps if you like the contents of this article!

--

--

Nalin Nagar
Analytics Vidhya

High schooler interested in machine learning, music, and sports.