Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
animegan2-pytorch
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
git
animegan2-pytorch
Commits
75191acc
Commit
75191acc
authored
Nov 06, 2021
by
xhlulu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add torch hub usage to readme
parent
2e040c6d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
2 deletions
+40
-2
README.md
README.md
+40
-2
No files found.
README.md
View file @
75191acc
## PyTorch Implementation of [AnimeGANv2](https://github.com/TachibanaYoshino/AnimeGANv2)
**Torch Hub Usage**
You can load Animegan v2 via
`torch.hub`
:
```
python
import
torch
model
=
torch
.
hub
.
load
(
'xhlulu/animegan2-pytorch'
,
'generator'
)
.
eval
()
# convert your image into tensor here
out
=
model
(
img_tensor
)
```
You can load with various configs (more details in
[
the torch docs
](
https://pytorch.org/docs/stable/hub.html
)
):
```
python
model
=
torch
.
hub
.
load
(
"xhlulu/animegan2-pytorch"
,
"generator"
,
pretrained
=
True
,
# or give URL to a pretrained model
device
=
"cuda"
,
# or "cpu" if you don't have a GPU
progress
=
True
,
# show progress
)
```
You can also load the
`face2paint`
util function. First, install dependencies:
```
pip install torchvision Pillow numpy
```
Then, import the function using
`torch.hub`
:
```
python
face2paint
=
torch
.
hub
.
load
(
'xhlulu/animegan2-pytorch'
,
'face2paint'
,
size
=
512
,
device
=
"cpu"
)
img
=
Image
.
open
(
...
)
.
convert
(
"RGB"
)
out
=
face2paint
(
model
,
img
)
```
**Weight Conversion from the Original Repo (Requires TensorFlow 1.x)**
```
git clone https://github.com/TachibanaYoshino/AnimeGANv2
...
...
@@ -78,5 +118,3 @@ Trained on <b>512x512</b> face images. Compared to v1, `🔻beautify` `🔺robus
</details>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment