Every frame of Bad Apple!! as a unique furry artwork
Why
Recently, I have seen a ton of Bad Apple!! videos circulating on my YouTube feed. This is not the most unheard of event. The black and white animation, originally inspired from a 1998 Touhou Project song, is an incredibly common hacker project. If you can drive a screen on your device, you can play Bad Apple!!.
I also wanted to visualize really how much furry artwork there is out there. Not only are there 6,000+ individual art pieces by frame count alone, there is enough artwork to make a kinda sorta approximation of Bad Apple!!.
How
I host my own private dataset of furry artwork. Nothing crazy, but it is an approximately 700 GB mirror of e621.net. While this sounds like a huge number, the total scale of that website is 13.6 TB of posts. With this dataset, I am also able to scan all the images to find one image per frame that meets my standards for the best possible "Bad Apple!! frame". In total, after filtering for images that wouldn't immediately get me ban-stricken off of YouTube, I had 1.16 MILLION images to choose from. Here's how the matching works:
Each artwork is scored against each frame over 100 crop windows: 4:3 boxes at 4 zoom levels (100%, 80%, 64% and 50% of the image) on a 5×5 grid of positions. Whichever window fits best is the one that shows up in the video.
The 100 windows on the artwork picked for frame 939 (0:31.30): e621 #4781891 by azzai. This image is 2:3, taller than 4:3, so at 100% the windows only slide vertically. The highlighted one (100%, second position from the top) is the crop in the video. Drawn with windows_for from the pipeline.
I tried three versions:
Brightness. Compare grayscale crops to the frame. Simple and calm, but it ignores shape.
Edges / Hough. Compare outlines instead. The shapes match much better, but the video flashes a lot.
Combined (the one shown here). A three-stage cascade that uses brightness first, shape second and smoothness last.
What each version picked for frames 939 and 2400, as shown in its video (brightness and combined crops include their contrast and brightness fit). The combined pick for frame 939 is e621 #4781891 by azzai. From assign_brightness, assign_hough and assign_combined.
Stage 1: brightness
Each frame and each crop is reduced to a small grayscale grid. A crop may be adjusted by 0.8–1.6× contrast and ±0.15 brightness to fit, so the score is about the pattern of light and dark, not the exact exposure. Each frame keeps its top 256 matches, minus anything more than 0.03 error worse than that frame's best (but never fewer than 64). This stage keeps blacks black and whites white.
Stage 1 for frame 939 (0:31.30) and e621 #4781891 by azzai: the frame's area-averaged 24×18 luma (t), the crop sampled with RoIAlign (c), the fitted crop (c′), and |t − c′|. The fit hits the contrast cap here (g = 1.6, b = +0.035), giving EB = 0.0428. The values are the pipeline's own (explain_combined.npz).The gate for frame 939 (0:31.30): the brightness error of its top 400 (from a 2,048-candidate pool, topk_brightness.npz). The best is 0.0224 and all 256 stay within 0.03 of it, so the rank cap decides. The final pick was rank 224 (EB 0.0428), near the end of what Stage 1 lets through.
Stage 2: high-resolution edges and Hough lines
Each surviving crop is cut at 64×48 px in color, and its edges are found from hue and color changes as well as brightness, in 36 directions. Those edges are scored two ways against the frame's silhouette outline:
a 32×24 spatial edge map, for where the edges are, and
a 36×48 Hough line projection (angle × offset), for which lines and curves are there.
The candidates are re-ranked by shape, and each frame keeps its top 64.
Stage 2 for frame 939 (0:31.30) and e621 #4781891 by azzai, recomputed with the pipeline's features_hr on the stored 64×48 crop. The frame's edges come from its binarised silhouette; the crop's come from Lab colour, coloured here by direction. The spatial maps merge the 36 directions into 6. The Hough maps are θ (vertical) × ρ (horizontal). Bottom: cosS 0.562 and cosH 0.864 give E₂ 0.403, rank 6 of the 64 Stage 2 keeps.
Stage 3: anti-flash
The last pass goes through the frames in order, from 0 to 6,571. For each frame, it looks at the top 20 not-yet-used stage 2 candidates and picks the one whose colors change least from the previous frame's pick. The change is measured as CIE76 ΔE on a coarse Lab grid. How much change is allowed depends on the frame: a real scene cut in Bad Apple!! is allowed a big jump, and a still moment isn't. Because the used set is tracked, no artwork appears twice in the video.
Frames 936–941: each frame, the combined pick and its 8×6 Lab grid G (shown as colour), which is what Stage 3 compares. ΔE is the mean change from the previous pick's grid and matches s3_combined.npz to 0.1. Frame 939's pick is e621 #4781891 by azzai: ΔE 6.9, under its allowance of 8.7.Frame-to-frame colour change over four seconds around frame 939 (frames 879–998) for each version, measured the same way as the table below. The shaded band is Stage 3's allowance at × 100.The pipeline's own debug view (07_render.py combined --debug) for frame 939 (0:31.30), with e621 #4781891 by azzai. Right side: the frame, Stage 1's target, matched crop and difference, Stage 2's edges and Hough maps, and the numbers from all three stages.
Measured over all 6,572 frames of each version.
Metric
Brightness
Edges / Hough
Combined
Bad Apple!! itself
Brightness error (lower is better)
0.042
0.254
0.049
n/a
High-res edge score (lower is better)
0.425
0.334
0.375
n/a
High-res line similarity (higher is better)
0.773
0.853
0.818
n/a
Mean frame-to-frame color change (ΔE)
22.7
42.2
12.0
2.2
95th-percentile color change (ΔE)
51.1
86.0
22.0
7.9
Frames with a color jump over 25 ΔE
35.1%
71.1%
2.6%
0.2%
The combined version stays almost as close on tone as brightness alone, gets about halfway to Hough on shape, and flashes far less than either.
Credits
Bad Apple!! is originally by ZUN (Touhou Project, Lotus Land Story). The arrangement is "Bad Apple!! feat. nomico" by Alstroemeria Records, with vocals by nomico.
The shadow-art PV is by あにら (Anira).
Every artwork belongs to its artist. Each frame below links to its e621 post and credits the artist tagged there. The tiles below are the crops exactly as they appeared in the video.
Appendix: Every Frame
As a bonus, here is each frame of the video in order, in gallery form, with all the credits for the original artist as referenced by e621.