lucasb-eyer / pydensecrf

Python wrapper to Philipp Krähenbühl's dense (fully connected) CRFs with gaussian edge potentials.
MIT License
1.94k stars 414 forks source link

Modify Q between inference steps #16

Closed pierrebaque closed 8 years ago

pierrebaque commented 8 years ago

Hello,

I am using your code and for some reason, I would need to modify Q between the steps. It means that I want to modify the initial point of each inference step (not let it be the output of the previous step by default). Is it something that can easily be handled with your implementation?

Let's say, for instance that I want to do something like:

for s in steps: d.stepInference(Q, tmp1, tmp2) Q = 0.5_Q + 0.5_my_Q

Of course, this doesn't work and I get the following error:

"Argument 'Q' has incorrect type (expected pydensecrf.eigen.MatrixXf, got numpy.ndarray)"

Cheers.

Pierre

lucasb-eyer commented 8 years ago

Yes, the way you describe is almost correct. As the error is hinting, you need to convert Q to a wrapped Eigen MatrixXf before passing it to stepInference. I have written the eigen.matrixXf function for this, you can see an example usage here in the eigen unit-test.

I'm closing this issue, but feel free to reopen if that doesn't work. If it works, I would be happy to hear of your use-case and/or paper once it's out!