upsampling method changed + face model added
12
README.md
|
@ -1,7 +1,13 @@
|
|||
## PyTorch Implementation of [AnimeGANv2](https://github.com/TachibanaYoshino/AnimeGANv2)
|
||||
|
||||
|
||||
**Weight Conversion (Optional, requires TensorFlow 1.x)**
|
||||
**Face Model**: Distilled from [this model](https://github.com/bryandlee/naver-webtoon-faces/blob/master/README.md#face2webtoon) with L2 + VGG + GAN Loss and CelebA-HQ images. See `test_faces.ipynb` for the inference. Model file can be downloaded from [here](https://drive.google.com/file/d/10T6F3-_RFOCJn6lMb-6mRmcISuYWJXGc/view?usp=sharing). Enjoy!
|
||||
|
||||
|
||||
<img src="./samples/face_results.jpg" width="512">
|
||||
|
||||
|
||||
**Weight Conversion from the Original Repo (Requires TensorFlow 1.x)**
|
||||
```
|
||||
git clone https://github.com/TachibanaYoshino/AnimeGANv2
|
||||
python convert_weights.py
|
||||
|
@ -12,6 +18,8 @@ python convert_weights.py
|
|||
python test.py --input_dir [image_folder_path]
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Results from converted [[Paprika](https://drive.google.com/file/d/1K_xN32uoQKI8XmNYNLTX5gDn1UnQVe5I/view?usp=sharing)] style model**
|
||||
|
||||
(input image, original tensorflow result, pytorch result from left to right)
|
||||
|
@ -20,4 +28,4 @@ python test.py --input_dir [image_folder_path]
|
|||
<img src="./samples/compare/2.jpg" width="960">
|
||||
<img src="./samples/compare/3.jpg" width="960">
|
||||
|
||||
**Note:** Training code not included / Tested on RTX3090 + PyTorch1.7.1 / Results slightly different due to the [bilinear upsample issue](https://github.com/pytorch/pytorch/issues/10604)
|
||||
**Note:** Tested on RTX3090 + PyTorch1.7.1 / Results from converted weights slightly different due to the [bilinear upsample issue](https://github.com/pytorch/pytorch/issues/10604)
|
||||
|
|
8
model.py
|
@ -93,12 +93,12 @@ class Generator(nn.Module):
|
|||
out = self.block_b(out)
|
||||
out = self.block_c(out)
|
||||
|
||||
# out = F.interpolate(out, half_size, mode="bilinear", align_corners=True)
|
||||
out = F.interpolate(out, scale_factor=2, mode="bilinear", align_corners=False)
|
||||
out = F.interpolate(out, half_size, mode="bilinear", align_corners=True)
|
||||
# out = F.interpolate(out, scale_factor=2, mode="bilinear", align_corners=False)
|
||||
out = self.block_d(out)
|
||||
|
||||
# out = F.interpolate(out, input.size()[-2:], mode="bilinear", align_corners=True)
|
||||
out = F.interpolate(out, scale_factor=2, mode="bilinear", align_corners=False)
|
||||
out = F.interpolate(out, input.size()[-2:], mode="bilinear", align_corners=True)
|
||||
# out = F.interpolate(out, scale_factor=2, mode="bilinear", align_corners=False)
|
||||
out = self.block_e(out)
|
||||
|
||||
out = self.out_layer(out)
|
||||
|
|
After Width: | Height: | Size: 843 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 131 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 35 KiB |