jcjohnson / neural-style

Torch implementation of neural style algorithm
MIT License
18.31k stars 2.7k forks source link

What's the logic in choosing style and content layers? #250

Open rayset opened 8 years ago

rayset commented 8 years ago

I tried playing a bit with those two parameters, but more often than not I get this error:

''function value changing less than tolX''

The layers I tried were completely random, I wonder if there are some ''working'' combinations for the default model? how do you pick yours?

Runescaped commented 8 years ago

I've had that "error" pop up before, I believe it occurs when the variations between each iteration becomes insignificant.

I'm currently messing with layers and such. A user on reddit posted this link, which I thought was interesting. Here's their post w/ some tips.

rayset commented 8 years ago

thanks, I was using that link as a reference too, but I get the error with some combinations that are working for the redditor.

where can I find how many relus are there in the vgg19? I mean, is there a thing such as relu6_6 or do they stop at say, relu5_4?

Runescaped commented 8 years ago

I'm not sure how many relus there are... I don't think there's a relu6_6 though.

How many iterations are you able to do before you get that error?

rayset commented 8 years ago

a plain zero :)

the few times it works I get infinite loss and black output (I guess it's the opposite problem of having ''function value changing less than tolX''). I'm on clnn backend.

Runescaped commented 8 years ago

That's bizarre, can you post an example of a command that fails instantly?

bmaltais commented 8 years ago

You might want to consider the code I submited there: https://github.com/jcjohnson/neural-style/issues/237#issuecomment-226553422

It essentially "auto-balance" style and content layers based on either minimum loss or max loss. It give interesting results.

rayset commented 8 years ago

I was just reading that post, if we don't look at those creepy cat photos it's quite cool!

I think it's totally worth a pull.

bmaltais commented 8 years ago

@rayset Yeah, there is sort of two discussion mixed in there. I think the layer weight balancing is an interesting idea worth investigating. I don't think I have the implementation 100% right. For example, I don't like what happen if you use both min and max balancing at the same time. Not sure how to best implement that yet.

I was surprise how much effect there is in tuning content layer weights, especially when using a strong min balancing.

rayset commented 8 years ago

if you have some other examples using your min-max approach it would be amazing to see them.

that topic is very interesting, I had no idea there were tools to look so good into feature maps.