# Path: pyfacades/rectify.py
# def H(dleft, dright, dtop, dbottom, width, length):
#     return H_v(dleft, dright, width, length).dot(H_h(dtop, dbottom, width, length))


import caffe
import numpy as np
import os
import random
import skimage.transform
from glob import glob
from pyfacades.rectify import H as homography
        self.width = 512
        self.batch_size = 1
        self.epochs = 0
        self.counter = 0
        self.source = 'output_stacks2'
        self.files = glob(os.path.join(self.source, '*.npy'))

    # noinspection PyMethodOverriding
    def setup(self, bottom, top):
        random.shuffle(self.files)

        print 'source:', self.source
        print 'number of files:', len(self.files)

    # noinspection PyMethodOverriding
    def reshape(self, bottom, top):
        # no "bottom"s for input layer
        if len(bottom) > 0:
            raise Exception('cannot have bottoms for input layer')

        # make sure you have the right number of "top"s
        assert len(top) == self.num_labels  # +1 for RGB,  -1 for the 'background' label.

        top[0].reshape(self.batch_size, self.num_channels, self.height, self.width)

        # Label 0 is background, we can / should safely ignore it!
        for i in range(1, self.num_labels):
            top[i].reshape(self.batch_size, 1, self.width, self.height)

    # noinspection PyUnusedLocal

# Path: pyfacades/rectify.py
# def H(dleft, dright, dtop, dbottom, width, length):
#     return H_v(dleft, dright, width, length).dot(H_h(dtop, dbottom, width, length))


# Path: pyfacades/models/independant_12_layers/caffe_layers.py
import caffe
import numpy as np
import os
import random
import skimage.transform
from glob import glob
from pyfacades.rectify import H as homography

        self.width = 512
        self.batch_size = 1
        self.epochs = 0
        self.counter = 0
        self.source = 'output_stacks2'
        self.files = glob(os.path.join(self.source, '*.npy'))

    # noinspection PyMethodOverriding
    def setup(self, bottom, top):
        random.shuffle(self.files)

        print 'source:', self.source
        print 'number of files:', len(self.files)

    # noinspection PyMethodOverriding
    def reshape(self, bottom, top):
        # no "bottom"s for input layer
        if len(bottom) > 0:
            raise Exception('cannot have bottoms for input layer')

        # make sure you have the right number of "top"s
        assert len(top) == self.num_labels  # +1 for RGB,  -1 for the 'background' label.

        top[0].reshape(self.batch_size, self.num_channels, self.height, self.width)

        # Label 0 is background, we can / should safely ignore it!
        for i in range(1, self.num_labels):
            top[i].reshape(self.batch_size, 1, self.width, self.height)

    # noinspection PyUnusedLocal

    def forward(self, bottom, top):