lucasb-eyer / pydensecrf

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

Bad shape for unary energy #34

Closed MehulAjax21 closed 7 years ago

MehulAjax21 commented 7 years ago

Hi Lukas,

I see the above error while running the densecrf. i will list down the steps here:

d = dcrf.DenseCRF2D(224, 224, 8) U = unary_from_softmax(unary) # Unary is output of softmax d.setUnaryEnergy(U)

Here is get the above error: Bad shape for unary energy (Need (224, 224), got (8, 50176))

I think a similar bug is fixed in a commit (b5e13a9). could you please update the same for the setUnaryEnergy method also?

lucasb-eyer commented 7 years ago

Thanks for the report, looks like the checks I added today aren't the best :smile: It's late here, so I'll see what's up tomorrow!

lucasb-eyer commented 7 years ago

Ok this was an actual bug that I fixed in the above commit, please try it out!

MehulAjax21 commented 7 years ago

Hi Lukas thanks for your reply. I had to work last night So I also fixed the bug myself. I did the same changes. Also, as I have tested it, the changes are fine.