← 开源
idealo

image-super-resolution

🔎 Super-scale your images and run experiments with Residual Dense and Adversarial Networks.

Model DevelopmentArchitecturePython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
4.82k
Star
762
Fork
+1
本周
8
贡献者
创建于 2018-11-26 · 更新于 2026-10-09 · 今日第 7516 名
主要开发者
cfrancescodatitranmlesniak-idealo

idealo/image-super-resolution 排名第 7,516,有 4,815 个星标。

同类别比较

idealo/image-super-resolution 排名第 7,516,此处有 8 个同类条目;MegEngine/MegEngine 排名第 7,517。

同类别比较
名称排名指标
deepjavalibrary/djl7,507
语言:
Java
星标数:
4,859
分叉数:
758
简介:
An Engine-Agnostic Deep Learning Framework in Java
fchollet/ARC-AGI7,508
语言:
JavaScript
星标数:
4,852
分叉数:
727
简介:
The Abstraction and Reasoning Corpus
lk-geimfari/mimesis7,510
语言:
Python
星标数:
4,848
分叉数:
366
简介:
Mimesis is a Python library for generating fake but realistic data in multiple languages and locales.
blei-lab/edward7,511
语言:
Jupyter Notebook
星标数:
4,846
分叉数:
742
简介:
A probabilistic programming language in TensorFlow. Deep generative models, variational inference.
MegEngine/MegEngine7,517
语言:
C++
星标数:
4,809
分叉数:
543
简介:
MegEngine 是一个快速、可拓展、易于使用且支持自动求导的深度学习框架
pytorch/ignite7,521
语言:
Python
星标数:
4,793
分叉数:
741
简介:
High-level library to help with training and evaluating neural networks in PyTorch flexibly and transparently.
facebookresearch/lingua7,526
语言:
Python
星标数:
4,771
分叉数:
270
简介:
Meta Lingua: a lean, efficient, and easy-to-hack codebase to research LLMs.
rust-ml/linfa7,527
语言:
Rust
星标数:
4,759
分叉数:
333
简介:
A Rust machine learning framework.
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Architecture
关键词Image production
星标数4,815
分叉数762
贡献者8
创建日期2018-11-26
更新日期2026-10-09
1 天星标数0
7 天星标数1
排名7,516
上次排名7,645
排名变化129
7 天星标排名9,075
上次 7 天星标排名9,125
7 天星标排名变化50
总星标排名2,906
上次总星标排名2,904
总星标排名变化-2
国家Germany
README 摘录

Image Super-Resolution (ISR) The goal of this project is to upscale and improve the quality of low resolution images. Since the code is no longer actively maintained, it will be archived on 2025-01-03. This project contains Keras implementations of different Residual Dense Networks for Single Image Super-Resolution (ISR) as well as scripts to train these networks using content and adversarial loss components. The implemented networks include: The super-scaling Residual Dense Network described in Residual Dense

Network for Image Super-Resolution (Zhang et al. 2018) The super-scaling Residual in Residual Dense Network described in ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks (Wang et al. 2018) A multi-output version of the Keras VGG19 network for deep features extraction used in the perceptual loss A custom discriminator network based on the one described in Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network (SRGANS, Ledig et al. 2017) Read the full documentation at: Docker

scripts and Google Colab notebooks are available to carry training and prediction. Also, we provide scripts to facilitate training on the cloud with AWS and nvidia-docker with only a few commands. 6 and is distributed under the Apache 2. If you wish to contribute, please see the Contribute section. Contents Pre-trained networks Installation Usage Additional Information Contribute Citation Maintainers License Troubleshooting Training not delivering good/patchy results When training your own model, start with only PSNR loss (50

+ epochs, depending on the dataset) and only then introduce GANS and feature loss. This can be controlled by the loss weights argument. This is just sample, you will need to tune these parameters. PSNR only: Later: Weights loading If you are having trouble loading your own weights or the pre-trained weights ( ), try: Issue Pre-trained networks The weights used to produced these images are available directly when creating the model object. Currently 4 models are available: RDN: psnr-large

, psnr-small, noise-cancel RRDN: gans Example usage: The network parameters will be automatically chosen. Basic model RDN model, PSNR driven, choose the option or when creating a RDN model. | GANS model RRDN model, trained with Adversarial and VGG features losses, choose the option when creating a RRDN model. | -> more detailed comparison Artefact Cancelling GANS model RDN model, trained with Adversarial and VGG features losses, choose the option when creating a RDN model. | -> more detailed comparison Installation There are two

