Open iammarvelous opened 7 years ago
Actually, different versions of crf code had different way of shaping the image. I am handling it lazily in comments (i know its not clean! :( ). But yes, if you are using PIL and running on default crf examples, then you need to uncomment the lines as you correctly pointed out above.
Moreover, if you want to handle it programmatically (unlike I did it in comments), then feel free to do a pull request and I will be happy to merge it. Hope this answers your question.
Well, I haven't looked deeper into the code. The demo part is easy to fix. But when I use run_full.py
, it returns that error. It looks like similar reason. Did you test run_full.py
?
BTW, uncomment that line solely does not solve the problem. You need to convert the type.
When labels having 0 values are sent to U[labels - 1 if zero_unsure else labels, np.arange(U.shape[1])] = p_energy labels-1 operation gives 255 wherever there is a 0(because dtype of labels is uint8) which causes the IndexOutOfRange range error. We need to make sure that 0s are not passed in labels. As a workaround for now, I've replaced the above line of code with U[labels, np.arange(U.shape[1])] = p_energy
When I try
run_full
, it throws the following error during crf step.In fact, the two versions in crf demo are not the same. The following change should be made.