file_name stringclasses 30
values | variant stringclasses 6
values | seed int64 1 30 | width int64 768 1.02k | height int64 1.02k 1.02k | stops_under int64 0 4 | method stringclasses 5
values | noise_est float64 0.74 5.86 | psnr_y float64 20 43.4 | ssim float64 0.56 0.97 | ssim_hair float64 0.37 0.99 | face_noise float64 0.76 6.01 | hf_ratio float64 0.49 10.8 | face_mean_shift float64 -2.18 1.13 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
card_01_clean.png | clean | 1 | 768 | 1,024 | 0 | retake | 1.658 | 39.651 | 0.94518 | 0.97961 | 1.572 | 1.076 | -0.03 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 1 | brighten | 2.445 | 36.893 | 0.89741 | 0.97079 | 2.156 | 1.107 | 0.01 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 1 | bright_nlm | 1.528 | 37.045 | 0.91555 | 0.97017 | 1.51 | 1.078 | -0.3 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 1 | bright_bil | 1.541 | 38.335 | 0.93386 | 0.97539 | 1.567 | 1.06 | 0 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 1 | bright_med | 0.796 | 21.294 | 0.8207 | 0.40145 | 1.804 | 0.747 | -0.01 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 2 | brighten | 3.448 | 33.737 | 0.80665 | 0.95842 | 2.941 | 1.144 | -0.05 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 2 | bright_nlm | 2.355 | 33.457 | 0.81818 | 0.93156 | 1.84 | 1.045 | 0.37 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 2 | bright_bil | 2.227 | 35.249 | 0.86867 | 0.96601 | 2.02 | 1.048 | -0.06 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 2 | bright_med | 1.131 | 21.322 | 0.7993 | 0.40343 | 2.221 | 0.655 | -0.03 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 3 | brighten | 4.328 | 30.816 | 0.69473 | 0.93935 | 3.877 | 1.214 | -0.21 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 3 | bright_nlm | 3.121 | 30.388 | 0.69866 | 0.85018 | 2.296 | 0.998 | -1.36 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 3 | bright_bil | 3.012 | 32.085 | 0.76792 | 0.95005 | 2.615 | 1.061 | -0.22 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 3 | bright_med | 1.6 | 21.343 | 0.74982 | 0.39932 | 2.606 | 0.601 | -0.22 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 4 | brighten | 5.483 | 27.821 | 0.57196 | 0.90992 | 5.276 | 1.312 | -0.45 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 4 | bright_nlm | 3.904 | 27.643 | 0.57972 | 0.72385 | 2.823 | 0.882 | -0.63 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 4 | bright_bil | 3.96 | 28.788 | 0.64371 | 0.92336 | 3.567 | 1.049 | -0.44 |
card_01_clean.png | clean | 1 | 768 | 1,024 | 4 | bright_med | 2.321 | 21.302 | 0.66198 | 0.40813 | 3.348 | 0.512 | -0.39 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 0 | retake | 1.658 | 39.608 | 0.94546 | 0.97697 | 1.572 | 1.075 | -0.21 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 1 | brighten | 2.449 | 36.846 | 0.89756 | 0.96649 | 2.178 | 1.125 | -0.28 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 1 | bright_nlm | 1.558 | 37.175 | 0.91932 | 0.96072 | 1.517 | 1.095 | 0.29 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 1 | bright_bil | 1.544 | 38.285 | 0.93398 | 0.97326 | 1.611 | 1.068 | -0.29 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 1 | bright_med | 0.786 | 21.556 | 0.82131 | 0.42636 | 1.566 | 0.712 | -0.28 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 2 | brighten | 3.401 | 33.74 | 0.80936 | 0.95154 | 2.859 | 1.126 | -0.07 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 2 | bright_nlm | 2.396 | 33.62 | 0.82668 | 0.92323 | 1.849 | 1.03 | -0.43 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 2 | bright_bil | 2.214 | 35.215 | 0.86994 | 0.96318 | 1.983 | 1.022 | -0.06 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 2 | bright_med | 1.128 | 21.584 | 0.8006 | 0.42938 | 1.938 | 0.642 | -0.04 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 3 | brighten | 4.364 | 30.769 | 0.69466 | 0.92864 | 3.848 | 1.166 | 0.15 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 3 | bright_nlm | 3.22 | 30.376 | 0.70297 | 0.83577 | 2.154 | 0.917 | 0.33 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 3 | bright_bil | 3.032 | 32.054 | 0.76905 | 0.94705 | 2.575 | 0.984 | 0.16 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 3 | bright_med | 1.576 | 21.608 | 0.75096 | 0.43015 | 2.434 | 0.568 | 0.18 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 4 | brighten | 5.578 | 27.758 | 0.56981 | 0.89504 | 5.495 | 1.384 | -0.53 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 4 | bright_nlm | 3.978 | 27.534 | 0.57785 | 0.71532 | 2.817 | 0.871 | -0.62 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 4 | bright_bil | 3.978 | 28.761 | 0.6446 | 0.92109 | 3.676 | 1.051 | -0.5 |
card_02_clean.png | clean | 2 | 768 | 1,024 | 4 | bright_med | 2.321 | 21.558 | 0.66048 | 0.4273 | 3.449 | 0.508 | -0.37 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 0 | retake | 1.658 | 39.504 | 0.9452 | 0.97429 | 1.581 | 1.021 | -0.01 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 1 | brighten | 2.58 | 36.78 | 0.89757 | 0.96284 | 2.193 | 1.084 | -0.46 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 1 | bright_nlm | 1.544 | 37.066 | 0.92107 | 0.95182 | 1.428 | 1.019 | -0.11 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 1 | bright_bil | 1.582 | 38.314 | 0.93597 | 0.97108 | 1.507 | 1.034 | -0.46 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 1 | bright_med | 0.818 | 21.397 | 0.80983 | 0.41139 | 1.418 | 0.76 | -0.46 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 2 | brighten | 3.582 | 33.694 | 0.80894 | 0.94714 | 2.954 | 1.092 | -0.27 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 2 | bright_nlm | 2.348 | 33.417 | 0.82613 | 0.87935 | 1.796 | 0.955 | -0.13 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 2 | bright_bil | 2.279 | 35.286 | 0.87351 | 0.96054 | 1.961 | 1.001 | -0.25 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 2 | bright_med | 1.175 | 21.435 | 0.78814 | 0.41307 | 1.824 | 0.702 | -0.19 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 3 | brighten | 4.569 | 30.737 | 0.69482 | 0.92404 | 4.127 | 1.218 | -0.71 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 3 | bright_nlm | 3.158 | 30.176 | 0.69889 | 0.76886 | 2.162 | 0.936 | -1.2 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 3 | bright_bil | 3.135 | 32.111 | 0.77335 | 0.94309 | 2.671 | 1.03 | -0.71 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 3 | bright_med | 1.656 | 21.459 | 0.73886 | 0.41884 | 2.5 | 0.635 | -0.67 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 4 | brighten | 5.829 | 27.717 | 0.56875 | 0.8877 | 6.013 | 1.595 | -0.71 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 4 | bright_nlm | 3.978 | 27.401 | 0.56879 | 0.65069 | 2.558 | 0.965 | -1.41 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 4 | bright_bil | 4.157 | 28.796 | 0.64593 | 0.91356 | 4.001 | 1.215 | -0.69 |
card_03_clean.png | clean | 3 | 768 | 1,024 | 4 | bright_med | 2.321 | 21.399 | 0.65001 | 0.41468 | 3.283 | 0.616 | -0.62 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 0 | retake | 1.658 | 39.597 | 0.94514 | 0.97794 | 1.624 | 1.065 | -0.03 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 1 | brighten | 2.512 | 36.828 | 0.89668 | 0.96817 | 2.222 | 1.113 | 0.01 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 1 | bright_nlm | 1.555 | 37.036 | 0.91744 | 0.96601 | 1.582 | 1.083 | -0.37 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 1 | bright_bil | 1.573 | 38.31 | 0.93427 | 0.97379 | 1.628 | 1.055 | 0.01 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 1 | bright_med | 0.8 | 20.901 | 0.8194 | 0.43109 | 1.629 | 0.7 | 0.04 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 2 | brighten | 3.497 | 33.722 | 0.8076 | 0.95461 | 2.913 | 1.121 | -0.16 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 2 | bright_nlm | 2.358 | 33.43 | 0.82093 | 0.92666 | 1.911 | 1.018 | -0.26 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 2 | bright_bil | 2.259 | 35.255 | 0.87049 | 0.96425 | 2.031 | 1.014 | -0.16 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 2 | bright_med | 1.128 | 20.931 | 0.79868 | 0.43602 | 1.934 | 0.629 | -0.11 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 3 | brighten | 4.431 | 30.749 | 0.69322 | 0.93453 | 3.991 | 1.18 | -0.78 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 3 | bright_nlm | 3.14 | 30.287 | 0.69716 | 0.8458 | 2.241 | 0.918 | -0.33 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 3 | bright_bil | 3.083 | 32.049 | 0.76866 | 0.94814 | 2.682 | 0.988 | -0.77 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 3 | bright_med | 1.611 | 20.961 | 0.74821 | 0.43188 | 2.591 | 0.568 | -0.71 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 4 | brighten | 5.578 | 27.74 | 0.56861 | 0.90313 | 5.605 | 1.418 | -0.52 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 4 | bright_nlm | 3.978 | 27.527 | 0.57234 | 0.73764 | 2.791 | 0.892 | -0.89 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 4 | bright_bil | 3.978 | 28.724 | 0.64129 | 0.92196 | 3.777 | 1.074 | -0.52 |
card_04_clean.png | clean | 4 | 768 | 1,024 | 4 | bright_med | 2.321 | 20.933 | 0.65875 | 0.42944 | 3.395 | 0.512 | -0.51 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 0 | retake | 1.658 | 39.61 | 0.94536 | 0.9814 | 1.546 | 1.045 | -0.26 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 1 | brighten | 2.412 | 36.848 | 0.89716 | 0.97253 | 2.137 | 1.098 | 0.02 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 1 | bright_nlm | 1.558 | 37.177 | 0.91874 | 0.97341 | 1.493 | 1.054 | -0.15 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 1 | bright_bil | 1.539 | 38.245 | 0.93322 | 0.97712 | 1.555 | 1.039 | 0.02 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 1 | bright_med | 0.796 | 20.899 | 0.81991 | 0.4288 | 1.476 | 0.718 | 0.05 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 2 | brighten | 3.418 | 33.728 | 0.80667 | 0.95959 | 2.919 | 1.14 | -0.3 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 2 | bright_nlm | 2.373 | 33.607 | 0.82641 | 0.95052 | 1.838 | 1.022 | -1.45 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 2 | bright_bil | 2.205 | 35.221 | 0.86861 | 0.96726 | 1.97 | 1.023 | -0.27 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 2 | bright_med | 1.128 | 20.93 | 0.79829 | 0.4346 | 1.89 | 0.657 | -0.19 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 3 | brighten | 4.349 | 30.785 | 0.69229 | 0.94299 | 3.999 | 1.251 | -0.62 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 3 | bright_nlm | 3.212 | 30.457 | 0.7052 | 0.89776 | 2.134 | 0.952 | -0.98 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 3 | bright_bil | 3.018 | 32.068 | 0.76729 | 0.95401 | 2.644 | 1.032 | -0.62 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 3 | bright_med | 1.6 | 20.96 | 0.74879 | 0.43384 | 2.474 | 0.599 | -0.61 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 4 | brighten | 5.618 | 27.774 | 0.56662 | 0.91305 | 5.603 | 1.429 | -0.6 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 4 | bright_nlm | 3.978 | 27.573 | 0.58041 | 0.78694 | 2.447 | 0.802 | -1.19 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 4 | bright_bil | 4.01 | 28.801 | 0.64306 | 0.92857 | 3.686 | 1.039 | -0.61 |
card_05_clean.png | clean | 5 | 768 | 1,024 | 4 | bright_med | 2.321 | 20.941 | 0.65857 | 0.43003 | 3.257 | 0.53 | -0.61 |
card_06_clean.png | clean | 6 | 768 | 1,024 | 0 | retake | 1.658 | 39.528 | 0.94543 | 0.97111 | 1.588 | 1.067 | -0.08 |
card_06_clean.png | clean | 6 | 768 | 1,024 | 1 | brighten | 2.539 | 36.812 | 0.89827 | 0.95805 | 2.195 | 1.122 | -0.16 |
card_06_clean.png | clean | 6 | 768 | 1,024 | 1 | bright_nlm | 1.544 | 37.154 | 0.92242 | 0.94307 | 1.47 | 1.048 | -0.78 |
card_06_clean.png | clean | 6 | 768 | 1,024 | 1 | bright_bil | 1.562 | 38.325 | 0.93592 | 0.96628 | 1.566 | 1.064 | -0.16 |
card_06_clean.png | clean | 6 | 768 | 1,024 | 1 | bright_med | 0.796 | 21.818 | 0.81354 | 0.45462 | 1.428 | 0.759 | -0.13 |
card_06_clean.png | clean | 6 | 768 | 1,024 | 2 | brighten | 3.56 | 33.688 | 0.80818 | 0.94027 | 3.029 | 1.142 | 0.46 |
card_06_clean.png | clean | 6 | 768 | 1,024 | 2 | bright_nlm | 2.386 | 33.434 | 0.82634 | 0.84787 | 1.823 | 0.989 | 0.96 |
card_06_clean.png | clean | 6 | 768 | 1,024 | 2 | bright_bil | 2.279 | 35.268 | 0.87237 | 0.95254 | 2.034 | 1.029 | 0.5 |
card_06_clean.png | clean | 6 | 768 | 1,024 | 2 | bright_med | 1.159 | 21.841 | 0.79214 | 0.45647 | 1.971 | 0.67 | 0.57 |
card_06_clean.png | clean | 6 | 768 | 1,024 | 3 | brighten | 4.484 | 30.759 | 0.69546 | 0.9168 | 4.069 | 1.201 | -0.13 |
card_06_clean.png | clean | 6 | 768 | 1,024 | 3 | bright_nlm | 3.166 | 30.239 | 0.69906 | 0.73043 | 2.223 | 0.929 | -0.34 |
card_06_clean.png | clean | 6 | 768 | 1,024 | 3 | bright_bil | 3.111 | 32.1 | 0.77217 | 0.93439 | 2.685 | 1.017 | -0.11 |
card_06_clean.png | clean | 6 | 768 | 1,024 | 3 | bright_med | 1.614 | 21.865 | 0.74321 | 0.45093 | 2.481 | 0.597 | -0.05 |
card_06_clean.png | clean | 6 | 768 | 1,024 | 4 | brighten | 5.731 | 27.745 | 0.57075 | 0.87542 | 5.709 | 1.439 | -1.11 |
card_06_clean.png | clean | 6 | 768 | 1,024 | 4 | bright_nlm | 3.964 | 27.469 | 0.57208 | 0.611 | 2.571 | 0.869 | -1.35 |
- Medians over 30 cards (verbatim output)
- The simulated camera
- Fields (
data/dark-selfie-2026-11-14.jsonl) - The script (
dark_selfie.py) - Previous config:
placeholders(2026-11-13) - Previous config:
encode_ladder(2026-11-12) - Previous config:
caption_contrast(2026-11-11) - Previous config:
test_cards(2026-11-09) - Files
- The evaluation script
- Usage
- Price facts in this snapshot
- Known caveats
- License and attribution
Malfoid AI Dark Selfie 2026-11-14: Brighten a Dark Photo or Retake It? 510 Simulated Captures, 4 Fixes, Noise Measured on the Face
Snapshot built November 14, 2026, around 18:00 CST (UTC+8), by the builder of malfoidai.com, an independent, unofficial studio for still Malfoid (Female Malfoy / Fem Draco) portraits. First-party measurements on synthetic images and a simulated camera, not an independent benchmark. Dataset card v10.
Short answer: the new default config, dark_selfie, has 510 rows: each of the 30 synthetic test_cards photographed by a simple simulated phone sensor in good light (the "retake") and 1, 2, 3 and 4 stops darker, with each dark capture then fixed four ways (brighten only; brighten + non-local-means denoise; brighten + bilateral; brighten + 3×3 median). Every row scores the result against the clean card: luma PSNR and SSIM, SSIM over the hair box, noise on the face, and hf_ratio, the fine-texture energy on the face relative to the clean card. It answers a question people ask before uploading a selfie to a one-photo portrait generator: my photo is dark; should I brighten it or take it again?
The studio's photo guide says: "If the photo is dark, retake it rather than brightening it in an editor. Brightening a dark photo adds noise, and the studio reads noise as detail." This config puts numbers on that sentence. What they say (all computed by dark_selfie.py, below):
- No fix beat the retake. On SSIM, brighten-only, NLM and bilateral matched or beat the good-light capture on 0 of 30 cards at every darkness from 1 to 4 stops. The median filter "won" on 2 cards at 1 stop only by flattening everything; its hair SSIM is 0.43.
- Brightening multiplies the noise on the face: median face noise 1.57 (retake) → 2.18 (1 stop) → 2.95 (2 stops) → 3.98 (3 stops) → 5.60 at 4 stops, 3.6× the retake.
- That noise is read as detail. Face
hf_ratio(1.0 = the scene's own texture) goes 1.07 → 1.11 → 1.14 → 1.21 → 1.43: at 4 stops under, the brightened face has 43% more fine texture than the scene had. That's invented skin texture a generator can't tell from the real thing. - Denoisers trade noise for hair. NLM brings face noise down (2.58 at 4 stops) but costs the strands: hair SSIM 0.72 vs 0.90 for brighten-only. Bilateral keeps the hair best (0.92 at 4 stops) but removes less of the noise (face noise 3.71). The median filter erases 1-px strands at any darkness.
- One stop under is nearly harmless with a bilateral pass (SSIM 0.935 vs 0.945 for the retake). Two or more stops is where "retake it" stops being a style preference.
The older configs are unchanged and carried forward. I re-ran verify_facts.py against the live site today: 30 records, 11 pages, 0 missing or gone, 0 page-date changes.
Medians over 30 cards (verbatim output)
510 rows from 30 cards. Medians over cards; 'retake' is the 0-stop capture.
stops method psnr_y ssim ssim_hair face_noise hf_ratio
0 retake 39.59 0.9454 0.9774 1.57 1.07
1 brighten 36.83 0.8977 0.9677 2.18 1.11
1 bright_nlm 37.13 0.9200 0.9607 1.48 1.06
1 bright_bil 38.31 0.9350 0.9740 1.57 1.06
1 bright_med 21.34 0.8174 0.4312 1.50 0.74
2 brighten 33.72 0.8083 0.9531 2.95 1.14
2 bright_nlm 33.49 0.8254 0.9145 1.82 1.01
2 bright_bil 35.26 0.8710 0.9641 2.00 1.03
2 bright_med 21.38 0.7964 0.4343 1.94 0.66
3 brighten 30.76 0.6947 0.9319 3.98 1.21
3 bright_nlm 30.29 0.7011 0.8357 2.16 0.93
3 bright_bil 32.09 0.7703 0.9473 2.64 1.03
3 bright_med 21.40 0.7462 0.4340 2.49 0.60
4 brighten 27.76 0.5707 0.8990 5.60 1.43
4 bright_nlm 27.50 0.5774 0.7156 2.58 0.87
4 bright_bil 28.79 0.6446 0.9184 3.71 1.07
4 bright_med 21.36 0.6570 0.4297 3.33 0.54
1 stops under: cards where the fix matches or beats the retake on SSIM: brighten 0/30, bright_nlm 0/30, bright_bil 0/30, bright_med 2/30
2 stops under: cards where the fix matches or beats the retake on SSIM: brighten 0/30, bright_nlm 0/30, bright_bil 0/30, bright_med 0/30
3 stops under: cards where the fix matches or beats the retake on SSIM: brighten 0/30, bright_nlm 0/30, bright_bil 0/30, bright_med 0/30
4 stops under: cards where the fix matches or beats the retake on SSIM: brighten 0/30, bright_nlm 0/30, bright_bil 0/30, bright_med 0/30
face_noise is the standard deviation of the luma error inside the inner 60% of each card's face_box_px, after removing its local mean (so a slight exposure offset doesn't count as noise). hf_ratio is the mean squared 3×3 Laplacian in the same box, divided by the clean card's. SSIM is the standard Gaussian SSIM (σ 1.5) on Rec.601 luma.
The simulated camera
Each card is treated as a scene in linear light. A capture at s stops under scales it by 2−s, draws Poisson photon noise for a full well of 3,000 electrons at white, adds Gaussian read noise (σ 3 e⁻), converts back to 8-bit sRGB and saves a JPEG at quality 90, like a phone would. "Brighten" multiplies the decoded JPEG by 2s in linear light, the same thing an exposure slider does. The denoisers get their strength from the measured noise of the brightened file (Immerkær-style Laplacian MAD), so the comparison isn't tuned per card. The RNG is seeded from the card number and the stop count; rebuilding gives identical rows (the test checks it).
Fields (data/dark-selfie-2026-11-14.jsonl)
| Field | Type | Meaning |
|---|---|---|
file_name, variant, seed |
string, string, int | The test card (see test_cards below) |
width, height |
int | 768 × 1024 (square cards 1024 × 1024) |
stops_under |
int | 0 for the retake, 1–4 for dark captures |
method |
string | retake, brighten, bright_nlm, bright_bil, bright_med |
noise_est |
float | Estimated noise σ of the output (8-bit luma units), whole frame |
psnr_y, ssim, ssim_hair |
float | Against the clean card; ssim_hair uses regions.hair |
face_noise |
float | Noise σ inside the inner 60% of the face box |
hf_ratio |
float | Face fine-texture energy / the clean card's (1.0 = same texture) |
face_mean_shift |
float | Mean luma error in the face box (exposure left over after the fix) |
from datasets import load_dataset
rows = load_dataset("conan123/malfoidai-guides", "dark_selfie", split="train")
two = rows.filter(lambda r: r["stops_under"] == 2)
print(sorted({(r["method"], round(r["face_noise"], 1)) for r in two})[:5])
The script (dark_selfie.py)
#!/usr/bin/env python3
"""Brighten a dark photo, or retake it? A simulated-capture benchmark on the
30 synthetic test cards.
Each card stands in for a well-lit scene. A simple phone-sensor model
(linear light, Poisson photon noise, Gaussian read noise, 8-bit sRGB, JPEG
q90) "photographs" it at 0 stops (good light) and at 1-4 stops under.
The dark captures are then fixed four ways and compared with the scene:
retake the 0-stop capture (what "take it again in better light" gives)
brighten linear gain 2**stops on the dark JPEG
bright_nlm brighten, then OpenCV fastNlMeansDenoisingColored (h from the
measured noise of the brightened file)
bright_bil brighten, then a bilateral filter (d 7, sigmas from the noise)
bright_med brighten, then a 3x3 median
Scores are against the clean card: PSNR and SSIM on luma, SSIM over the
hair box (fine strands = detail you want to keep), noise in the face box
(std of the error after removing its local mean) and `hf_ratio`: the
face-box high-frequency energy relative to the clean card. 1.0 = the same
texture as the scene; >1 = invented texture (noise a model may read as skin
detail); <1 = smoothed away.
pip install pillow numpy opencv-python-headless
python dark_selfie.py data/test-cards-2026-11-09 > data/dark-selfie-2026-11-14.jsonl
python dark_selfie.py --summary data/dark-selfie-2026-11-14.jsonl
Deterministic: the noise RNG is seeded from the card number and stop count.
"""
import io
import json
import os
import statistics as st
import sys
import cv2
import numpy as np
from PIL import Image
FULL_WELL = 3000.0 # electrons at sRGB white for a well-exposed capture
READ_NOISE = 3.0 # electrons, Gaussian
JPEG_Q = 90
STOPS = (1, 2, 3, 4)
METHODS = ("brighten", "bright_nlm", "bright_bil", "bright_med")
def to_lin(a):
a = a / 255.0
return np.where(a <= 0.04045, a / 12.92, ((a + 0.055) / 1.055) ** 2.4)
def to_srgb(l):
l = np.clip(l, 0, 1)
return 255.0 * np.where(l <= 0.0031308, 12.92 * l, 1.055 * l ** (1 / 2.4) - 0.055)
def jpeg(a, q=JPEG_Q):
b = io.BytesIO()
Image.fromarray(np.clip(np.rint(a), 0, 255).astype(np.uint8)).save(b, "JPEG", quality=q)
return np.asarray(Image.open(io.BytesIO(b.getvalue())).convert("RGB"), dtype=np.float64)
def capture(scene_lin, stops, rng):
"""Photograph a linear scene `stops` under good exposure; returns 8-bit sRGB (float)."""
e = scene_lin * FULL_WELL * 2.0 ** -stops
e = rng.poisson(e).astype(np.float64) + rng.normal(0, READ_NOISE, e.shape)
return jpeg(to_srgb(e / (FULL_WELL * 2.0 ** -stops) * 2.0 ** -stops))
def brighten(dark, stops):
return np.clip(np.rint(to_srgb(to_lin(dark) * 2.0 ** stops)), 0, 255)
def noise_sigma(a):
"""Robust noise estimate (Immerkaer-style Laplacian MAD) on luma, 8-bit units."""
y = luma(a)
lap = cv2.Laplacian(y.astype(np.float32), cv2.CV_32F, ksize=1)
return float(1.4826 * np.median(np.abs(lap - np.median(lap))) / np.sqrt(20))
def fix(dark, stops, method):
b = brighten(dark, stops)
if method == "brighten":
return b
u8 = b.astype(np.uint8)
s = max(noise_sigma(b), 1.0)
if method == "bright_nlm":
h = float(min(30.0, 1.2 * s))
out = cv2.fastNlMeansDenoisingColored(u8, None, h, h, 7, 21)
elif method == "bright_bil":
out = cv2.bilateralFilter(u8, 7, float(min(80.0, 3.0 * s)), 3.0)
elif method == "bright_med":
out = cv2.medianBlur(u8, 3)
return out.astype(np.float64)
def luma(a):
return a[..., 0] * 0.299 + a[..., 1] * 0.587 + a[..., 2] * 0.114
def _blur(x, sigma=1.5):
return cv2.GaussianBlur(x, (0, 0), sigma, borderType=cv2.BORDER_REFLECT)
def ssim_map(x, y):
C1, C2 = (0.01 * 255) ** 2, (0.03 * 255) ** 2
mx, my = _blur(x), _blur(y)
sxx, syy, sxy = _blur(x * x) - mx * mx, _blur(y * y) - my * my, _blur(x * y) - mx * my
return ((2 * mx * my + C1) * (2 * sxy + C2)) / ((mx * mx + my * my + C1) * (sxx + syy + C2))
def psnr(x, y):
mse = float(np.mean((x - y) ** 2))
return 99.0 if mse == 0 else 10 * np.log10(255 ** 2 / mse)
def hf_energy(y):
"""Mean squared response of a 3x3 Laplacian: fine texture."""
return float(np.mean(cv2.Laplacian(y.astype(np.float32), cv2.CV_32F, ksize=1) ** 2))
def score(ref, out, meta):
H, W = ref.shape[:2]
ry, oy = luma(ref), luma(out)
m = ssim_map(ry, oy)
x0, y0, x1, y1 = meta["regions"]["hair"]
hair = (slice(int(y0 * H), int(y1 * H)), slice(int(x0 * W), int(x1 * W)))
fx, fy, fw, fh = meta["face_box_px"]
# inner 60% of the face box: skin only, no hairline or jaw edge
face = (slice(fy + int(0.2 * fh), fy + int(0.8 * fh)), slice(fx + int(0.2 * fw), fx + int(0.8 * fw)))
err = oy - ry
err_f = err[face] - _blur(err, 4.0)[face]
return {"psnr_y": round(psnr(ry, oy), 3), "ssim": round(float(m.mean()), 5),
"ssim_hair": round(float(m[hair].mean()), 5),
"face_noise": round(float(err_f.std()), 3),
"hf_ratio": round(hf_energy(oy[face]) / max(hf_energy(ry[face]), 1e-6), 3),
"face_mean_shift": round(float(err[face].mean()), 2)}
def rows_for(path, meta):
ref = np.asarray(Image.open(path).convert("RGB"), dtype=np.float64)
lin = to_lin(ref)
base = {"file_name": meta["file_name"], "variant": meta["variant"], "seed": meta["seed"],
"width": ref.shape[1], "height": ref.shape[0]}
rng = np.random.default_rng(1000 * meta["card"])
good = capture(lin, 0, rng)
yield {**base, "stops_under": 0, "method": "retake", "noise_est": round(noise_sigma(good), 3),
**score(ref, good, meta)}
for s in STOPS:
rng = np.random.default_rng(1000 * meta["card"] + s)
dark = capture(lin, s, rng)
for mth in METHODS:
out = fix(dark, s, mth)
yield {**base, "stops_under": s, "method": mth, "noise_est": round(noise_sigma(out), 3),
**score(ref, out, meta)}
def summary(rows):
n = len({r["file_name"] for r in rows})
out = [f"{len(rows)} rows from {n} cards. Medians over cards; 'retake' is the 0-stop capture.", "",
f"{'stops':>5} {'method':<11} {'psnr_y':>7} {'ssim':>7} {'ssim_hair':>9} {'face_noise':>10} {'hf_ratio':>8}"]
order = ("retake",) + METHODS
keys = sorted({(r["stops_under"], r["method"]) for r in rows}, key=lambda k: (k[0], order.index(k[1])))
for s, mth in keys:
g = [r for r in rows if r["stops_under"] == s and r["method"] == mth]
md = lambda k: st.median(r[k] for r in g)
out.append(f"{s:>5} {mth:<11} {md('psnr_y'):>7.2f} {md('ssim'):>7.4f} {md('ssim_hair'):>9.4f} "
f"{md('face_noise'):>10.2f} {md('hf_ratio'):>8.2f}")
retake = {r["file_name"]: r for r in rows if r["method"] == "retake"}
out.append("")
for s in STOPS:
beats = []
for mth in METHODS:
g = [r for r in rows if r["stops_under"] == s and r["method"] == mth]
k = sum(r["ssim"] >= retake[r["file_name"]]["ssim"] for r in g)
beats.append(f"{mth} {k}/{len(g)}")
out.append(f"{s} stops under: cards where the fix matches or beats the retake on SSIM: " + ", ".join(beats))
return "\n".join(out)
def main():
a = sys.argv[1:]
if a and a[0] == "--summary":
print(summary([json.loads(l) for l in open(a[1])]))
return
d = a[0] if a else "data/test-cards-2026-11-09"
for l in open(os.path.join(d, "metadata.jsonl")):
meta = json.loads(l)
for row in rows_for(os.path.join(d, meta["file_name"]), meta):
print(json.dumps(row))
if __name__ == "__main__":
main()
test_dark_selfie.py (3 pytest tests) checks the sRGB round trip, that a capture lands at the right mean level, that rows are deterministic, that face noise rises monotonically with darkness after brightening and that NLM lowers it at every darkness.
How to use it on a real photo
You can't compute these scores on your own selfie (there's no clean reference), but the ranking carries over: a photo that needs more than about a stop of brightening is a photo to retake. Facing a window in daylight, or outside in the shade, is what the photo guide recommends. If you must use a dark photo, brighten it and apply a light bilateral or NLM pass rather than uploading it brightened and noisy, and don't use a median filter on hair. The help page lists "a dark, small, filtered or angled face" as the usual reason a portrait doesn't look like the person.
Previous config: placeholders (2026-11-13)
Short answer: the config placeholders, has 900 rows: each of the 30 synthetic test_cards × 30 placeholder settings. A placeholder (LQIP, "low-quality image placeholder") is what a page shows in the 3:4 slot before the real portrait loads: one average colour, a BlurHash string, a ThumbHash, or a tiny WebP / AVIF / JPEG inlined as a data: URI. Every row has the payload itself, its size in the HTML attribute, whether it needs a JavaScript decoder, and how far the decoded placeholder is from the real picture in CIELAB (ΔE, whole frame and face / hair / tie boxes). It answers a question people ask when they put a portrait on a site: which placeholder should I use, and what does it cost?
What the numbers say on these cards (all computed by lqip_bench.py):
- A 12–16 px WebP data URI is the best value if you can spend ~200–250 bytes. Median ΔE 8.8–9.3, against 15.9 for ThumbHash and 21.5 for BlurHash 3×4, and it needs no JavaScript. On every one of the 30 cards, some tiny WebP beat ThumbHash's error; the cheapest one that did was a median 165 bytes (most often 8 px wide at q20).
- ThumbHash beats BlurHash at the same size (45 vs 44 bytes in the attribute; ΔE 15.9 vs 21.5) and keeps the aspect ratio. But on these portraits it's worse on the hair (ΔE 32.5 vs 19.8): its luminance terms smear the platinum hair into the background.
- BlurHash implementations disagree. The npm
blurhashpackage (2.0.5) scales AC terms by the largest signed value; the C reference encoder uses the largest magnitude. With the npm rule, strong negative terms get clipped, and the placeholder was worse on 120 of 120 card × size combinations (ΔE 27.7 vs 21.5 at 3×4). Both produce valid strings; the difference is only in the encoder. - More BlurHash components help less than you'd think: 5×7 (90 bytes) gets ΔE 19.8 vs 21.5 for 3×4.
- AVIF has a big fixed overhead at this size. A 16 px AVIF data URI is about 577 bytes vs 243 for WebP at similar error. At thumbnail sizes, AVIF's container costs more than its compression saves. Tiny JPEG is in between.
- The average colour alone (26 bytes) is ΔE 30.6. Fine for a background, useless as a preview.
lqip.py (NumPy port of BlurHash and ThumbHash) was cross-checked against the npm packages (blurhash 2.0.5, thumbhash 0.1.1) with crosscheck_js.py: 37 of 38 cases identical. The full v9 card, with the cross-check output and the lqip_bench.py listing, is at README.md, revision 1b832a8.
Medians over 30 cards (verbatim output)
900 rows from 30 cards. Median over cards (dE = CIE76 vs the card box-filtered to 30x40).
placeholder HTML B dE p90 face hair tie JS?
avg 26 30.62 50.63 41.05 49.31 32.70 no
blurhash 3x4 abs 44 21.47 37.60 18.86 19.75 23.14 yes
blurhash 3x4 ts 44 27.68 39.36 21.36 23.67 24.03 yes
blurhash 4x3 abs 44 21.50 37.84 20.45 18.73 22.95 yes
blurhash 4x3 ts 44 27.84 38.08 23.40 23.02 23.62 yes
blurhash 4x5 abs 60 21.16 37.45 18.50 19.29 23.96 yes
blurhash 4x5 ts 60 27.23 39.20 20.91 23.43 24.36 yes
blurhash 5x7 abs 90 19.76 37.31 14.15 16.94 23.57 yes
blurhash 5x7 ts 90 25.69 38.27 16.55 20.63 22.64 yes
thumbhash 45 15.87 29.63 19.73 32.46 22.27 yes
tiny webp 8px q20 165 11.39 24.68 19.18 16.13 25.23 no
tiny webp 8px q40 177 10.81 22.43 16.27 16.30 25.10 no
tiny webp 8px q60 189 10.28 21.48 15.43 16.98 24.88 no
tiny webp 12px q20 173 10.27 20.43 14.19 12.59 26.31 no
tiny webp 12px q40 197 9.26 18.58 13.32 12.15 25.23 no
tiny webp 12px q60 213 8.74 18.20 12.00 11.96 26.03 no
tiny webp 16px q20 209 10.56 21.69 18.80 10.81 22.27 no
tiny webp 16px q40 243 8.81 19.76 14.72 11.13 20.97 no
tiny webp 16px q60 269 8.35 16.89 12.88 11.15 21.72 no
tiny webp 24px q20 253 7.25 14.37 12.79 7.60 20.55 no
tiny webp 24px q40 293 6.30 11.59 9.26 7.30 16.30 no
tiny webp 24px q60 333 5.62 11.25 8.81 6.77 15.79 no
tiny webp 32px q20 329 5.89 10.59 8.87 5.36 13.00 no
tiny webp 32px q40 399 5.18 9.57 8.31 5.13 10.63 no
tiny webp 32px q60 463 4.43 8.97 7.04 4.91 10.40 no
tiny avif 12px q40 557 9.14 18.48 12.90 11.44 25.37 no
tiny avif 16px q40 577 7.69 15.81 10.37 9.01 22.17 no
tiny avif 24px q40 657 5.60 10.66 7.07 6.78 15.72 no
tiny jpeg 16px q40 563 9.28 16.70 11.77 12.06 22.95 no
tiny jpeg 24px q40 641 6.67 12.85 9.75 8.64 19.82 no
BlurHash npm-style signed max vs C-reference abs max: worse on 120/120 card x size pairs, identical on 0
Cheapest tiny image beating ThumbHash's mean dE: median 165 B (30/30 cards); most common setting: webp 8px q20
Fields (data/placeholders-2026-11-13.jsonl)
| Field | Type | Meaning |
|---|---|---|
file_name, variant, seed |
string, string, int | The test card (see test_cards below) |
method |
string | avg, blurhash, thumbhash, tiny |
setting |
string | e.g. 3x4 abs, 3x4 ts, webp 16px q40; empty for avg and thumbhash |
params |
object | cx, cy, max_mode (abs = C reference, ts = npm package) for BlurHash; format, width, quality for tiny images |
needs_js_decoder |
bool | True for BlurHash and ThumbHash |
payload |
string | The placeholder itself: hex colour, BlurHash string, ThumbHash base64 or the full data: URI |
html_bytes |
int | Length of the HTML attribute carrying it |
de_mean, de_p90 |
float | CIE76 ΔE vs the card on a 30 × 40 grid: mean and 90th percentile |
de_face, de_hair, de_tie |
float | Mean ΔE inside the face box, hair box and tie box |
encode_ms |
float | Wall-clock time to make the placeholder on the build machine; compare only within this file |
Settings: BlurHash is computed on the card box-filtered to fit 32 px (24 × 32), ThumbHash on the card box-filtered to fit 100 px (75 × 100), tiny images with Lanczos at the given width (WebP method=6, JPEG optimize=True, AVIF Pillow default speed). Pillow 13.0.
Previous config: encode_ladder (2026-11-12)
Short answer: the config encode_ladder has 1,320 rows: each of the 30 synthetic test_cards at 2 widths (768 px, the 1K 3:4 frame, and 384 px for a blog column) × 22 encodes (JPEG q50–95, WebP q50–95, AVIF q40–90, lossless PNG and lossless WebP). Every row has the file size, bits per pixel, luma PSNR, whole-frame SSIM and SSIM over the hair box, because fine platinum strands are where compression shows first. It answers a question people ask before putting a portrait on a site or in a chat: what format and quality should I export, and how big will it be?
What the numbers say on these cards (all computed by encode_ladder.py). The target is median hair SSIM ≥ 0.98:
- At 768 px: AVIF q60 ≈ 36 KB, WebP q85 ≈ 63 KB, JPEG q90 ≈ 126 KB. All three reach the same hair quality. AVIF is about 3.5× smaller than JPEG there, and lossless PNG is 172 KB.
- At 384 px you need higher quality settings (JPEG q95, WebP q90, AVIF q80). Halving the width packs the strands closer together, so the same quality setting loses more of them. A small thumbnail exported at "q80 like the big one" looks worse than you'd expect.
- AVIF's quality scale is steep. q40 → q60 at 768 px goes from 0.93 to 0.99 hair SSIM, so don't copy JPEG numbers into an AVIF setting.
- AVIF is the slowest: median 279 ms per 768 px encode here, against 45 ms for WebP and 4 ms for JPEG. That doesn't matter for one export, but it does for a batch job on every upload.
- Lossless WebP is 36% smaller than optimised PNG (111 vs 172 KB) for an identical picture. If you need lossless (for example before further editing), WebP lossless is the cheaper archive.
Lowest quality reaching median hair SSIM ≥ 0.98 (verbatim output)
1320 rows from 30 cards. Per format: lowest quality whose MEDIAN ssim_hair >= 0.98, and median size there.
width 768px
format quality median KB median ssim ssim_hair worst hair
jpeg 90 126.0 0.9765 0.9812 0.9757
webp 85 63.4 0.9786 0.9865 0.9793
avif 60 36.1 0.9906 0.9919 0.9754
png - 172.1 1.0000 1.0000 1.0000
webp_lossless - 110.6 1.0000 1.0000 1.0000
width 384px
format quality median KB median ssim ssim_hair worst hair
jpeg 95 44.0 0.9925 0.9906 0.9875
webp 90 21.1 0.9894 0.9849 0.9799
avif 80 18.0 0.9898 0.9845 0.9793
png - 118.4 1.0000 1.0000 1.0000
webp_lossless - 76.5 1.0000 1.0000 1.0000
Fields (data/encode-ladder-2026-11-12.jsonl)
| Field | Type | Meaning |
|---|---|---|
file_name, variant, seed |
string, string, int | The test card (see test_cards below) |
width, height |
int | Encoded size: 768 × 1024 (native) or 384 × 512 (Lanczos); square cards are 768 × 768 / 384 × 384 |
format |
string | jpeg, webp, avif, png, webp_lossless |
quality |
int or null | Encoder quality (null for lossless) |
bytes, bpp |
int, float | File size, and bits per pixel |
ssim |
float | Gaussian SSIM (σ 1.5) on Rec.601 luma, whole frame, vs the uncompressed image at the same width |
ssim_hair |
float | Mean of the same SSIM map over the card's regions.hair box |
psnr_y |
float | Luma PSNR in dB (99 = identical) |
encode_ms |
float | Wall-clock encode time on the build machine; compare only within this file |
Encoder settings: Pillow 13.0, JPEG optimize=True with Pillow's default chroma subsampling, WebP method=4, AVIF speed=6 (Pillow's bundled libavif), PNG optimize=True.
The script is encode_ladder.py in the repo root (full listing and usage in the 2026-11-12 card revision).
Previous config: caption_contrast (2026-11-11)
Short answer: the config caption_contrast has 2,160 rows: each of the 30 synthetic test_cards x 9 caption placements (a 3x3 grid) x 4 text colours (white, black, silver #C0C0C0, tie green #1A5C34) x 2 treatments (no scrim, 50% black scrim). Every row holds the WCAG 2.x contrast ratio between the text colour and the pixels behind the caption box: the median and the 10th percentile (the darkest or brightest tenth, where letters actually get lost). It answers a question people ask before posting a portrait with a caption: where can the words go, and in what colour?
What the numbers say on these cards (all values computed by caption_contrast.py):
- Top corners and top-centre: white or silver text passes AA (p10 >= 4.5) on 30 of 30 cards with no scrim (median p10 for white: 13.0-14.9). The dark corridor above the head is the safest caption area.
- Bottom-left / bottom-right: white or silver passes on 28 of 30 (the 2 failures are the
squarecards, where the robe edge moves). - Middle-left / middle-right (beside the face): no colour passes without a scrim (white p10 1.35). The cell straddles the platinum hair and the dark background, so any single colour vanishes on one half. A 50% black scrim fixes it for white (p10 5.03, 30 of 30).
- Bottom-centre (over the shirt and tie): nothing reliably passes, even white with a scrim (2 of 30). Don't caption over the tie.
- Tie green as a text colour fails AA in every cell (median p10 1.0-2.8). The "house colour" is a fill colour, not a caption colour, on a dark portrait.
Share of cards passing WCAG AA (p10 >= 4.5) by placement (verbatim output)
2160 rows from 30 cards. Share of cards where p10 contrast >= 4.5 (WCAG AA, normal text):
scrim=none
cell white black silver green
top-left 100% 0% 100% 0%
top-centre 100% 0% 100% 0%
top-right 100% 0% 100% 0%
middle-left 0% 0% 0% 0%
middle-centre 0% 100% 0% 0%
middle-right 0% 0% 0% 0%
bottom-left 93% 0% 93% 0%
bottom-centre 0% 7% 0% 0%
bottom-right 93% 0% 93% 0%
scrim=black50
cell white black silver green
top-left 100% 0% 100% 0%
top-centre 100% 0% 100% 0%
top-right 100% 0% 100% 0%
middle-left 100% 0% 0% 0%
middle-centre 100% 0% 0% 0%
middle-right 100% 0% 0% 0%
bottom-left 100% 0% 93% 0%
bottom-centre 7% 0% 0% 0%
bottom-right 100% 0% 93% 0%
Fields (data/caption-contrast-2026-11-11.jsonl)
| Field | Type | Meaning |
|---|---|---|
file_name, variant, seed |
string, string, int | The test card (see test_cards below) |
width, height |
int | Card size in px (768 x 1024, or 1024 x 1024 for square) |
row, col |
string | top / middle / bottom and left / centre / right |
box |
list | Caption box [x, y, w, h] in px: w = W/3, h = H/8; top edge at 3%, 43.75% and 84.5% of H |
scrim |
string | none, or black50 (background darkened by 50% before measuring) |
text_colour |
string | white, black, silver (192,192,192), green (26,92,52) |
contrast_median, contrast_p10 |
float | WCAG 2.x contrast ratio, text vs each background pixel: median and 10th percentile |
background_luma_std |
float | Std-dev of Rec.601 luma in the box (how busy it is), scrim none |
aa_large_p10, aa_normal_p10 |
bool | p10 >= 3.0 (AA large text) and p10 >= 4.5 (AA normal text) |
The script is caption_contrast.py in the repo root.
Previous config: test_cards (2026-11-09)
What's in test_cards
| Variant | Cards | What was done | Expected gate verdict |
|---|---|---|---|
clean |
8 (seeds 1–8) | Nothing. These are the golden batch. | PASS |
text |
12 (seeds 9–20) | One line of 4–9 nonsense capitals (14–34 px, slight rotation) pasted on the wall or the robe | PASS (lettering isn't a drift property) |
red_tie |
3 | Tie recoloured red (off-palette) | FAIL |
warm_hair |
3 | Platinum pushed toward yellow | FAIL |
square |
2 | 1024 × 1024 frame instead of 768 × 1024 | FAIL |
soft |
2 | 2x down, then bilinear back up (a soft upscaler) | DRIFT or FAIL |
All cards have thin hair-strand texture, so sharpness metrics behave like they would on a rendered portrait rather than on flat vector shapes.
Fields (data/test-cards-2026-11-09/metadata.jsonl)
| Field | Type | Meaning |
|---|---|---|
file_name |
string | PNG in the same folder (the image column when loaded with datasets) |
card |
int | 1–30 |
variant |
string | clean, text, red_tie, warm_hair, square, soft |
seed |
int | Seed for make_test_portrait.py (face shape and skin tone vary with it) |
texture |
bool | Always true in this snapshot |
width, height |
int | Pixel size |
has_text |
bool | True for the 12 lettering cards |
text |
object or null | text, font_px, box [x, y, w, h] in px, colour RGB, contrast (abs. luma difference between letters and the median of the box background, 0–255) |
regions |
object | Fractions of the frame for hair, tie, background [x0, y0, x1, y1], as used by the gate |
face_box_px |
list | Face ellipse bounding box [x, y, w, h], replayed from the drawing RNG |
expected_gate |
string | PASS, FAIL or DRIFT_OR_FAIL |
Lettering contrast in this set: 10 cards between 140 and 215 (clearly visible) and 2 cards at 6 (near-black on near-black, hard to see even when enlarged).
Baseline results (verbatim)
== stray text (clean + text cards)
false alarm card_02_clean.png
missed card_11_text.png: 'GWFWCDTGB' 25 px, contrast 6
missed card_15_text.png: 'TARCAD' 29 px, contrast 6
missed card_19_text.png: 'WASOV' 30 px, contrast 143
text found 9/12; clean cards flagged 1/8
== preset gate (each card alone vs the 8 clean cards)
card_09_text.png expected PASS got PASS (-)
...
card_20_text.png expected PASS got PASS (-)
card_21_red_tie.png expected FAIL got FAIL (tie_hue,tie_chroma)
card_22_red_tie.png expected FAIL got FAIL (tie_hue,tie_chroma)
card_23_red_tie.png expected FAIL got FAIL (tie_hue,tie_chroma)
card_24_warm_hair.png expected FAIL got FAIL (hair_b)
card_25_warm_hair.png expected FAIL got FAIL (hair_b)
card_26_warm_hair.png expected FAIL got FAIL (hair_b)
card_27_square.png expected FAIL got FAIL (aspect,tie_hue,tie_chroma)
card_28_square.png expected FAIL got FAIL (aspect,tie_hue,tie_chroma)
card_29_soft.png expected DRIFT_OR_FAIL got DRIFT (edge_step)
card_30_soft.png expected DRIFT_OR_FAIL got DRIFT (edge_step)
gate matches expectation on 22/22 cards
(All 12 text cards PASS the gate; the elided lines are identical in form.)
What the baselines get wrong, and why that's useful
- Two contrast-6 misses are near-invisible lettering. A detector that finds them is doing better than a casual human check, which matters if someone brightens or prints the picture.
- The contrast-143 miss (
WASOV) is visible lettering the baseline should catch. That's the interesting failure for anyone building a better detector. - The
card_02false alarm comes from hair-strand texture: some strand fragments pass the letter-size and even-stroke tests and line up. Real portraits will produce more of these (book spines, window frames). squarecards fail on tie colour too, because the tie box is defined in frame fractions and lands on the shirt in a square frame. Correct verdict, noisy explanation. A gate should be read top-down:aspectfirst.- The gate is easy on this set. Each defect is strong and single. Mild, mixed drifts are harder; build them with the
make_cards.pyhelpers (recolour_tie,warm_hair) at smaller strengths.
Files
| Path | What |
|---|---|
data/dark-selfie-2026-11-14.jsonl |
510 dark-capture rows (new, default config) |
dark_selfie.py + test_dark_selfie.py |
Simulated camera, fixes and scoring; builds the rows and prints the summary; 3 pytest tests |
data/placeholders-2026-11-13.jsonl |
900 placeholder rows (2026-11-13) |
lqip_bench.py |
Builds the rows from the test cards and prints the summary |
lqip.py |
BlurHash + ThumbHash encoders/decoders (NumPy port), tiny data URIs, scoring, CLI |
crosscheck_js.py + crosscheck_ref.mjs + test_lqip.py |
Port vs the npm packages under Node; 6 pytest tests with npm-made golden strings |
data/encode-ladder-2026-11-12.jsonl |
1,320 encode rows (2026-11-12) |
encode_ladder.py |
Builds the encode rows and prints the summary |
data/caption-contrast-2026-11-11.jsonl |
2,160 caption-placement rows (2026-11-11) |
caption_contrast.py |
Builds the caption rows and prints the summary |
data/test-cards-2026-11-09/*.png + metadata.jsonl |
The 30 cards and labels (about 5 MB) |
make_cards.py |
Rebuilds the cards exactly (fixed seeds) |
make_test_portrait.py |
The shape-only drawing used for every card |
stray_text.py |
Baseline 1: letter-like marks without OCR (OpenCV) |
preset_regress.py + spec.json |
Baseline 2: batch drift gate (Pillow + NumPy) |
eval_cards.py |
Runs both baselines on the cards |
data/routes-2026-11-05.jsonl, data/pages-2026-11-05.jsonl, make_routes.py, build_corpus.py, route_eval.py |
Question routing set and BM25 baseline (2026-11-05) |
data/facts-2026-11-04.jsonl, data/drift-2026-11-04.jsonl, verify_facts.py |
Dated facts with quotes and drift log; re-verified 2026-11-14 (30 of 30 OK) |
data/review-rubric-2026-11-03.jsonl, data/answer-checks-2026-11-02.jsonl, data/records-2026-10-31.jsonl |
Unchanged |
The evaluation script
#!/usr/bin/env python3
"""Run the two baselines on test_cards and print what they get right.
1. stray_text.py on the 20 clean + text cards: is there letter-like text?
2. preset_regress.py: golden = the 8 clean cards; every other card is
checked alone (a batch of one) against it.
pip install opencv-python-headless pillow numpy
python eval_cards.py data/test-cards-2026-11-09
"""
import json, os, sys
import cv2
import preset_regress as pr
from stray_text import detect
d = sys.argv[1] if len(sys.argv) > 1 else "data/test-cards-2026-11-09"
rows = [json.loads(l) for l in open(os.path.join(d, "metadata.jsonl"))]
spec = json.load(open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "spec.json")))
P = lambda r: os.path.join(d, r["file_name"])
print("== stray text (clean + text cards)")
tp = fn = fp = tn = 0
for r in rows:
if r["variant"] not in ("clean", "text"):
continue
found = detect(cv2.imread(P(r)))
if r["has_text"]:
x, y, w, h = r["text"]["box"]
hit = any(not (b["box"][0] > x + w or b["box"][0] + b["box"][2] < x or
b["box"][1] > y + h or b["box"][1] + b["box"][3] < y) for b in found)
tp += hit; fn += not hit
if not hit:
print(f" missed {r['file_name']}: '{r['text']['text']}' {r['text']['font_px']} px, contrast {r['text']['contrast']}")
else:
fp += bool(found); tn += not found
if found:
print(f" false alarm {r['file_name']}")
print(f" text found {tp}/{tp + fn}; clean cards flagged {fp}/{fp + tn}")
print("== preset gate (each card alone vs the 8 clean cards)")
clean = [P(r) for r in rows if r["variant"] == "clean"]
golden = pr.batch(clean, spec)
ok = 0
checked = [r for r in rows if r["variant"] != "clean"]
for r in checked:
worst, rep = pr.check(spec, golden, pr.batch([P(r)], spec))
got = ["PASS", "DRIFT", "FAIL"][worst]
exp = r["expected_gate"]
good = got == exp or (exp == "DRIFT_OR_FAIL" and got != "PASS")
ok += good
flagged = ",".join(k for k, *_, res in rep if res != "PASS") or "-"
print(f" {r['file_name']:<26} expected {exp:<13} got {got:<5} ({flagged}){'' if good else ' <-- mismatch'}")
print(f" gate matches expectation on {ok}/{len(checked)} cards")
Usage
from datasets import load_dataset
cards = load_dataset("conan123/malfoidai-guides", "test_cards", split="test")
print(cards[0]["variant"], cards[0]["image"].size)
pip install opencv-python-headless pillow numpy
python make_cards.py data/test-cards-2026-11-09 # rebuild (identical files)
python eval_cards.py data/test-cards-2026-11-09 # run both baselines
python verify_facts.py data/facts-2026-11-04.jsonl
To score your own text detector: for each card with has_text, a hit is any predicted box that overlaps text.box; for clean cards, any prediction is a false alarm. Report results by contrast band, since near-invisible lettering is a different problem from visible lettering.
Price facts in this snapshot
From the pricing page and pricing.md, re-read with curl on 2026-11-14 at 17:57 CST (UTC+8) (unchanged since the page's 2026-10-31 update):
- One portrait: $4.99 from a photo or without one, 2 credits, no account needed. One still 3:4 picture at 1K. No watermark is added.
- Packs (sign-in required, one-time, no renewal; the HTML page says "Credits never expire"): 30 credits $13.99, 100 credits $35.99, 200 credits $59.99 (the page shows $0.93, $0.72 and $0.60 per run).
Known caveats
- Dark selfie: the camera is a model. Real phones apply multi-frame noise reduction, tone curves and sharpening before you ever see the file, so a real dark selfie is often cleaner but smeared. The direction (brightening amplifies noise, denoising costs fine detail) holds; the exact numbers won't.
- Dark selfie: one noise level per stop. Full well 3,000 e⁻ and read noise 3 e⁻ are plausible for a small phone sensor, not measured from any specific phone.
- Dark selfie: "the studio reads noise as detail" is the site's own sentence. This file measures the noise and the extra texture in the input; it doesn't run any generator.
- Placeholders: ΔE on a 30 × 40 grid is a proxy. It measures how close the blurred preview is to a blurred version of the picture, not how pleasant the fade-in looks. Placeholders are meant to be blurry; compare them with each other, not with the real image.
- Placeholders: bytes are pre-compression. Your HTML is probably gzipped or Brotli-compressed; base64 data URIs compress less well than BlurHash strings, so the gap narrows a little on the wire.
- Placeholders: decoders cost bytes once per page, not per image. With many images on one page, BlurHash/ThumbHash get relatively cheaper.
- Encode ladder: SSIM is luma only. Chroma loss (JPEG and WebP subsample colour) isn't in
ssim/ssim_hair. The green tie can bleed slightly before the hair SSIM moves. Look at the tie at your chosen setting. - Encode ladder: synthetic cards compress unrealistically well. Flat shapes plus strand texture are kinder than a rendered portrait. Use the ranking, not the byte counts.
- Encoder versions matter. AVIF and WebP results shift between libavif/libwebp releases and speed settings. This file is one build (Pillow 13.0).
- Caption cells are fixed boxes (1/3 width x 1/8 height). A real caption is letter-shaped, so the p10 over the whole box is a conservative proxy for the pixels behind the letters, not a rendering test.
- Contrast is computed per pixel against a flat text colour, without anti-aliasing, outlines or shadows. An outline or drop shadow changes the answer; a scrim is the only treatment measured here.
- Synthetic is not real. Flat shapes plus strand texture are far easier than a rendered portrait. Numbers here are a smoke test for tooling, not a measure of how often real portraits contain lettering or drift.
- Region boxes assume the fixed framing of these cards. On real portraits, recompute them from your own golden batch.
- The labels are mine, generated by the same scripts that draw the cards. They're exact for what was drawn, but "expected gate verdict" reflects my tolerances in
spec.json. - Small: 30 cards. Rebuild more with
make_cards.pyby extendingPLAN.
License and attribution
CC BY 4.0 for data and card text; scripts MIT. Malfoid is unofficial fan art. malfoidai.com is independent and not affiliated with any book, film, studio or author. See the site's FAQ, guides and llms.txt.
- Downloads last month
- 267