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 5
This porject based on ‘semantic segmentation’ and ‘Image-to-Image Translation’.<br>
* [中文版](./README_CN.md)<br>
H
hypox64 已提交
6

H
hypox64 已提交
7 8 9 10 11 12
### 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 已提交
13

H
hypox64 已提交
14 15 16 17 18
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 已提交
19
## Notice
H
hypox64 已提交
20
The code do not include the part of training, I will finish it in my free time.<br>
H
hypox64 已提交
21

H
hypox64 已提交
22 23 24 25 26 27
## 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 已提交
28

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

Attentions:<br>
H
hypox64 已提交
32 33 34 35
  - 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 已提交
36
  - GUI version update slower than source.
H
hypox64 已提交
37 38 39

### Run from source
#### Prerequisites
H
hypox64 已提交
40 41 42 43 44
  - Linux, Mac OS, Windows
  - Python 3.6+
  - [ffmpeg 3.4](http://ffmpeg.org/)
  - [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 已提交
45 46
#### Dependencies
This code depends on opencv-python, torchvision available via pip install.
H
hypox64 已提交
47
#### Clone this repo
HypoX64's avatar
HypoX64 已提交
48 49
```bash
git clone https://github.com/HypoX64/DeepMosaics
HypoX64's avatar
HypoX64 已提交
50
cd DeepMosaics
HypoX64's avatar
HypoX64 已提交
51
```
H
hypox64 已提交
52
#### Get pre_trained models and test video
HypoX64's avatar
HypoX64 已提交
53
You can download pre_trained models and test video and replace the files in the project.<br>
H
hypox64 已提交
54
[[Google Drive]](https://drive.google.com/open?id=10nARsiZoZGcaKw40nQu9fJuRp1oeabPs)   [[百度云,提取码7thu]](https://pan.baidu.com/s/1IG4bdIiIC9PH9-oEyae5Sg) 
H
hypox64 已提交
55

H
hypox64 已提交
56
#### Simple example
H
hypox64 已提交
57
* Add Mosaic (output video will save in './result')
HypoX64's avatar
HypoX64 已提交
58
```bash
H
hypox64 已提交
59
python3 deepmosaic.py
HypoX64's avatar
HypoX64 已提交
60
```
H
hypox64 已提交
61
* Clean Mosaic (output video will save in './result')
HypoX64's avatar
HypoX64 已提交
62
```bash
H
hypox64 已提交
63
python3 deepmosaic.py --mode clean --model_path ./pretrained_models/clean_hands_unet_128.pth --media_path ./result/hands_test_AddMosaic.mp4
HypoX64's avatar
HypoX64 已提交
64
```
H
hypox64 已提交
65
#### More parameters
H
hypox64 已提交
66 67
If you want to test other image or video, please refer to this file.
[[options.py]](https://github.com/HypoX64/DeepMosaics/blob/master/options.py) 
HypoX64's avatar
HypoX64 已提交
68
<br>
H
hypox64 已提交
69

HypoX64's avatar
HypoX64 已提交
70
## Acknowledgments
H
hypox64 已提交
71
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).