Artificial Intelligence 8 min read

Turn AI Into a Gallery‑Ready Painter with Docker and Style Transfer

Learn how to turn an AI robot into a gallery‑ready painter by setting up Docker and nvidia‑docker, installing GPU drivers, and running a neural‑style transfer pipeline that blends photographs with Monet’s brushstrokes, producing high‑quality artwork in minutes.

360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
Turn AI Into a Gallery‑Ready Painter with Docker and Style Transfer

1. A Painter Is Born

In the 2019 graduate exhibition of Central Academy of Fine Arts, a "student" named Xia Yubing, actually an AI robot from MSRA called Microsoft Xiaoice, displayed paintings after over 20 months of training, achieving artistic level comparable to human graduates.

2. Painting Challenges

Before starting, we must set up the environment, installing GPU drivers, CUDA, cuDNN, Torch, protobuf, and loadcaffe for VGG19. Dependency updates can cause crashes, so containerization with Docker and nvidia‑docker isolates the environment while allowing GPU access.

3. Preparing the Painting Tools

We run the project on a GPU‑enabled host, either a private cloud GPU server or a public‑cloud instance such as AWS EC2 P2. The following script installs NVIDIA drivers and nvidia‑docker2.

<code>#!/bin/bash
# Install NVIDIA drivers 418.87
sudo apt-get install --no-install-recommends -y gcc make libc-dev
wget -P /tmp http://cn.download.nvidia.com/tesla/418.87/NVIDIA-Linux-x86_64-418.87.00.run
sudo sh /tmp/NVIDIA-Linux-x86_64-418.87.00.run --silent

# Install nvidia-docker2
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
distribution=$( . /etc/os-release; echo $ID$VERSION_ID )
curl -s -L https://nvidia.github.io/nvidia-docker/${distribution}/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
apt update && apt install nvidia-docker2
sudo pkill -SIGHUP dockerd

# Test
docker run --runtime=nvidia --rm nvidia/cuda:9.0-devel-ubuntu16.04 nvidia-smi</code>

4. Deploy the Model

After building the Docker image, run the style‑transfer script to generate artwork, e.g.,

<code>docker build . -t neural-style:dev-0.0.1
./scripts/fake-it.sh goldengate.jpg monat.jpg</code>

The resulting images can be downloaded or assembled into a GIF.

5. References

A Neural Algorithm of Artistic Style

Visualizing and Understanding Convolutional Networks

How to Fake It As an Artist

neural‑style‑docker

神经美学:发生在大脑和艺术之间的化学反应

Dockerdeep learningAI artGPUstyle transfernvidia-docker
360 Zhihui Cloud Developer
Written by

360 Zhihui Cloud Developer

360 Zhihui Cloud is an enterprise open service platform that aims to "aggregate data value and empower an intelligent future," leveraging 360's extensive product and technology resources to deliver platform services to customers.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.