Use GAN to remove mosaic.
Introduction in Chinese, please refer to 视频去马赛克.
Major innovations:
1. Automatic video processing;
2. The mosaic is generated randomly in the training process.
- Linux, Mac OS
- Python 3.5+
- ffmpeg 3.4.6
- Pytorch 1.0+
- NVIDIA GPU (11G memory or larger) + CUDA cuDNN
This code depends on opencv-python, torchvision, Matplotlib, dominate, and so on, available via pip install.
git clone https://github.com/Z863058/demosaic
cd demosaic
Use addmosaic model to make video datasets(Require addmosaic pre-trained model. This is better for processing video mosaics).
Train addmosaic pre-trained model, please refer to README_addmosaic.md.
cd z_make_datasets
python z_make_video_dataset.py --datadir x0.mp4 --savedir ../datasets/demosaic
Modify the method get_random_parameter(img, mask) in z_util.mosaic.py.
Let the method produce the appropriate parameters of mosaic_size, mod and rect_rat to fit the mosaic video.
python z_train.py --dataroot ./datasets/demosaic_20200501_286to256 --name demosaic_20200501_286to256_random --loadSize 286 --fineSize 256 --resize_or_crop crop --label_nc 0 --no_instance --niter 100 --niter_decay 100 --tf_log --gpu_ids 1 --continue_train
# for images
python z_test.py --dataroot ./datasets/demosaic_20200501_286to256 --name demosaic_20200501_286to256_random --loadSize 256 --fineSize 256 --label_nc 0 --no_instance --gpu_ids 0
# for video
python z_demosaic.py --name demosaic_20200501_286to256_random --media_path x.mp4
This code borrows heavily from [pix2pixHD] [DeepMosaics] [Pytorch-UNet] [BiSeNet].
更多(不可描述)信息,敬请微信搜索或扫码关注“天天P图AI”公众号。