PIL × DAT - Pillow extension for AI-based image upscaling.
Project description
PIL × DAT - Pillow extension for AI-based image upscaling.
Installation
For PyPI:
pip install pillow-dat
For Poetry:
poetry add pillow-dat
Get started
from PIL.Image import open
from PIL_DAT.Image import upscale
lumine_image = open(".github/lumine.png")
lumine_image = upscale(lumine_image, 2)
Remark: We strongly advocate for the utilization of DAT light
models owing to their streamlined design and outstanding speed performance. However, should you opt for alternative models, please note that *.pth
model weights can be accessed via Google Drive.
Example
Input (lumine.png) | DAT light (x2) | Bicubic (x2) |
---|---|---|
Benchmarks
Speed
Performance benchmarks have been conducted on a computing system equipped with an Intel(R) CORE(TM) i7-9750H CPU @ 2.60GHz processor
, accompanied by a 2 × 8 Go at 2667MHz RAM
configuration. Below are the recorded results:
In seconds | 320 × 320 | 640 × 640 | 960 × 960 | 1280 × 1280 |
---|---|---|---|---|
DAT light (x2) | 13.7 | 54.9 | 127.2 | 299.3 |
DAT light (x3) | 13.2 | 56.5 | - | - |
DAT light (x4) | 12.8 | 56.6 | - | - |
The results were compared against the renowned OpenCV
library, utilizing its EDSR
model known for delivering superior image quality.
In seconds | 320 × 320 | 640 × 640 | 960 × 960 | 1280 × 1280 |
---|---|---|---|---|
EDSR (x2) | 25.6 | 112.9 | 264.1 | 472.8 |
EDSR (x3) | 24.3 | 112.5 | - | - |
EDSR (x4) | 23.6 | 111.2 | - | - |
Remark: All speed benchmark results presented here are reproducible. For detailed implementation, please refer to the following files: benchmark_speed_dat_light.py and benchmark_speed_edsr.py.
Quality
DAT light (x2) | EDSR (x2) |
---|---|
Remark: All quality benchmark results presented here are reproducible. For detailed implementation, please refer to the following files: example.py and benchmark_quality_edsr.py.
Contribution
Please install Python.
Please install Poetry via pipx.
Please install VSCode and its extensions:
- Black Formatter
- isort
- Python
- Pylance
- Even Better TOML
To have your Python environment inside your project (optional):
poetry config virtualenvs.in-project true
To create your Python environment and install dependencies:
poetry install
To run unit tests:
pytest
To publish package:
poetry publish --build -u __token__ -p <pypi_token>
Acknowledgement
This library is founded upon the pioneering research paper, "Dual Aggregation Transformer for Image Super-Resolution".
@inproceedings{chen2023dual,
title={Dual Aggregation Transformer for Image Super-Resolution},
author={Chen, Zheng and Zhang, Yulun and Gu, Jinjin and Kong, Linghe and Yang, Xiaokang and Yu, Fisher},
booktitle={ICCV},
year={2023}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pillow_dat-0.1.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 412ca342f4cb7458e96534e74c599761d5fd1d015e7e88072d1f96439f130959 |
|
MD5 | 5940387a5761d2c57f33f4d1ba70360e |
|
BLAKE2b-256 | 6f1825186ad05a80205ac16c9f6a1b785aed3f4f432c828c7b3a8eb81b864729 |