Comments (13)
I've seen people successfully use L-BFGS with neural nets, given they use large batches. So I personally would try to average the gradient over all my images before I run an L-BFGS step.
Averaging gradients over all images is the same as computing the gradient of the total loss if the total loss is the sum over each image's loss. So I feel like it should work this way.
But yeah, the caveat is that I haven't tried this, and as usual with nonlinear optimization, you never know until you try 😉 Hence I'm very curious to hear back from anyone trying this.
Also, re-opening since there's more information now, albeit not from OP.
from pydensecrf.
Disclaimer: I've not used densecrf with learning.
Since it's learning the parameters by gradient-based optimization (l-bfgs here), my guess is that you could do it similarly to neural networs: compute the gradients on say B random pictures, so you get B gradients. Average them, then do an optimizer step. Then pick B next pictures, compute average gradient, do an optimizer step. This way you should in theory optimize the parameters over all pictures.
I'm not sure how well this will work in practice with dense crfs, but if you try it, I'm curious (and others probably too) so please report back whether it worked or not. And of open a PR with any changes you needed :)
from pydensecrf.
hey! if any of you have coded or found the above code. can you point me towards it, or send me the code. I need to run the training process on a set of images and predict on some other image.
from pydensecrf.
Hi Luka,
I'm sorry, it looks like I completely missed your issue! I believe that I currently didn't wrap the learning part of the API at all, only the inference, so is it possible that you mean "run inference" as opposed to "train"?
from pydensecrf.
Closing due to inactivity and unclarity about actual issue.
from pydensecrf.
Hello, I also have the same question.
I have some training images and test images, So how to train the CRF model and get the parameters, do you have any piece of advice about learning?
from pydensecrf.
Funny you ask, I added a few more pointers about learning to the README just yesterday!
I myself don't have the time (and need) to implement learning, but I think it should be straightforward to add for someone motivated enough. Hope these pointers can give you a start, and should you manage to add learning, I'd be happy about a pull-request!
from pydensecrf.
Okay, thank you for your reply.
from pydensecrf.
Ah, and i have another question about learning. I have read the original learning cpp code and find that they use only one image optimize the CRF function and get all learning parameters. So if I want to train N images, I have to get N couples of learning parameters and choose the best learning parameters that get the minimize error to the other images, or do you have any piece of advice to get the learning parameters of the multiple images?
Thank you.
from pydensecrf.
Okay, thanks for your advice and i will have a try.
from pydensecrf.
I think part of the issue with averaging gradients won't come from the fact we're trying to optimise a CRF, but rather that we're using L-BFGS - as it is using line searching & an approximate Hessian to calculate updates. Still, worth a try at least.
from pydensecrf.
Useful discussion, anything added to the repo on learning?
from pydensecrf.
@dhawan98, @lucasb-eyer Did you find the code for the Set of images? If found, please direct me .
Thanks
from pydensecrf.
Related Issues (20)
- Extract the filters
- Custom label compatibility function
- could anyone give me some advise? HOT 4
- Inference runs much slower in python 2.7 than 3.6 HOT 3
- apply densecrf to node classification
- can use DenseCRF2D but can't use DenseCRF HOT 1
- what does unary means ?
- Can't install. HOT 7
- Where is the DenseCRF2D?
- Change one cpp file in the source code and compile [3DVolumes]
- New release on PyPi? HOT 26
- terminate called after throwing an instance of 'std::length_error' what(): vector::_M_fill_insert Aborted (core dumped)
- Bad shape for unary energy HOT 1
- Questions on the library
- This error originates from a subprocess, and is likely not a problem with pip HOT 5
- fatal error: Python.h: No such file or #include "Python.h" HOT 1
- pip install error RHEL Fedora HOT 2
- Make installation easier through pure Python packages. HOT 1
- compatibility issue with cython 3.0.0 HOT 5
- dont know how to solve this,already install cpython HOT 1
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 pydensecrf.