taki0112 / UGATIT

Official Tensorflow implementation of U-GAT-IT: Unsupervised Generative Attentional Networks with Adaptive Layer-Instance Normalization for Image-to-Image Translation (ICLR 2020)
MIT License
6.17k stars 1.04k forks source link

Pretrained model? #5

Open yuskey opened 5 years ago

yuskey commented 5 years ago

Do you have any pretrained model weights? I currently can't train something like this so was curious if you had anything pretrained available.

taki0112 commented 5 years ago

I'm talking to the company about whether it's okay to release a pre-trained model. Please wait a little. Sorry.

chaowentao commented 5 years ago

I'm talking to the company about whether it's okay to release a pre-trained model. Please wait a little. Sorry.

I train the model in my own dataset. The result looks not very well. Hopefully you share your pre-trained model @taki0112

Ledarium commented 5 years ago

We want to make anime, please

tafseerahmed commented 5 years ago

If you open a patreon or something, we can subscribe for your pre-trained model 🗡

cpury commented 5 years ago

Alternatively, it would be amazing if you could share the selfie2anime dataset.

vulcanfk commented 5 years ago

Alternatively, it would be amazing if you could share the selfie2anime dataset.

See issue #6

kioyong commented 5 years ago

Can't wait to want a pre-trained model~ please~

hensat commented 5 years ago

Let's hope the company will allow you to place the model

hafniz commented 5 years ago

It would be really helpful if you could release some existing model for our reference. Please~

eddybogosian commented 5 years ago

Guys just chill for a moment. Taki already said that they're talking to the company about it. It's been 2 days. Calm down and wait. They know that we want this, flooding won't help.

In the meantime, why don't you try something yourself? You can use Microsofts Azure or Amazon AWS to train this type of network. Maybe you can even come up with something better! Who knows right?

tafseerahmed commented 5 years ago

The thing we need to understand is that no one likes begging and pleading. These people have worked hard on something, and it's completely up to them if they choose to release their models or datasets. I appreciate the fact that they open-sourced their code. Personally, I wouldn't mind even paying for their models and dataset. In the meantime let's stop flooding this thread and wait for @taki0112 's response.

mickae1 commented 5 years ago

If you don't want to share, and I can understand. You should create a website that offer the possibility to convert photo into anime. The website will become very popular. And you can get some money with the publicity

thewaifuai commented 5 years ago

I have published a pre-trained model for cat2dog on kaggle. Please let me know if you have any issues with it. I saved the results in this pdf so you can see what it looks like: results.pdf I used the cat2dog dataset from DRIT.

It takes 4+ days to train cropped face dataset and 16+ days to train cropped body dataset on Nvidia GPUs (estimates). Since it takes many days to train the dataset once, and it takes many iterations of training it will take some time but eventually many people will publish and share their pre-trained models in the weeks to come. Datasets can be found at DRIT. For selfie2anime you can use datasets selfie and anime face dataset. Other potential anime face dataset sources: thiswaifudoesnotexist, animeGAN for generating anime images and a one click download anime face dataset. UGATIT is quite general, you really just need a folder of anime faces and a folder of human faces and it figures the rest by itself.

amberjxd commented 5 years ago

@thewaifuai Hello! Would you like to publish the pre-trained model of selfie2anime in future? Thanks.

thewaifuai commented 5 years ago

@thewaifuai Hello! Would you like to publish the pre-trained model of selfie2anime in future? Thanks.

Yes

cpury commented 5 years ago

FYI, I'm using a quickly-assembled, crappy dataset and a relatively slow cloud GPU machine. Also, I reduced the resolution to 100x100 pixels (256 just takes too long for me). The results look like this after one day of training:

Screen Shot 2019-08-09 at 08 19 23 Screen Shot 2019-08-09 at 08 20 25

Not too bad, but still a lot of room for improvement :)

What I can recommend if you'd like to create a better one:

LiuShaohan commented 5 years ago

FYI, I'm using a quickly-assembled, crappy dataset and a relatively slow cloud GPU machine. Also, I reduced the resolution to 100x100 pixels (256 just takes too long for me). The results look like this after one day of training:

Screen Shot 2019-08-09 at 08 19 23 Screen Shot 2019-08-09 at 08 20 25

Not too bad, but still a lot of room for improvement :)

What I can recommend if you'd like to create a better one:

  • Make sure the two datasets have similar poses / distances to the face. You can tell in mine that the anime data is much more close-up to the face and so the model learned that part of the transformation is "zooming in".
  • Make sure the anime dataset is diverse. Right now, in my model, everything from black men to old women gets transformed into 12-yo-looking girls with giant eyes, white skin, and bangs. I'd really rather it learns something more diverse...
  • Get a serious cloud machine and expect to spend some time. The batch size of 1 is killing me 😅