ways to install the Image Super-Resolution package: Install ISR from PyPI (recommended): Install ISR from the GitHub source: Usage Prediction Load image and prepare it Load a pre-trained model and run prediction (check the prediction tutorial under notebooks for more details) Large image inference To predict on large images and avoid memory allocation errors, use the option for the predict method, for instance Check the documentation of the class for further details. Training Create the models Create a

Trainer object using the desired settings and give it the models ( and are optional) Start training Additional Information You can

常见问题

记录了多少星标和分叉?

idealo/image-super-resolution 有 4,815 个星标和 762 个分叉。

仓库排名是多少?

idealo/image-super-resolution 排名第 7,516。

记录的语言和类别是什么?

idealo/image-super-resolution 有 4,815 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

idealo/image-super-resolution 与 MegEngine/MegEngine 比较,后者排名第 7,517,有 4,809 个星标。

README

Image Super-Resolution (ISR)

The goal of this project is to upscale and improve the quality of low resolution images.

Since the code is no longer actively maintained, it will be archived on 2025-01-03.

This project contains Keras implementations of different Residual Dense Networks for Single Image Super-Resolution (ISR) as well as scripts to train these networks using content and adversarial loss components.

The implemented networks include:

Read the full documentation at: https://idealo.github.io/image-super-resolution/.

Docker scripts and Google Colab notebooks are available to carry training and prediction. Also, we provide scripts to facilitate training on the cloud with AWS and nvidia-docker with only a few commands.

ISR is compatible with Python 3.6 and is distributed under the Apache 2.0 license. We welcome any kind of contribution. If you wish to contribute, please see the Contribute section.

Contents

Troubleshooting

Training not delivering good/patchy results

When training your own model, start with only PSNR loss (50+ epochs, depending on the dataset) and only then introduce GANS and feature loss. This can be controlled by the loss weights argument.

This is just sample, you will need to tune these parameters.

PSNR only:

loss_weights = {
  'generator': 1.0,
  'feature_extractor': 0.0,
  'discriminator': 0.00
}

Later:

loss_weights = {
  'generator': 0.0,
  'feature_extractor': 0.0833,
  'discriminator': 0.01
}

Weights loading

If you are having trouble loading your own weights or the pre-trained weights (AttributeError: 'str' object has no attribute 'decode'), try:

pip install 'h5py==2.10.0' --force-reinstall

Issue

Pre-trained networks

The weights used to produced these images are available directly when creating the model object.

Currently 4 models are available:

  • RDN: psnr-large, psnr-small, noise-cancel
  • RRDN: gans

Example usage:

model = RRDN(weights='gans')

The network parameters will be automatically chosen. (see Additional Information).

Basic model

RDN model, PSNR driven, choose the option weights='psnr-large' or weights='psnr-small' when creating a RDN model.

Low resolution image (left), ISR output (center), bicubic scaling (right). Click to zoom.

GANS model

RRDN model, trained with Adversarial and VGG features losses, choose the option weights='gans' when creating a RRDN model.

RRDN GANS model (left), bicubic upscaling (right).
-> more detailed comparison

Artefact Cancelling GANS model

RDN model, trained with Adversarial and VGG features losses, choose the option weights='noise-cancel' when creating a RDN model.

Standard vs GANS model. Click to zoom.
RDN GANS artefact cancelling model (left), RDN standard PSNR driven model (right).
-> more detailed comparison

Installation

There are two ways to install the Image Super-Resolution package:

  • Install ISR from PyPI (recommended):
pip install ISR
  • Install ISR from the GitHub source:
git clone https://github.com/idealo/image-super-resolution
cd image-super-resolution
python setup.py install

Usage

Prediction

Load image and prepare it

import numpy as np
from PIL import Image

img = Image.open('data/input/test_images/sample_image.jpg')
lr_img = np.array(img)

Load a pre-trained model and run prediction (check the prediction tutorial under notebooks for more details)

from ISR.models import RDN

rdn = RDN(weights='psnr-small')
sr_img = rdn.predict(lr_img)
Image.fromarray(sr_img)

Large image inference

To predict on large images and avoid memory allocation errors, use the by_patch_of_size option for the predict method, for instance

sr_img = model.predict(image, by_patch_of_size=50)

