Python caffe.Layer() Examples

The following are 5 code examples of caffe.Layer(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module caffe , or try the search function .
Example #1
Source File: caffe_traininglayers.py    From interactive-deep-colorization with MIT License 6 votes vote down vote up
def setup(self, bottom, top):
        if(len(bottom) != 2):
            raise Exception("Layer needs 2 inputs")

        self.param_str_split = self.param_str.split(' ')
        # self.keep_ratio = float(self.param_str_split[0]) # frequency keep whole input

        self.N = bottom[0].data.shape[0]
        self.C = bottom[0].data.shape[1]
        self.X = bottom[0].data.shape[2]
        self.Y = bottom[0].data.shape[3]

        if(self.X != 1 or self.Y != 1):
            raise Exception("bottom[0] should have spatial dimensions 1x1")

        # self.Nref = bottom[1].data.shape[0]
        # self.Cref = bottom[1].data.shape[1]
        self.Xref = bottom[1].data.shape[2]
        self.Yref = bottom[1].data.shape[3] 
Example #2
Source File: caffe_traininglayers.py    From interactive-deep-colorization with MIT License 5 votes vote down vote up
def setup(self, bottom, top):
        warnings.filterwarnings("ignore")

        if(len(bottom) != 1):
            raise Exception("Layer should a single input")
        if(bottom[0].data.shape[1] != 3):
            raise Exception("Input should be 3-channel BGR image")

        self.N = bottom[0].data.shape[0]
        self.X = bottom[0].data.shape[2]
        self.Y = bottom[0].data.shape[3] 
Example #3
Source File: caffe_traininglayers.py    From interactive-deep-colorization with MIT License 5 votes vote down vote up
def setup(self, bottom, top):
        warnings.filterwarnings("ignore")

        if(len(bottom) != 1):
            raise Exception("Layer should a single input")
        if(bottom[0].data.shape[1] != 3):
            raise Exception("Input should be 3-channel BGR image")

        self.N = bottom[0].data.shape[0]
        self.X = bottom[0].data.shape[2]
        self.Y = bottom[0].data.shape[3] 
Example #4
Source File: caffe_traininglayers.py    From interactive-deep-colorization with MIT License 5 votes vote down vote up
def setup(self, bottom, top):
        if(len(bottom) == 0):
            raise Exception("Layer needs inputs")

        self.param_str_split = self.param_str.split(' ')
        self.keep_ratio = float(self.param_str_split[0])  # frequency keep whole input
        self.cnt = 0

        self.N = bottom[0].data.shape[0]
        self.C = bottom[0].data.shape[1]
        self.X = bottom[0].data.shape[2]
        self.Y = bottom[0].data.shape[3] 
Example #5
Source File: caffe_traininglayers.py    From interactive-deep-colorization with MIT License 5 votes vote down vote up
def setup(self, bottom, top):
        warnings.filterwarnings("ignore")

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

        self.N = bottom[0].data.shape[0]
        self.X = bottom[0].data.shape[2]
        self.Y = bottom[0].data.shape[3]
        self.Q = self.nnenc.K