FYI, I'm using a quickly-assembled, crappy dataset and a relatively slow cloud GPU machine. Also, I reduced the resolution to 100x100 pixels (256 just takes too long for me). The results look like this after one day of training:

Screen Shot 2019-08-09 at 08 19 23 Screen Shot 2019-08-09 at 08 20 25

Not too bad, but still a lot of room for improvement :)

What I can recommend if you'd like to create a better one:

  • Make sure the two datasets have similar poses / distances to the face. You can tell in mine that the anime data is much more close-up to the face and so the model learned that part of the transformation is "zooming in".
  • Make sure the anime dataset is diverse. Right now, in my model, everything from black men to old women gets transformed into 12-yo-looking girls with giant eyes, white skin, and bangs. I'd really rather it learns something more diverse...
  • Get a serious cloud machine and expect to spend some time. The batch size of 1 is killing me 😅

Can you share your training dataset?

Or Pretrained model?

Thanks Very Much!~

This is my email:liushaohan001@gmail.com

td0m commented 5 years ago

I have published a pre-trained model for cat2dog on kaggle. Please let me know if you have any issues with it. I saved the results in this pdf so you can see what it looks like: results.pdf I used the cat2dog dataset from DRIT.

@thewaifuai I'm not sure why but your cat2dog kaggle link doesn't work?

thewaifuai commented 5 years ago

I have published a pre-trained model for cat2dog on kaggle. Please let me know if you have any issues with it. I saved the results in this pdf so you can see what it looks like: results.pdf I used the cat2dog dataset from DRIT.

@thewaifuai I'm not sure why but your cat2dog kaggle link doesn't work?

Oops kaggle datasets are private by default, I had to manually make it public. It is now public and should work.

tafseerahmed commented 5 years ago

I have published a pre-trained model for cat2dog on kaggle. Please let me know if you have any issues with it. I saved the results in this pdf so you can see what it looks like: results.pdf I used the cat2dog dataset from DRIT.

I am actively working on writing a TPU version of UGATIT. If anyone is interested please respond to my UGATIT TPU issue. I am interested with working with others to make the TPU version.

It takes 4+ days to train cropped face dataset and 16+ days to train cropped body dataset on Nvidia GPUs (estimates). Since it takes many days to train the dataset once, and it takes many iterations of training it will take some time but eventually many people will publish and share their pre-trained models in the weeks to come. Datasets can be found at DRIT. For selfie2anime you can use datasets selfie and anime face dataset. Other potential anime face dataset sources: thiswaifudoesnotexist, animeGAN for generating anime images and a one click download anime face dataset. UGATIT is quite general, you really just need a folder of anime faces and a folder of human faces and it figures the rest by itself.

Should the images in trainA and trainB be of same sizes? the selfies are 306x306 but my anime faces were 512x512 mixed pngs and jpgs. I did run into some errors.

tafseerahmed commented 5 years ago

This is on a 4x P100 with 11 GB VRAM on each trainA is selfie dataset and trainB is http://www.seeprettyface.com/mydataset_page2.html + 1k dump of male anime from gwern's TWDNEv2 website. image image

I guess, if I reduce the batch size? then I can quickly train and release the pre-trained models.

cpury commented 5 years ago

@tafseerahmed the size and format of the images shouldn't matter. They get resized anyway AFAIK.

The error you're getting is OOM - out of memory. I believe you don't have enough available RAM (as opposed to GPU memory) to create the model. Is that possible?

thewaifuai commented 5 years ago

@tafseerahmed use the --light True option, if that does not work run pkill python3 and then try again with the --light True option. This runs the light version of UGATIT.

tafseerahmed commented 5 years ago

@tafseerahmed the size and format of the images shouldn't matter. They get resized anyway AFAIK.

The error you're getting is OOM - out of memory. I believe you don't have enough available RAM (as opposed to GPU memory) to create the model. Is that possible?

image

Someone is using 2 GPU's right now but I still have over 256GB of RAM available.

tafseerahmed commented 5 years ago

@tafseerahmed use the --light True option, if that does not work run pkill python3 and then try again with the --light True option. This runs the light version of UGATIT.

wouldn't that reduce the quality of final results?

thewaifuai commented 5 years ago

@tafseerahmed use the --light True option, if that does not work run pkill python3 and then try again with the --light True option. This runs the light version of UGATIT.

wouldn't that reduce the quality of final results?

Yes

tafseerahmed commented 5 years ago

@tafseerahmed use the --light True option, if that does not work run pkill python3 and then try again with the --light True option. This runs the light version of UGATIT.

wouldn't that reduce the quality of final results?

Yes

lol thanks its training now image but did you train yours on the heavy model instead of light? I imagine the full model requires more than 16GB VRAM

cpury commented 5 years ago

The light version significantly reduces the capacity of the model. I haven't trained for long but I don't think it's worth trying.

With that hardware, you really should not have any memory issues. Maybe the dataset is too big and already takes up most the memory? I don't know but I think you should investigate / experiment more.

tafseerahmed commented 5 years ago

The light version significantly reduces the capacity of the model. I haven't trained for long but I don't think it's worth trying.

With that hardware, you really should not have any memory issues. Maybe the dataset is too big and already takes up most the memory? I don't know but I think you should investigate / experiment more.

the batch size was set to 1 by default (that's ineffective when you have a GPU), so I can't imagine that the hardware was an issue. I will debug more and let you guys know, in the meantime, I am training on the light model.

cpury commented 5 years ago

Yeah, batch size of 1 is necessary for cycle GANs.

Another thing I've learned: You can increase the speed of your training quite significantly by already providing the right image size. Because otherwise the training procedure will take loads of time just resizing images. Here's what it says in the paper:

All models are trained using Adam [19] with β1=0.5 and β2=0.999. For data augmentation, we flipped the images horizontally with a probability of 0.5, resized them to 286 x 286, and random cropped them to 256 x 256.

I would first use imagemagick to batch-resize all your data to 286x286 or similar. I think that could save you a day or so in training time.

sjisjaksjk commented 5 years ago

我发你妈一直发发发你妈死了?------------------ 原始邮件 ------------------ 发件人: "Max"notifications@github.com 发送时间: 2019年8月9日(星期五) 下午5:29 收件人: "taki0112/UGATIT"UGATIT@noreply.github.com; 抄送: "Subscribed"subscribed@noreply.github.com; 主题: Re: [taki0112/UGATIT] Pretrained model? (#5)

Yeah, batch size of 1 is necessary for cycle GANs.

Another thing I've learned: You can increase the speed of your training quite significantly by already providing the right image size. Because otherwise the training procedure will take loads of time just resizing images. Here's what it says in the paper:

All models are trained using Adam [19] with β1=0.5 and β2=0.999. For data augmentation, we flipped the images horizontally with a probability of 0.5, resized them to 286 x 286, and random cropped them to 256 x 256.

I would first use imagemagick to batch-resize all your data to 286x286 or similar. I think that could save you a day or so in training time.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

cpury commented 5 years ago

BTW I didn't have any trouble getting the non-light version to run on a machine with much less RAM and only one GPU. So I can only think of two possible ways why it fails for you:

  1. Some configuration issue
  2. Your dataset being too large
tafseerahmed commented 5 years ago

trainA is selfie dataset with 47k images trainB is anime dataset with 5K images.

I will try again tonight when more resources are free on the full model. The config is completely default. I will resize the images and run again, thanks for the tip!

coldliang commented 5 years ago

我发你妈一直发发发你妈死了?------------------ 原始邮件 ------------------ 发件人: "Max"notifications@github.com 发送时间: 2019年8月9日(星期五) 下午5:29 收件人: "taki0112/UGATIT"UGATIT@noreply.github.com; 抄送: "Subscribed"subscribed@noreply.github.com; 主题: Re: [taki0112/UGATIT] Pretrained model? (#5) Yeah, batch size of 1 is necessary for cycle GANs. Another thing I've learned: You can increase the speed of your training quite significantly by already providing the right image size. Because otherwise the training procedure will take loads of time just resizing images. Here's what it says in the paper: All models are trained using Adam [19] with β1=0.5 and β2=0.999. For data augmentation, we flipped the images horizontally with a probability of 0.5, resized them to 286 x 286, and random cropped them to 256 x 256. I would first use imagemagick to batch-resize all your data to 286x286 or similar. I think that could save you a day or so in training time. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

你在项目的最上方取消对这个项目的“watching”就行了,就收不到邮件了噢,那个"unwatch"那里

tafseerahmed commented 5 years ago

Screenshot from 2019-08-09 17-35-03 Okay this is weird, trainA and trainB are both 286x286 and n=5003. I still cant train them on the full model

cpury commented 5 years ago

Some hand-picked results after two days of training on a low-quality dataset: https://twitter.com/cpury123/status/1159844171047301121

results

t04glovern commented 5 years ago

Here's a couple of mine, just over 18 hours of training (rtx2080ti) on the selfie & anime datasets linked in the other issue.

https://twitter.com/nathangloverAUS/status/1159871270986534913

1 2 3

tafseerahmed commented 5 years ago

@t04glovern could you please share the data sets?

t04glovern commented 5 years ago

@t04glovern could you please share the data sets?

I just used the following:

I'll try to zip them up and upload a bundle when I get a tick

My ratios are:

testA (anime) - 9653 testB (selfie) - 5121 trainA (anime) - 37183 trainB (selfie) - 22259

I have a fork going on https://github.com/t04glovern/UGATIT. There's a resize.py tool you can use to reduce the image sizes if you need.

cpury commented 5 years ago

@t04glovern that's amazing! the structure of the conversions is much more impressive than mine!

opentld commented 5 years ago

This is on a 4x P100 with 11 GB VRAM on each trainA is selfie dataset and trainB is http://www.seeprettyface.com/mydataset_page2.html + 1k dump of male anime from gwern's TWDNEv2 website.

I guess, if I reduce the batch size? then I can quickly train and release the pre-trained models. I am waiting for your models... @tafseerahmed

heart4lor commented 5 years ago

Here's some manually picked checkpoint samples after ~15 hours training on GTX 1080

image image image image image image image

Dataset:

And I did some preparations:

According to the paper 5.2. Dataset, I wrote this script and selected 3400 female selfies(but the selfie labels seems contains some errors so there's still some male selfies) as trainset and 100 as testset. relatively, I choose the biggest 3500 anime pictures as anime trainset and testset.

You can download this 2*3500 dataset from here.

This dataset still can be improved, especially the selfie dataset. If the angle and position can be more corresponding with the anime, I think the preference will be better. as a matter of fact, these samples manually picked above are those selfies relatively good.

tafseerahmed commented 5 years ago

Here's a couple of mine, just over 18 hours of training (rtx2080ti) on the selfie & anime datasets linked in the other issue.

https://twitter.com/nathangloverAUS/status/1159871270986534913

1 2 3

Could you publish the pre-trained model?

t04glovern commented 5 years ago

Alright, I've been training for over a day now and thought I'd share my pre-trained model.

Video

https://twitter.com/nathangloverAUS/status/1160188181414760449

Examples

https://twitter.com/nathangloverAUS/status/1160167218266570752

anime-example

Pre-trained model

https://www.kaggle.com/t04glovern/ugatit-selfie2anime-pretrained

amberjxd commented 5 years ago

Alright, I've been training for over a day now and thought I'd check my pre-trained model.

Examples

https://twitter.com/nathangloverAUS/status/1160167218266570752

anime-example

Pre-trained model

https://www.kaggle.com/t04glovern/ugatit-selfie2anime-pretrained

Great! Keep going!

opentld commented 5 years ago

最近不知为啥不能科学上网,kaggle用email注册又验证不过。。。 哪位朋友下载了放在百度网盘上共享一下? 不敢发英文,怕给咱们国家的大局域网丢人。。。

xizeyoupan commented 5 years ago

最近不知为啥不能科学上网,kaggle用email注册又验证不过。。。 哪位朋友下载了放在百度网盘上共享一下? 不敢发英文,怕给咱们国家的大局域网丢人。。。

目前的训练模型效果都不好,再等等吧

TinySlik commented 5 years ago

最近不知为啥不能科学上网,kaggle用email注册又验证不过。。。 哪位朋友下载了放在百度网盘上共享一下? 不敢发英文,怕给咱们国家的大局域网丢人。。。

链接: https://pan.baidu.com/s/13gXM82kgU6yn0NpmlSXY1g 提取码: 3gn5

this env is too big. img so i'm blocking when the "Executing transaction: done" end , I guess.

Then, I try the comand get this " ImportError: cannot import name 'prefetch_to_device" Now , I'm sad...

suedroplet commented 5 years ago

Alright, I've been training for over a day now and thought I'd share my pre-trained model.

Video

https://twitter.com/nathangloverAUS/status/1160188181414760449

Examples

https://twitter.com/nathangloverAUS/status/1160167218266570752

anime-example

Pre-trained model

https://www.kaggle.com/t04glovern/ugatit-selfie2anime-pretrained

Hi. Thanks your awesome work! But I got some errors on my computer. When I tried the train command, it raised an error "failed to load the checkpoint". And I got a strange result after running the test command. Could you please tell me why? image

td0m commented 5 years ago

@suedroplet I had a similar issue, I think it's to do with the checkpoint folder naming. To solve this I trailed the model myself (literally 1 iteration then i quit) just so that it created a checkpoint folder for the dataset. I then replaced all the files in ./checkpoint/<your-generated-dataset-model-folder>/ with the files provided in the pretrained model.