Ejemplo n.º 1
0
 def set_debug_info(self, pca_weights, patch_sz, debug_path, prefix):
     make_dir(debug_path)
     self.__pca_weights = pca_weights
     self.__patch_sz = patch_sz
     self.__debug_path = debug_path
     self.__prefix = '' if prefix == None else prefix
     self.output_debug = True
Ejemplo n.º 2
0
 def set_debug_info(self, pca_weights, patch_sz, debug_path, prefix):
     make_dir(join(debug_path, 'filters'))
     make_dir(join(debug_path, 'histograms'))
     self.__pca_weights = pca_weights
     self.__patch_sz = patch_sz
     self.__debug_path = debug_path
     self.__prefix = '' if prefix == None else prefix
     self.output_debug = True
Ejemplo n.º 3
0
    def export(self, path):
        """
        Export parameters shared variables to npy files.  Files are named
        according of the "name" argument of the shared variable

        Parameters
        ----------
        path:       string
                    path for which to export parameter files
        """
        make_dir(path)
        for param in self.__params.values():
            fn = os.path.join(path, "{}.npy".format(str(param)))
            np.save(fn, param.get_value(borrow=True))
Ejemplo n.º 4
0
    def debug_call(self):

        if self.output_debug:
            # For readability
            W = self.__params.encoder_weights.get_value()
            pca = self.__pca_weights
            patch_sz = self.__patch_sz
            debug_path = self.__debug_path
            prefix = self.__prefix

            make_dir(debug_path)
            filterstoimg(np.dot(pca, W),
                         patch_sz,
                         fn=join(
                             debug_path, '{}{}_encoder_weights.tif'.format(
                                 prefix, self.layer_id)))
Ejemplo n.º 5
0
 def export(self, path):
     make_dir(path)
     for param in self.encoder_params:
         fn = os.path.join(path, "{}.npy".format(str(param)))
         np.save(fn, param.get_value(borrow=True))
Ejemplo n.º 6
0
 def _set_debug_info(self, patch_sz, debug_path):
     make_dir(debug_path)
     self.debug_enabled = True
     self.patch_sz = patch_sz
     self.debug_path = debug_path
Ejemplo n.º 7
0
 def _set_debug_info(self, pca_weights, patch_sz, debug_path):
     make_dir(debug_path)
     self.pca_weights = pca_weights
     self.debug = True
     self.patch_sz = patch_sz
     self.debug_path = debug_path