How to use the csbdeep.internals.predict.tile_overlap function in csbdeep

To help you get started, we’ve selected a few csbdeep examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CSBDeep / CSBDeep / tests / test_models.py View on Github external
def test_tile_overlap(n_depth, kern_size, pool_size):
    K.clear_session()
    img_size = 1280 if pool_size > 1 else 160
    rf_x, rf_y = receptive_field_unet(n_depth,kern_size,pool_size,n_dim=2,img_size=img_size)
    assert rf_x == rf_y
    rf = rf_x
    assert np.abs(rf[0]-rf[1]) < 10
    assert sum(rf)+1 < img_size
    assert max(rf) == tile_overlap(n_depth,kern_size,pool_size)
    # print("receptive field of n_depth %d and kernel size %d: %s"%(n_depth,kern_size,rf));
github CSBDeep / CSBDeep / csbdeep / models / care_standard.py View on Github external
def _axes_tile_overlap(self, query_axes):
        query_axes = axes_check_and_normalize(query_axes)
        overlap = tile_overlap(self.config.unet_n_depth, self.config.unet_kern_size)
        return tuple((overlap if a in 'XYZT' else 0) for a in query_axes)
github juglab / n2v / n2v / models / n2v_standard.py View on Github external
mean_val1 = [] 
        for ele in self.config.means:
            mean_val.append(float(ele))
            mean_val1.append(float(ele))
        std_val = [] 
        std_val1 = [] 
        for ele in self.config.stds:
            std_val.append(float(ele))
            std_val1.append(float(ele))
        in_data_range_val = ['-inf', 'inf']
        out_data_range_val = ['-inf', 'inf']
            
        axes_val = 'b' + self.config.axes
        axes_val = axes_val.lower()
        val = 2**self.config.unet_n_depth
        val1 = predict.tile_overlap(self.config.unet_n_depth, self.config.unet_kern_size)
        min_val = [1, val, val, self.config.n_channel_in ]
        step_val = [1, val, val, 0]
        halo_val = [0, val1, val1, 0]
        scale_val = [1, 1, 1, 1]
        offset_val = [0, 0, 0, 0]
        
        yaml = YAML(typ='rt')
        with open(self.logdir/'config.json','r') as f:
            tr_kwargs_val = yaml.load(f)
        
        if (self.config.n_dim == 3):
            min_val = [1, val, val, val, self.config.n_channel_in ]
            step_val = [1, val, val, val, 0]
            halo_val = [0, val1, val1, val1, 0]
            scale_val = [1, 1, 1, 1, 1]
            offset_val = [0, 0, 0, 0, 0]
github CSBDeep / CSBDeep / csbdeep / models / care_projection.py View on Github external
def _axes_tile_overlap(self, query_axes):
        query_axes = axes_check_and_normalize(query_axes)
        proj = self.proj_params
        unet_overlap = tile_overlap(self.config.unet_n_depth, self.config.unet_kern_size)
        overlap = {
            a : max(tile_overlap(proj.n_depth, a_proj_kern, a_proj_pool), unet_overlap) # approx
            for a,a_proj_pool,a_proj_kern in zip(self.config.axes.replace('C',''),proj.pool,proj.kern)
            if a != proj.axis
        }
        return tuple(overlap.get(a,0) for a in query_axes)
github CSBDeep / CSBDeep / csbdeep / models / care_projection.py View on Github external
def _axes_tile_overlap(self, query_axes):
        query_axes = axes_check_and_normalize(query_axes)
        proj = self.proj_params
        unet_overlap = tile_overlap(self.config.unet_n_depth, self.config.unet_kern_size)
        overlap = {
            a : max(tile_overlap(proj.n_depth, a_proj_kern, a_proj_pool), unet_overlap) # approx
            for a,a_proj_pool,a_proj_kern in zip(self.config.axes.replace('C',''),proj.pool,proj.kern)
            if a != proj.axis
        }
        return tuple(overlap.get(a,0) for a in query_axes)