README.md 3.8 KB
Newer Older
H
hypox64 已提交
1 2
![image](./imgs/hand.gif)
# <img src="./imgs/icon.jpg" width="48">DeepMosaics
HypoX64's avatar
HypoX64 已提交
3
You can use it to automatically remove the mosaics in images and videos, or add mosaics to them.<br>
H
hypox64 已提交
4
This porject based on ‘semantic segmentation’ and ‘Image-to-Image Translation’.<br>
H
HypoX64 已提交
5
Master is not stable. Please use a [stable version](https://github.com/HypoX64/DeepMosaics/tree/stable)<br>
H
hypox64 已提交
6
* [中文版](./README_CN.md)<br>
H
hypox64 已提交
7

H
hypox64 已提交
8 9 10 11 12 13
### More example
origin | auto add mosaic |  auto clean mosaic  
:-:|:-:|:-:
![image](https://github.com/HypoX64/DeepMosaics_example/blob/master/lena.jpg) | ![image](https://github.com/HypoX64/DeepMosaics_example/blob/master/lena_add.jpg) | ![image](https://github.com/HypoX64/DeepMosaics_example/blob/master/lena_clean.jpg) 
![image](https://github.com/HypoX64/DeepMosaics_example/blob/master/youknow.png)  | ![image](https://github.com/HypoX64/DeepMosaics_example/blob/master/youknow_add.png) | ![image](https://github.com/HypoX64/DeepMosaics_example/blob/master/youknow_clean.png) 
* Compared with [DeepCreamPy](https://github.com/deeppomf/DeepCreamPy)
H
hypox64 已提交
14

H
hypox64 已提交
15 16 17 18 19
mosaic image | DeepCreamPy | ours  
:-:|:-:|:-:
![image](https://github.com/HypoX64/DeepMosaics_example/blob/master/face_a_mosaic.jpg) | ![image](https://github.com/HypoX64/DeepMosaics_example/blob/master/a_dcp.png) | ![image](https://github.com/HypoX64/DeepMosaics_example/blob/master/face_a_clean.jpg) 
![image](https://github.com/HypoX64/DeepMosaics_example/blob/master/face_b_mosaic.jpg) | ![image](https://github.com/HypoX64/DeepMosaics_example/blob/master/b_dcp.png) | ![image](https://github.com/HypoX64/DeepMosaics_example/blob/master/face_b_clean.jpg) 

H
hypox64 已提交
20 21 22 23 24 25
## Run DeepMosaics
You can either run DeepMosaics via pre-built binary package or from source.<br>

### Pre-built binary package
For windows, we bulid a GUI version for easy test.<br>
Download this version via [[Google Drive]](https://drive.google.com/open?id=1LTERcN33McoiztYEwBxMuRjjgxh4DEPs)  [[百度云,提取码1x0a]](https://pan.baidu.com/s/10rN3U3zd5TmfGpO_PEShqQ) <br>
H
hypox64 已提交
26

H
hypox64 已提交
27
![image](./imgs/GUI.png)<br>
H
hypox64 已提交
28 29

Attentions:<br>
H
hypox64 已提交
30 31 32 33
  - Require Windows_x86_64, Windows10 is better.<br>
  - Different pre-trained models are suitable for different effects.<br>
  - Run time depends on computer performance.<br>
  - If output video cannot be played, you can try with [potplayer](https://daumpotplayer.com/download/).
H
hypox64 已提交
34
  - GUI version update slower than source.
H
hypox64 已提交
35 36 37

### Run from source
#### Prerequisites
H
hypox64 已提交
38 39
  - Linux, Mac OS, Windows
  - Python 3.6+
H
hypox64 已提交
40
  - [ffmpeg 3.4.6](http://ffmpeg.org/)
H
hypox64 已提交
41 42
  - [Pytorch 1.0+](https://pytorch.org/)  [(Old version codes)](https://github.com/HypoX64/DeepMosaics/tree/Pytorch0.4)
  - CPU or NVIDIA GPU + CUDA CuDNN<br>
H
hypox64 已提交
43 44
#### Dependencies
This code depends on opencv-python, torchvision available via pip install.
H
hypox64 已提交
45
#### Clone this repo
HypoX64's avatar
HypoX64 已提交
46 47
```bash
git clone https://github.com/HypoX64/DeepMosaics
HypoX64's avatar
HypoX64 已提交
48
cd DeepMosaics
HypoX64's avatar
HypoX64 已提交
49
```
H
hypox64 已提交
50
#### Get pre_trained models and test video
51
You can download pre_trained models and put them into './pretrained_models'.<br>
H
hypox64 已提交
52
[[Google Drive]](https://drive.google.com/open?id=1LTERcN33McoiztYEwBxMuRjjgxh4DEPs)  [[百度云,提取码1x0a]](https://pan.baidu.com/s/10rN3U3zd5TmfGpO_PEShqQ)
H
hypox64 已提交
53

H
hypox64 已提交
54
#### Simple example
H
hypox64 已提交
55
* Add Mosaic (output video will save in './result')
HypoX64's avatar
HypoX64 已提交
56
```bash
57
python3 deepmosaic.py --media_path ./imgs/ruoruo.jpg --model_path ./pretrained_models/mosaic/add_face.pth --use_gpu -1
HypoX64's avatar
HypoX64 已提交
58
```
H
hypox64 已提交
59
* Clean Mosaic (output video will save in './result')
HypoX64's avatar
HypoX64 已提交
60
```bash
61
python3 deepmosaic.py --media_path ./result/ruoruo_add.jpg --model_path ./pretrained_models/mosaic/clean_face_HD.pth --use_gpu -1
HypoX64's avatar
HypoX64 已提交
62
```
H
hypox64 已提交
63
#### More parameters
H
hypox64 已提交
64
If you want to test other image or video, please refer to this file.
H
hypox64 已提交
65
[[options.py]](./cores/options.py) <br>
H
hypox64 已提交
66

HypoX64's avatar
HypoX64 已提交
67
## Acknowledgments
H
hypox64 已提交
68
This code borrows heavily from [[pytorch-CycleGAN-and-pix2pix]](https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix) [[Pytorch-UNet]](https://github.com/milesial/Pytorch-UNet)[[pix2pixHD]](https://github.com/NVIDIA/pix2pixHD).