fuy34 / superpixel_fcn

[CVPR‘20] SpixelFCN: Superpixel Segmentation with Fully Convolutional Network
Other
392 stars 80 forks source link

The meaning of variable "prob" used in functions "poolfeat()" and "upfeat()" seems inconsistent #4

Closed wrccrwx closed 4 years ago

wrccrwx commented 4 years ago

Dear authors, The paper and the code are impressive. I have a simple question: In file "train_util.py", the definition of the variable "prob" used in functions "poolfeat()" and "upfeat()" is quite confusing. Concretely, for the first dim of "prob" (prob[:, 0, :, :]) in function "poolfeat()", it is used accompanied with the bottom right superpixel. However, in function "upfeat", this dim is used with the top left superpixel. I assume that in the paper, the superpixel and the prob in equation 1 and 2 should be consistent. What is the definition of every dim in the variable "prob" in your code settings?

Thanks!

fuy34 commented 4 years ago

Hey, Thank you for your interest in our work. The prob means the association map in our paper.

For Poolfeat, the four dimensions represent batch, the probability to be assigned to one of the 9 neighboring grid cells, height, and weight. Therefore, we send the current location's value to its neighbor to compute the weighted sum. https://github.com/fuy34/superpixel_fcn/blob/0f07be910e41ac73404de23caa99f0e454c6440c/train_util.py#L90

For upfeat, the four dimensions represent batch, the weight of the current cell is associated with the pixels in the 9 neighboring grid cells, height, and weight. Thus, we need to get the original probability from that location to perform the weighted sum. https://github.com/fuy34/superpixel_fcn/blob/0f07be910e41ac73404de23caa99f0e454c6440c/train_util.py#L142

I know it could be a little confusing at first glance. But I am sure you can figure it out by drawing a few pictures with the grid.

wrccrwx commented 4 years ago

Thanks! Now, I understand the meaning of variable "prob". The code and the paper are really impressive! I never thought that the computation of superpixel-related operation could be operated in this way.