Comments (10)
I'm suscribed to your repo, and it always amazes me your dedication. Keep this fantastic work!
from neural-style-pt.
@JaledMC I finally figured out how to implement -normalize_gradients
and I've added it to the master branch!
from neural-style-pt.
@JaledMC You can get somewhat similar results to neural-style's -normalize_gradients
parameter, if you set the content weight value to 0 with: -content_weight 0
.
from neural-style-pt.
@JaledMC For some reason my code is not detecting the correct model definition. I have these lines in CaffeLoader.py: https://github.com/ProGamerGov/neural-style-pt/blob/master/CaffeLoader.py#L172-L173, where I try to detect the model based on the name it has. I had to remake my own version of Loadcaffe from Torch7, and because PyTorch models lack a prototxt file, my code determines what model it is by the model's name.
When I run:
python neural_style.py -backend cudnn -model_file models/channel_pruning.pth
It seems to work properly when I run it on Ubuntu or Windows, so could there be an issue with bash? But I would have thought argparse would convert the parameter input to a string. What Python version were you using? And did you make sure that you had the most up to date version of neural-style-pt?
from neural-style-pt.
Thanks! For some reason, it was searching NIN keys, no matter the input_model
. Anyway, I updated your repo as you said, and it works, both python 3.5 and 3.6.9.
PD: I have tried to add -normalize_gradient, but at this moment, the output images don't change much with the style_weight.
100 iterations with style_weight 3000
200 iterations with style_weight 3000
If I find any solution, will make a pull request.
from neural-style-pt.
@JaledMC The original neural-style has gradient normalization in the backward pass, while your code had gradient normalization in the forward pass.
Justin Johnson's code also does the total variance denoising in the backward pass as well. That's why neural-style-pt's total variance denoising is different than neural-style's total variance denoising, because I do it in the forward pass.
from neural-style-pt.
You are totally right, and the code differences are clear. I only gave attention to the Gram implementation and didn't notice it. My fault.
Thank you so much. Because there is no problem, I'm going to close this issue.
from neural-style-pt.
@JaledMC It may be possible to use backward hooks to make gradient normalization possible, but I was never able to get it working. Though I was also a lot worse at programming at the time I tried to get it working.
from neural-style-pt.
So, this is what one would think you would use to replicate neural-style's -gradient_normalization
feature in PyTorch, as it's literally the exact same functions:
tensor.div(torch.norm(tensor, 1) + 1e-8)
Torch7's torch.norm(), looks similar to PyTorch's Torch.norm, but I think there may be differences: https://pytorch.org/docs/stable/_modules/torch/functional.html#norm
It also looks like -normalize_gradients
from neural-style, may not actually be gradient normalization, and instead a form of gradient scaling: jcjohnson/neural-style#374. Though @jcjohnson seems to have thought it was gradient normalization when he implemented it: jcjohnson/neural-style@0c5d5d5
from neural-style-pt.
@ProGamerGov, excuse my delay. I didn't see your replies. My fault. Pytorch in my conda enviroment broke down, and resist to load caffe models. I fixed it today, and new runs can be done.
As you said, I used tensor.div(torch.norm(tensor, 1) + 1e-8)
, and didn't work. Some changes to mimic official repo only gave me errors :/ But I am going to try -content_weight 0
.
As always, thanks for your amazing work
from neural-style-pt.
Related Issues (20)
- FileNotFound error, as well as a few other errors. HOT 9
- Is pytorch actually required? HOT 2
- 2nd file not found when using a list of 2 style images HOT 5
- Error Message caffe2_nvrtc.dll HOT 1
- Using without CUDA? HOT 2
- Advice: Ability to create video? HOT 5
- Various Tests could use settings recommendations
- Understanding Multidevice Strategy HOT 7
- Unpickling stack underflow HOT 3
- Print seed used? HOT 1
- -init_image doesn't work? HOT 2
- No images found after running script HOT 7
- Missing final A7 reference HOT 2
- How to reduce the batch size? HOT 1
- Multiple Content Image / Video Frame Option HOT 2
- Is a batch process possible? HOT 1
- Support for additional pre trained models HOT 1
- Can you share your training parameters? I can't get as good a performance as you. HOT 4
- MPS Support HOT 6
- HalfTensor (float16) support? tried to implement but failed :( HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neural-style-pt.