contents/
┗MyDrive/
┗mosaic/
┗mosaic.ipynb
!python --version
!pip install opencv_python
!pip install matplotlib
!pip install tensorboardX
!pip install scikit-image
cd /content/drive/MyDrive/mosaic
!git clone https://github.com/HypoX64/DeepMosaics.git
cd DeepMosaics
mkdir ./pretrained_models/mosaic
ls
contents/
┗MyDrive/
┗mosaic/
┗DeepMosaics/
┗pretrained_models/
┗models/
┗add_face.pth
┗clean_face_HD.pth
┗mosaic_position.pth
# モザイク処理
!python deepmosaic.py --media_path ./imgs/ruoruo.jpg --model_path ./pretrained_models/mosaic/add_face.pth --gpu_id 0
import matplotlib.pyplot as plt
from PIL import Image
mosaic_img = Image.open("/content/drive/MyDrive/mosaic/DeepMosaics/result/ruoruo_add.jpg")
plt.imshow(mosaic_img)
!python deepmosaic.py --media_path ./result/ruoruo_add.jpg --model_path ./pretrained_models/mosaic/clean_face_HD.pth --gpu_id 0
mosaic_clean_img = Image.open("/content/drive/MyDrive/mosaic/DeepMosaics/result/ruoruo_add_clean.jpg")
plt.imshow(mosaic_clean_img)
cd /content/drive/MyDrive/mosaic
!pip install timm
!git clone https://github.com/JingyunLiang/SwinIR.git
003_realSR_BSRGAN_DFOWMFC_s64w8_SwinIR-L_x4_GAN.pth
content/
┗drive/
┗MyDrive/
┗mosaic/
┗SwinIR/
┗003_realSR_BSRGAN_DFOWMFC_s64w8_SwinIR-L_x4_GAN.pth
cd /content/drive/MyDrive/mosaic/SwinIR
!python main_test_swinir.py --task real_sr --model_path 003_realSR_BSRGAN_DFOWMFC_s64w8_SwinIR-L_x4_GAN.pth --folder_lq /content/drive/MyDrive/mosaic/DeepMosaics/result --scale 4 --large_model
/content/drive/MyDrive/mosaic/SwinIR/results/swinir_real_sr_x4_large/
# モザイク処理画像
mosaic_SwinIR_img = Image.open("/content/drive/MyDrive/mosaic/SwinIR/results/swinir_real_sr_x4_large/ruoruo_add_SwinIR.png")
plt.imshow(mosaic_SwinIR_img)
# モザイク除去後画像
mosaic_clean_SwinIR_img = Image.open("/content/drive/MyDrive/mosaic/SwinIR/results/swinir_real_sr_x4_large/ruoruo_add_clean_SwinIR.png")
plt.imshow(mosaic_clean_SwinIR_img)