Hysen Labs
Open-source project
metaflow-ai/neural_style avatar
metaflow-ai

neural_style

A journey to explore neural style algorithm: From GPU to Mobile!

50 stars5 forksPythonLicense varies
01
DEEP OPEN-SOURCE ANALYSIS

Chasing the neural style algorithm, GPU to phone

A repo of experiments on the neural style algorithm, with scripts to download, pretrain, and train, and performance numbers from a GPU down to an iPhone.

02
DEEP OPEN-SOURCE ANALYSIS

The journey framing

The repository describes itself as a journey into the neural style algorithm, from GPU to mobile. It holds the work done to get a better sense of how the algorithm behaves, with all the different scripts to download, pretrain, and train models. The stack is TensorFlow with TensorBoard and Keras. The framing matters here: this is exploratory work with visible personality, not a polished library.

03
DEEP OPEN-SOURCE ANALYSIS

The backend caveat

There is a flexibility note about backends. You can potentially change the Keras backend to Theano, but you might have to tweak some things here and there. So the primary path is TensorFlow, and the alternative is offered with a warning attached. The README does not pretend the switch is painless.

04
DEEP OPEN-SOURCE ANALYSIS

How the repo is laid out

The architecture section maps every concern to a folder. Data holds image inputs and outputs, docker holds the Dockerfile, mobile holds the iOS files and a README for getting a TensorFlow model working on iOS, models holds the Python files and weight outputs, and perf holds scripts to measure the cost of moving from a GPU to an iPhone 6s. There is a torch folder with work done in Torch, including a Keras neural net importer, and a vgg folder with the vgg19 data and scripts. The Python files each probe one question: the impact of the alpha parameter, layer reconstruction, layer influence, total variation loss, prediction, pretraining, and training.

05
DEEP OPEN-SOURCE ANALYSIS

Docker or local

The Docker section asks you to decide on two axes: GPU or CPU, and local or container. For a local install you pip install the requirements file, with a note to use a virtual environment. For the container route you use nvidia-docker, and the README warns you need cuda 7.5 and cudnn5 locally. There is also a path to pretrain on overfit data, and a way to initialize model weights only by setting the epoch parameter to zero.

06
DEEP OPEN-SOURCE ANALYSIS

The performance gap

The performance section makes the GPU to mobile framing concrete. The README reports a roughly 703 times slowdown in a TensorFlow CPU non quantized implementation versus an AWS GPU. The table lays it out: a TensorFlow GPU on AWS runs around 0.03 seconds per batch, macOS takes a few seconds, and the iPhone 6s CPU takes 18.30 seconds in float32. TensorBoard shows loss evolution and intermediate images in real time during training, which rounds out the workflow.

07
DEEP OPEN-SOURCE ANALYSIS

Editorial conclusion

The repository records a personal run through the neural style algorithm with TensorFlow, TensorBoard, and Keras, from GPU to mobile. Its performance numbers show the cost of the move.

08
DEEP OPEN-SOURCE ANALYSIS

Official sources

09
Community notes

Community notes