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 #35

Closed DaveRichmond- closed 7 years ago

DaveRichmond- commented 7 years ago

Hi Lucas,

I'm trying to run pydensecrf on a new computer. I just installed everything and I get a new bug (everything was working fine with previous installation a few months ago).

I think the easiest way to confirm the problem is to run the example: Non RGB Example. Stepping through this example, in Cell #4 I get the following error:

ValueError: Bad shape for unary energy (Need (400, 512), got (2, 204800))

Looking into the code a little bit further, I see the following "TODO" item (copied at end of message). I'm rather confused, because it seems like my unary energy is the correct shape. Please advise.

Thanks, Dave

def setUnaryEnergy(self, float[:,::1] u not None, float[:,::1] f = None): if u.shape[0] != self._nlabel or u.shape[1] != self._nvar: raise ValueError("Bad shape for unary energy (Need {}, got {})".format((self._nlabel, self._nvar), (u.shape[0], u.shape[1])))

TODO: I don't remember the exact shape f should have, so I'm not putting an assertion here.

    #       If you get hit by a wrong shape of `f`, please open an issue with the necessary info!
lucasb-eyer commented 7 years ago

Hi Dave,

I don't think the TODO affects you at all here.

When exactly did you install this PyDenseCRF? Your issue looks exactly like #34 which I fixed ~16h ago. Could you please make sure you're running with these latest changes?

Cheers, Lucas

DaveRichmond- commented 7 years ago

Hi Lucas,

Thanks. I re-installed and everything is working now. (I had installed 24hours ago).

Best, Dave