All Projects → czczup → block-shuffle

czczup / block-shuffle

Licence: other
A method for high-resolution Fast Style Transfer with limited memory

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to block-shuffle

flow1d
[ICCV 2021 Oral] High-Resolution Optical Flow from 1D Attention and Correlation
Stars: ✭ 91 (+145.95%)
Mutual labels:  high-resolution
Foveation-Segmentation
PyTorch implementation of Foveation for Segmentation of Ultra-High Resolution Images
Stars: ✭ 38 (+2.7%)
Mutual labels:  high-resolution
gapdecoder
Google Arts And Culture Downloader. Python script to download high-resolution images from google arts & culture.
Stars: ✭ 78 (+110.81%)
Mutual labels:  high-resolution
Hrnet Semantic Segmentation
The OCR approach is rephrased as Segmentation Transformer: https://arxiv.org/abs/1909.11065. This is an official implementation of semantic segmentation for HRNet. https://arxiv.org/abs/1908.07919
Stars: ✭ 2,369 (+6302.7%)
Mutual labels:  high-resolution
AOT-GAN-for-Inpainting
[TVCG] AOT-GAN for High-Resolution Image Inpainting (codebase for image inpainting)
Stars: ✭ 147 (+297.3%)
Mutual labels:  high-resolution
Restormer
[CVPR 2022--Oral] Restormer: Efficient Transformer for High-Resolution Image Restoration. SOTA for motion deblurring, image deraining, denoising (Gaussian/real data), and defocus deblurring.
Stars: ✭ 586 (+1483.78%)
Mutual labels:  high-resolution
ffhqr-dataset
FFHQR -- the first large-scale retouching dataset for computer vision research.
Stars: ✭ 85 (+129.73%)
Mutual labels:  high-resolution
THREE.Highres
High resolution and depth rendering to PNG for Three.js
Stars: ✭ 28 (-24.32%)
Mutual labels:  high-resolution
pyGRETA
python Generator of REnewable Time series and mAps
Stars: ✭ 27 (-27.03%)
Mutual labels:  high-resolution
PhotographicImageSynthesiswithCascadedRefinementNetworks-Pytorch
Photographic Image Synthesis with Cascaded Refinement Networks - Pytorch Implementation
Stars: ✭ 63 (+70.27%)
Mutual labels:  high-resolution
fast-style-transfer-tutorial-pytorch
Simple Tutorials & Code Implementation of fast-style-transfer(Perceptual Losses for Real-Time Style Transfer and Super-Resolution, 2016 ECCV) using PyTorch.
Stars: ✭ 18 (-51.35%)
Mutual labels:  fast-style-transfer

Block Shuffle: A Method for High-resolution Fast Style Transfer with Limited Memory

Introduction

For high-resolution images, most mobile devices and personal computers cannot stylize them due to memory limitations. To solve this problem, we proposed a novel method named block shuffle, which can stylize high-resolution images with limited memory. In our experiments, we used Logan Engstrom's implementation of Fast Style Transfer as the baseline. In this repository, we provided the source code and 16 trained models. In addition, we developed an Android demo app, if you are interested in it, please click here.

Requirements

  1. CUDA 9, cudnn 7
  2. Python 3.6
  3. Python packages: tensorflow-gpu==1.9, opencv-python, numpy

High-resolution Image Stylization

Trained Fast Style Transfer Models

#01 #02 #03 #04 #05 #06 #07 #08
style style style style style style style style
#09 #10 #11 #12 #13 #14 #15 #16
style style style style style style style style

Baseline

Use baseline.py to stylize a high-resolution image. A GPU with 12GB memory can stylize up to 4000*4000 images (if your GPU doesn't have enough memory, it will throw an OOM error). Example usage:

python baseline.py --input examples/content/xxx.jpg \
  --output examples/result/xxx.jpg \
  --model models/01/model.pb \
  --gpu 0

Feathering-based Method

Use feathering-based.py to stylize a high-resolution image. This method is very simple, but it doesn't work well. Example usage:

python feathering-based.py --input examples/content/xxx.jpg \
  --output examples/result/xxx.jpg \
  --model models/01/model.pb \
  --gpu 0

Block Shuffle Method (Ours)

Use block_shuffle.py to stylize a high-resolution image. In our experiments, we set the max-width to 1000. If your GPU cannot stylize a 1000*1000 image, you can change this parameter to a smaller value. Example usage:

python block_shuffle.py --input examples/content/xxx.jpg \
  --output examples/result/xxx.jpg \
  --model models/01/model.pb \
  --max-width 1000 \
  --gpu 0

Training Style Transfer Networks

Download the COCO2014 Dataset and the Pre-trained VGG-19

We provided 16 trained fast style transfer models. If you want to train a new model, please download the COCO2014 dataset and the pre-trained VGG-19. If not, you can skip this step.

You can run setup.sh to download the COCO2014 dataset and the pre-trained VGG-19. Or you can download them from the following link (place them in data/):

  1. COCO2014 dataset
  2. pre-trained VGG-19

Train

Use style.py to train a new style transfer network. Training takes 26 hours on a Nvidia Telas K80 GPU. Example usage:

python style.py --style examples/style/style.jpg \
  --checkpoint-dir checkpoint/style01 \
  --test examples/content/chicago.jpg \
  --test-dir checkpoint/style01

Export

Use export.py to export .pb files. Example usage:

python export.py --input checkpoint/xxx/fns.ckpt \
  --output checkpoint/xxx/models.pb \
  --gpu 0 

Some Experimental Results

Style Content Baseline Baseline+Feathering Baseline+Block Shuffle (Ours)
style style style style style
style style style style style
style style style style style
style style style style style
style style style style style
style style style style style
style style style style style
style style style style style
style style style style style
style style style style style
style style style style style
style style style style style
style style style style style
style style style style style
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].