Anime4K README

The project's README from github.com/bloc97/Anime4K. As one markdown file: README.md.

Anime4K

Anime4K is a set of open-source, high-quality real-time anime upscaling/denoising algorithms that can be implemented in any programming language.

The simplicity and speed of Anime4K allows the user to watch upscaled anime in real time, as we believe in preserving original content and promoting freedom of choice for all anime fans. Re-encoding anime into 4K should be avoided as it is non-reversible, potentially damages original content by introducing artifacts, takes up to O(n2) more disk space and more importantly, does so without any meaningful decrease in entropy (lost information is lost).

Disclaimer: All art assets used are for demonstration and educational purposes. All rights are reserved to their original owners. If you (as a person or a company) own the art and do not wish it to be associated with this project, please contact us at [email protected] and we will gladly take it down.

Foreword

Anime4K is optimized for native 1080p anime encoded with h.264, h.265 or VC-1.

Even if it might work, it is not optimized for downscaled 720p, 480p or standard definition anime (eg. DVDs). Older anime (especially pre-digital era production) have artifacts that are very difficult to remove, such as bad deinterlacing, camera blur during production, severe ringing, film grain, older MPEG compression artifacts, etc.

This is also not replacement for SRGANs, as they perform much better on low-resolution images or images with lots of degradation (albeit not in real time).

What Anime4K does provide is a way to upscale, in real time, 1080p anime for 4K screens while providing a similar effect to SRGANs and being much better than waifu2x (See comparisons).

Currently, research is being done on better real-time upscaling for lower resolution or older content.

Installation Instructions

Windows

Linux

Mac

v4.1 Low resolution experiment

Results from the experimental SRGAN shaders for 360p -> 4K: (zoom in to view details)

The images are sorted by algorithm speed, bicubic being the fastest. FSRCNNX and Anime4K are real-time while waifu2x and Real-ESRGAN are not. Comparison Comparison

v4

We introduce a line reconstruction algorithm that aims to tackle the distribution shift problem seen in 1080p anime. In the wild anime exhibit a surprising amount of variance caused by low quality compositing due to budget and time constraints that traditional super-resolution algorithms cannot handle. GANs can implicitly encode this distribution shift but are slow to use and hard to train. Our algorithm explicitly corrects this distribution shift and allows traditional "MSE" SR algorithms to work with a wide variety of anime.

Source: https://fancaps.net/anime/picture.php?/14728493 | Mode: B
Comparison

Source: https://fancaps.net/anime/picture.php?/13365760 | Mode: A
Comparison

Performance numbers are obtained using a Vega64 GPU and are tested using UL shader variants. The fast version is for M variants.
Note that CUDA accelerated SRGANs/Waifu2x using tensor cores can be much faster and close to realtime (~80ms), but their large size severely hampers non-CUDA implementations.

v3

The monolithic Anime4K shader is broken into modular components, allowing customization for specific types of anime and/or personal taste. What's new:

More information about each shader (OUTDATED).

Visits

Counting since 2021-09-19T16:02:06Z (ISO 8601)

Projects that use Anime4K

Note that the following might be using an outdated version of Anime4K. There have been significant quality improvements since v3.

Acknowledgements

OpenCV TensorFlow Keras Torch mpv MPC
OpenCV TensorFlow Keras Torch mpv MPC

Many thanks to the OpenCV, TensorFlow, Keras and Torch groups and contributors. This project would not have been possible without the existence of high quality, open source machine learning libraries.

I would also want to specially thank the creators of VDSR and FSRCNN, in addition to the open source projects waifu2x and FSRCNNX for sparking my interest in creating this project. I am also extending my gratitude to the contributors of mpv and MPC-HC/BE for their efforts on creating excellent media players with endless customization options.
Furthermore, I want to thank the people who contributed to this project in any form, be it by reporting bugs, submitting suggestions, helping others' issues or submitting code. I will forever hold you in high regard.

I also wish to express my sincere gratitude to the people of Université de Montréal, DIRO, LIGUM and MILA for providing so many opportunities to students (including me), providing the necessary infrastructure and fostering an excellent learning environment.

I would also like to thank the greater open source community, in which the assortment of concrete examples and code were of great help.

Finally, but not least, infinite thanks to my family, friends and professors for providing financial, technical, social support and expertise for my ongoing learning journey during these hard times. Your help has been beyond description, really.

This list is not final, as the project is far from done. Any future acknowledgements will be promptly added.

Anime4K (bloc97/Anime4K)

Searching Database…

21.5K ·GitHub
Что это такое?Anime4K — это набор алгоритмов с открытым исходным кодом для увеличения разрешения и шумоподавления в реальном времени, реализованных как шейдеры GLSL. Они делают аниме-видео чётче и увеличивают его разрешение на лету внутри медиаплеера, не перекодируя файл навсегда.
Это отдельное приложение или то, что загружается в мой плеер?Само по себе это не отдельное приложение, а библиотека шейдеров GLSL, которую загружают в медиаплеер с поддержкой шейдеров (mpv, IINA, Plex). Хотя некоторые проекты сообщества оборачивают её в готовые приложения с графическим интерфейсом.
Как это запустить?Следуйте инструкции по установке для своей платформы: в Windows и Linux шейдеры загружаются через GLSL/MPV или GLSL/Plex, а на Mac дополнительно есть GLSL/IINA. В каждом руководстве показано, как направить конвейер шейдеров плеера на файлы шейдеров Anime4K.
Нужен ли конкретный медиаплеер, или подойдёт любой видеоплеер?Да. Поскольку Anime4K реализован как шейдеры GLSL, нужен плеер с поддержкой шейдеров GLSL, например mpv, IINA или Plex. В README есть отдельные руководства по настройке для каждого из них.
Работает ли это хорошо на любом аниме-видео или есть подводные камни?Алгоритм настроен под нативное аниме в 1080p, закодированное в h.264, h.265 или VC-1. Он не оптимизирован для источников, уменьшенных с 720p/480p, и для старого аниме в стандартном разрешении. Очень старое аниме с сильным сжатием или артефактами размытия трудно очистить.
Нужна ли мощная видеокарта, чтобы это работало в реальном времени?Да, увеличение разрешения шейдерами в реальном времени зависит от видеокарты. Тесты проекта проводились на AMD Vega64. В README также отмечается, что реализации на CUDA с тензорными ядрами могут быть ещё быстрее, но они доступны только на CUDA.
Чем это отличается от waifu2x или других ИИ-апскейлеров, например Real-ESRGAN?Anime4K создан для работы в реальном времени во время воспроизведения. Апскейлеры на основе GAN, такие как waifu2x и Real-ESRGAN, дают лучший результат на сильно испорченных или низкокачественных изображениях, но слишком медленны для использования в реальном времени.
Что изменилось между версиями шейдеров v3 и v4?В v3 монолитный шейдер разделили на модульные апскейлеры линий на основе CNN, шейдеры устранения размытия, шумоподавления и артефактов передискретизации. В v4 добавили алгоритм реконструкции линий, который явно исправляет сдвиг распределения, встречающийся в реальном, непоследовательно скомпонованном аниме в 1080p.
Есть ли более простое приложение вместо ручной настройки шейдеров?Да, сообщество создало несколько готовых инструментов на основе Anime4K, в том числе графический апскейлер для Windows 10/11, приложение на основе Metal для платформ Apple и реализации на PyTorch, C#, Rust и C++.
Creator
bloc97
Size
804.8 MB
Stars
21.5K
Age
7y
Commits · 90 Days