Code Monkey home page Code Monkey logo

cfsnet's Introduction

CFSNet

pytorch code of "CFSNet: Toward a Controllable Feature Space for Image Restoration"(ICCV2019)

Coupling module architecture.

The framework of our proposed controllable feature space network (CFSNet). The details about our proposed CFSNet can be found in our main paper.

If you find our work useful in your research or publications, please consider citing:

@InProceedings{Wang_2019_ICCV,
author = {Wang, Wei and Guo, Ruiming and Tian, Yapeng and Yang, Wenming},
title = {CFSNet: Toward a Controllable Feature Space for Image Restoration},
booktitle = {The IEEE International Conference on Computer Vision (ICCV)},
month = {October},
year = {2019}
}

@article{wang2019cfsnet,
  title={CFSNet: Toward a Controllable Feature Space for Image Restoration},
  author={Wang, Wei and Guo, Ruiming and Tian, Yapeng and Yang, Wenming},
  journal={arXiv preprint arXiv:1904.00634},
  year={2019}
}

Contents

  1. Illustration
  2. Testing
  3. Training
  4. Results

Illustration

The overall code framework:

          CFSNet ── codes
                      └── data
                           ├──deblock_dataset.py
                           ├──denoise_dataset.py
                           ├──sr_dataset.py
                           └── util.py
                      ├──models
                           └── modules
                                  ├── architecture.py
                                  ├── block.py
                                  ├── loss.py
                                  ├── main_net.py
                                  └── tuning_blocks.py
                           ├── CFSNet_model.py
                      ├──settings
                           ├── test
                           ├── train
                           └──options.py
                      ├──utils
                           ├── logger.py
                           └── util.py
                      ├── train.py
                      └── test.py

Dependencies and Installation

GPU: cuda 8.0. Python 3.6.3 (Recommend to use Anaconda)
Packages:

pip install torch-0.4.1-cp36-cp36m-manylinux1_x86_64.whl
pip install torchvision-0.2.1-py2.py3-none-any.whl
pip install opencv-python
pip install opencv-contrib-pytho
pip install lmdb
pip install scikit_image-0.13.1-cp36-cp36m-manylinux1_x86_64.whl
pip install tensorboard-logger

(some .whl packages can be found here: Google Cloud Disk)

Testing

We provide some trained models of CFSNet, and you can download them from Google Cloud Disk.

  1. Prepare datasets according to task type. (Some datasets can be found in Google Cloud Disk.)
  2. Modify the configuration file (settings/test/*.json) according to your personal situation. (please refer to 'settings/test' for instructions.)
  3. Run following command for evaluation:
python test.py -opt settings/test/*.json 

Training

  1. Prepare training datasets according to task type.
  2. Modify the configuration file (settings/test/*.json) according to your personal situation. (Please refer to 'settings/train' for instructions.)
  3. Run the following command for training:
python train.py -opt settings/train/*.json

Note: Our training process consists of two steps, first training the main branch, then training the tuning branch. Therefore, you need to modify the configutation file at different training stages.

Results

Visual Results

Perceptual and distortion balance of “215”, “211” and “268” (PIRM test dataset) for 4× image super-resolution.

Smooth control of distortion and perceptual with control scalar α_in from 0 to 1.

Color image denoising results with unknown noise level σ = 15 (first two rows) and σ = 40 (last two rows). α_in = 0.5 and α_in = −0.3 correspond to the highest PSNR results, respectively.

Smooth control of noise reduction and detail preservation with control scalar α_in from 0 to 1.

JPEG image artifacts removal results of “house” and “ocean” (LIVE1) with unknown quality factor 20. α_in = 0.5 corresponds to the highest PSNR results, and the best visual results are marked with red boxes.

Visual results of single image super-resolution with unseen degradation (the blur kernel is 7 × 7 Gaussian kernel with standard deviation 1.6, the scale factor is 3). α_in = 0.15 corresponds to the highest PSNR results.

Smooth control of blur removal and detail sharpening with control scalar α_in from 0 to 0.8.

Acknowledgement

Thank BasicSR. They provide many useful codes which facilitate our work.

cfsnet's People

Contributors

qibao77 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cfsnet's Issues

RuntimeError: DataLoader worker (pid(s) 94080) exited unexpectedly

Thank you for sharing the code.

I run the deblocking code and have the following problem. Could you know the reason? Thanks.

File "G:\Anaconda\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
raise RuntimeError('''
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

Traceback (most recent call last):
File "G:\Anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 779, in _try_get_data
data = self._data_queue.get(timeout=timeout)
File "G:\Anaconda\lib\queue.py", line 178, in get
raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "test.py", line 53, in
for data in test_loader:
File "G:\Anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 363, in next
data = self._next_data()
File "G:\Anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 974, in _next_data
idx, data = self._get_data()
File "G:\Anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 931, in _get_data
success, data = self._try_get_data()
File "G:\Anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 792, in _try_get_data
raise RuntimeError('DataLoader worker (pid(s) {}) exited unexpectedly'.format(pids_str))
RuntimeError: DataLoader worker (pid(s) 94080) exited unexpectedly

Something about network?

In the paper, on the first three FC :512 x 256, 256x128, 128x64.
but the \alpha_in is a scalar. Do you set as this:
tensorIN = torch.ones(N, 512) * \alpha_in?

Hope your answer! Thanks.

α_in

In training step 1, we keep α_in= 0, while in training step 2, we keep α_in = 1. But in the paper , the experiment use different α_in from 0 to 1, what's the mean? Hope you can reply me, thank you.

input/output channel

hi, thanks for your great, when i'm using your trained models, i have some questions.
1). why the input and output channel in deblock and denoise is 1 ? are those two models only support gray images?
2). i found the model for 4✖️sr could not be load properly

denoising train

hello and thank you for your nice work.
during training of gray denoise the model is not converge if i use α_in= 0. only if i use α_in= 1 the loss converges and reduce
I tied several datasets and also with per-trained model and without.

thanks in advance for your help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.