an inference framework for image/video restoration with VapourSynth support
Project description
ccrestoration
an inference framework for image/video restoration with VapourSynth support, compatible with many community models
Install
Make sure you have Python >= 3.9 and PyTorch >= 1.13 installed
pip install ccrestoration
- Install VapourSynth (optional)
Start
cv2
A simple example to use the sisr model (APISR) to process an image
import cv2
import numpy as np
from ccrestoration import AutoModel, ConfigType, SRBaseModel
model: SRBaseModel = AutoModel.from_pretrained(ConfigType.RealESRGAN_APISR_RRDB_GAN_generator_2x)
img = cv2.imdecode(np.fromfile("test.jpg", dtype=np.uint8), cv2.IMREAD_COLOR)
img = model.inference_image(img)
cv2.imwrite("test_out.jpg", img)
VapourSynth
A simple example to use the vsr model (AnimeSR) to process a video
import vapoursynth as vs
from vapoursynth import core
from ccrestoration import AutoModel, BaseModelInterface, ConfigType
model: BaseModelInterface = AutoModel.from_pretrained(
pretrained_model_name=ConfigType.AnimeSR_v2_4x
)
clip = core.bs.VideoSource(source="s.mp4")
clip = core.resize.Bicubic(clip=clip, matrix_in_s="709", format=vs.RGBH)
clip = model.inference_video(clip)
clip = core.resize.Bicubic(clip=clip, matrix_s="709", format=vs.YUV420P16)
clip.set_output()
See more examples in the example directory, ccrestoration can register custom configurations and models to extend the functionality
Current Support
It still in development, the following models are supported:
Reference
License
This project is licensed under the MIT - see the LICENSE file for details.
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 Distributions
Built Distribution
File details
Details for the file ccrestoration-0.0.11-py3-none-any.whl
.
File metadata
- Download URL: ccrestoration-0.0.11-py3-none-any.whl
- Upload date:
- Size: 72.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac5c231776fab55d81c6a0852f5ab51ddce61c26a93083ada05404bbb1cfd2bd |
|
MD5 | 7db2983155dbf28fd1ec0356847130fe |
|
BLAKE2b-256 | a0ec533c244c61d54b1c65910a35da13e26e2a900123280ceff56ee31bfc5963 |