Understanding symbol_fcnxs.py


#1

I am not sure how many people have been confused by symbol_fcnxs.py when reading it for the first time. I did. The most confusing part is possibly the following codes used to compute the offset for the cropping layers.

def filter_map(kernel=1, stride=1, pad=0):
    return (stride, (kernel-stride)/2-pad)

def compose_fp(fp_first, fp_second):
    return (fp_first[0]*fp_second[0], fp_first[0]*fp_second[1]+fp_first[1])

def compose_fp_list(fp_list):
    fp_out = (1.0, 0.0)
    for fp in fp_list:
        fp_out = compose_fp(fp_out, fp)
    return fp_out

def inv_fp(fp_in):
    return (1.0/fp_in[0], -1.0*fp_in[1]/fp_in[0])

After deriving the offset manually, I finally understand this part. For your information, I have written a blob post which explains the computation logic.


#2

Thanks for the documentation. I wonder if we could persuade you to add this explanation as a PR for the example in the repo either at https://github.com/apache/incubator-mxnet/tree/master/example/fcn-xs or as comments in the Python code. That would be of tremendous benefit to future readers.


#3

Hi, @simonco. Thank you for you reply.

I will be glad to do so. Please allow me some time to figure out how to do it well.

Thank you.