ArtEmis & Painting Style Transfer — Portfolio Project by Muhammad Daffa Ashdaqfillah
An on-device style transfer camera, with a PyTorch training pipeline, Core ML export checks, and browser experiments in painting motion.

Published on May 21, 2026
Project Details

I wanted a camera that could borrow the texture and palette of a particular painting while keeping the photographed scene recognizable. On the style-transfer side of the ArtEmis project, I moved the training pipeline to PyTorch on Apple Silicon, exported the trained networks to Core ML, and integrated painted styles and artwork analysis into the iOS camera and gallery prototype. The team presented the wider project as DNS Studio.
Demo

Training one network per painting
Each run used photos from COCO train2014 as content and one painting as the style reference. The content image also supplied the reconstruction target, which let us train on 82,783 photos without manual labels. Each style had its own weights, so adding a new painting meant training and exporting another network.
I ported the TensorFlow reference to PyTorch with Metal Performance Shaders. Training resized each image to 256 × 256 and processed one image per batch. TransformerNet downsamples the image, processes it through five residual blocks, then upsamples with nearest-neighbor interpolation followed by convolution. The network has about 1.68 million parameters. Instance normalization acts on each image separately, and reflection padding extends edges before convolution without introducing a black border.
A frozen VGG19 measured the training loss. The content term compared activations at relu4_2 to preserve the original scene's structure. The style term matched channel correlations using Gram matrices from relu1_1 through relu5_1. I precomputed the painting's matrices once per run. The notebook combined content, style, and total variation with weights of 7.5, 100, and 200, and used Adam at a learning rate of 0.001. Gradients updated TransformerNet through the frozen feature extractor.
I used a separate checkpoint notebook to compare losses and activation statistics layer by layer. Looking at the relu4_2 feature maps alongside the rendered previews helped me inspect whether the model was preserving structure as it adopted the painting's texture.
The training log recorded 11m 02s at step 8,000 and 22m 15s at step 16,000. At batch size 1, the full 82,783-image epoch was estimated at roughly 1h 55m from those two intervals.
Checking Core ML against PyTorch

The export wrapped TransformerNet as a float16 Core ML ML Program with a fixed 512 × 512 RGB image input and output. The wrapper clamps the output to the image's 0–255 range. Core ML executes the trained image transformer, and VGG19 stays in the training pipeline.
I compared the saved PyTorch and Core ML outputs on the same sample image for three exports. The table reports absolute differences in 8-bit RGB channel values.
| Painting export | Mean absolute error | Largest channel difference |
|---|---|---|
| Udnie | 0.209 | 8 |
| The Scream | 0.178 | 3 |
| Van Gogh | 0.228 | 9 |
The comparison checked whether conversion changed the generated pixels on that sample. Hand inspection of stylized frames remained the basis for judging how well the output held onto shapes and transferred the painting's texture.
A camera that could also describe the image
The SwiftUI prototype applied the selected style model on-device. The camera code measured frame latency and throughput in the live preview. Still-image exports use a fixed square input, so framing and resizing are part of the app's job.
The team's separate ArtEmis classifier used an EfficientNetV2-S backbone with a nine-category emotion head and a 27-class WikiArt style head. The emotion head learned from distributions of annotator votes because a painting can evoke several emotions. The iOS integration used Vision and Core ML to show ranked scores alongside the artwork.
What changed when the input moved
Applying the image model frame by frame could produce flicker because neighboring frames were stylized independently. In the webcam experiment, MediaPipe supplied pose landmarks and the browser smoothed them over time. The canvas drew a moving figure using colors and textures sampled from a painting reference. That branch was a procedural renderer.
The LivePortrait proof of concept addressed a different motion problem. Its Python backend could use an external pretrained model to transfer head pose and expression from a recorded clip to a portrait. A dry-run mode returned the recording so the team could verify the capture and upload flow with the inference backend offline. A separate training scaffold explored full-body motion with source and target poses and an optional warped previous frame.