Check the documentation of the ImageModel class for further details.

Training

Create the models

from ISR.models import RRDN
from ISR.models import Discriminator
from ISR.models import Cut_VGG19

lr_train_patch_size = 40
layers_to_extract = [5, 9]
scale = 2
hr_train_patch_size = lr_train_patch_size * scale

rrdn  = RRDN(arch_params={'C':4, 'D':3, 'G':64, 'G0':64, 'T':10, 'x':scale}, patch_size=lr_train_patch_size)
f_ext = Cut_VGG19(patch_size=hr_train_patch_size, layers_to_extract=layers_to_extract)
discr = Discriminator(patch_size=hr_train_patch_size, kernel_size=3)

Create a Trainer object using the desired settings and give it the models (f_ext and discr are optional)

from ISR.train import Trainer
loss_weights = {
  'generator': 0.0,
  'feature_extractor': 0.0833,
  'discriminator': 0.01
}
losses = {
  'generator': 'mae',
  'feature_extractor': 'mse',
  'discriminator': 'binary_crossentropy'
}

log_dirs = {'logs': './logs', 'weights': './weights'}

learning_rate = {'initial_value': 0.0004, 'decay_factor': 0.5, 'decay_frequency': 30}

flatness = {'min': 0.0, 'max': 0.15, 'increase': 0.01, 'increase_frequency': 5}

trainer = Trainer(
    generator=rrdn,
    discriminator=discr,
    feature_extractor=f_ext,
    lr_train_dir='low_res/training/images',
    hr_train_dir='high_res/training/images',
    lr_valid_dir='low_res/validation/images',
    hr_valid_dir='high_res/validation/images',
    loss_weights=loss_weights,
    learning_rate=learning_rate,
    flatness=flatness,
    dataname='image_dataset',
    log_dirs=log_dirs,
    weights_generator=None,
    weights_discriminator=None,
    n_validation=40,
)

Start training

trainer.train(
    epochs=80,
    steps_per_epoch=500,
    batch_size=16,
    monitored_metrics={'val_PSNR_Y': 'max'}
)

Additional Information

You can read about how we trained these network weights in our Medium posts:

RDN Pre-trained weights

The weights of the RDN network trained on the DIV2K dataset are available in weights/sample_weights/rdn-C6-D20-G64-G064-x2/PSNR-driven/rdn-C6-D20-G64-G064-x2_PSNR_epoch086.hdf5.

The model was trained using C=6, D=20, G=64, G0=64 as parameters (see architecture for details) for 86 epochs of 1000 batches of 8 32x32 augmented patches taken from LR images.

The artefact can cancelling weights obtained with a combination of different training sessions using different datasets and perceptual loss with VGG19 and GAN can be found at weights/sample_weights/rdn-C6-D20-G64-G064-x2/ArtefactCancelling/rdn-C6-D20-G64-G064-x2_ArtefactCancelling_epoch219.hdf5 We recommend using these weights only when cancelling compression artefacts is a desirable effect.

RDN Network architecture

The main parameters of the architecture structure are:

  • D - number of Residual Dense Blocks (RDB)
  • C - number of convolutional layers stacked inside a RDB
  • G - number of feature maps of each convolutional layers inside the RDBs
  • G0 - number of feature maps for convolutions outside of RDBs and of each RBD output

source: Residual Dense Network for Image Super-Resolution

RRDN Network architecture

The main parameters of the architecture structure are:

  • T - number of Residual in Residual Dense Blocks (RRDB)
  • D - number of Residual Dense Blocks (RDB) insider each RRDB
  • C - number of convolutional layers stacked inside a RDB
  • G - number of feature maps of each convolutional layers inside the RDBs
  • G0 - number of feature maps for convolutions outside of RDBs and of each RBD output

source: ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks

Contribute

We welcome all kinds of contributions, models trained on different datasets, new model architectures and/or hyperparameters combinations that improve the performance of the currently published model.

Will publish the performances of new models in this repository.

See the Contribution guide for more details.

Bump version

To bump up the version, use

bumpversion {part} setup.py

Citation

Please cite our work in your publications if it helps your research.

@misc{cardinale2018isr,
  title={ISR},
  author={Francesco Cardinale et al.},
  year={2018},
  howpublished={\url{https://github.com/idealo/image-super-resolution}},
}

Maintainers

Copyright

See LICENSE for details.

排名相邻
同类项目