Commit 7e281802 authored by sr9's avatar sr9

upsampling method changed + face model added

parent 57047727
## 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"> &nbsp;
**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"> &nbsp;
<img src="./samples/compare/3.jpg" width="960"> &nbsp;
**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)
......@@ -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)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment