Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perceptual Loss missing #9

Open
Cuky88 opened this issue Jun 18, 2018 · 8 comments
Open

Perceptual Loss missing #9

Cuky88 opened this issue Jun 18, 2018 · 8 comments

Comments

@Cuky88
Copy link

Cuky88 commented Jun 18, 2018

Thanks for your great work @taki0112

I'm curious why you didn't implement the perceptual loss, is there a special reason?

Cheers.

@Cuky88 Cuky88 changed the title Perceptual Loss Perceptual Loss missing Jun 18, 2018
@taki0112
Copy link
Owner

To make the code more simpler
In original MUNIT, use the pretrained_vgg16_lua_version

So to load this model, we need the load_lua function in pytorch
I want to write the code only using tensorflow, so I did't implement the perceptual loss

However, I will also make it possible to do with tensorflow.

Thanks

@Cuky88
Copy link
Author

Cuky88 commented Jun 19, 2018

Hi, thanks for the fast reply.

I saw that and I'm already working on a solution in tf only.

@taki0112
Copy link
Owner

Is it possible to PR?

@Cuky88
Copy link
Author

Cuky88 commented Jun 19, 2018

Yes, I'll send you a PR when I'm finished

@taki0112
Copy link
Owner

Thanks a lot.

@Cuky88
Copy link
Author

Cuky88 commented Jun 20, 2018

@taki0112 Hi, I think I managed to get perceptual loss to work, but I'm not 100% sure.

Unfortunately I cannot create a PR, since I changed a couple of other things before. Please look at this commit. There is everything for perceptual loss. You can find the download links for the vgg16 weight files in vgg16.py on top in comment section. You can also look in this config file to see which values the arguments for the vgg part has. I only tested everything with the .h5 weight files.

Another issue would be to implement LPIPS Distance also in TF. Do you have such intentions?

It would be very good if you could look over the code, I'm not an expert in TF like you :)

EDIT: this commit is also needed.

@MartinMeliss
Copy link

MartinMeliss commented Jul 5, 2018

@Cuky88 Hi.
I think that you have a bug in the "vgg_preprocess" method in "ops.py".
You subtract means from the image, but the range of the image is -1: 1, and your values for the byte representation.
And, as far as I understand, VGG-16 requires an unregulated input:
line #263 ops.py:
channels[i] -= means[i]
should look like:
channels[i] = (channels[i] + 1.0) * 127.5 - means[i]

Сorrect me if I'm wrong.

@Cuky88
Copy link
Author

Cuky88 commented Jul 6, 2018

@MartinMeliss You are right, image floats are scaled between -1 and 1. So the vgg preprocessing is skrewing up everything. Thanks for pointing out, will fix soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants