richzhang / colorization

Automatic colorization using deep neural networks. "Colorful Image Colorization." In ECCV, 2016.
http://richzhang.github.io/colorization/
BSD 2-Clause "Simplified" License
3.35k stars 928 forks source link

inconsistent number of nearest neighbor? #59

Closed azshue closed 5 years ago

azshue commented 5 years ago

Hello,

In the implementation of color encoding (./colorization/colorization/resources/caffe_traininglayers.py)

class NNEncLayer(caffe.Layer):
    ''' Layer which encodes ab map into Q colors
    INPUTS    
        bottom[0]   Nx2xXxY     
    OUTPUTS
        top[0].data     NxQ     
    '''
    def setup(self,bottom, top):
        warnings.filterwarnings("ignore")

        if len(bottom) == 0:
            raise Exception("Layer should have inputs")
        self.NN = 10.
        self.sigma = 5.
        self.ENC_DIR = './resources/'
        self.nnenc = NNEncode(self.NN,self.sigma,km_filepath=os.path.join(self.ENC_DIR,'pts_in_hull.npy'))

It seems that NN=10 in the implementation, while in the paper, it says that you are finding 5-nearest neighbors to do the encode.

Could anyone please tell me if I missed something in the code, and what value should self.NN be?

Thanks in advance.

richzhang commented 5 years ago

Thanks for pointing this out. This is a typo in the paper!