b895d74347d7749b02d8ea57b5f5d71101297a34,functions/BlockStatistics.py,BlockStatistics,updatePixels,#BlockStatistics#,85

Before Change


        p = pixelBlocks["raster_pixels"]

        if self.measure is None:
            b = resize(p, shape, order=0, preserve_range=True)
        else:
            blockSizes = tuple(np.divide(p.shape, shape))
            b = measure.block_reduce(p, blockSizes, self.measure)

After Change


    def updatePixels(self, tlc, shape, props, **pixelBlocks):
        if self.func is None:
            b = resize(pixelBlocks["raster_pixels"], shape, order=0, preserve_range=True)
            m = resize(pixelBlocks["raster_mask"], shape, order=0, preserve_range=True)
        else:
            p = pixelBlocks["raster_pixels"]
            blockSizes = tuple(np.divide(p.shape, shape))

            q = np.ma.masked_array(view_as_blocks(p, blockSizes), 
                                   view_as_blocks(~pixelBlocks["raster_mask"].astype("b1"), blockSizes))
            for i in range(len(q.shape) // 2):
                q = self.func(q, axis=-1)
            b = q.data
            m = ~q.mask

        pixelBlocks["output_pixels"] = b.astype(props["pixelType"], copy=False)
        pixelBlocks["output_mask"] = m.astype("u1", copy=False)
        return pixelBlocks


Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: Esri/raster-functions
Commit Name: b895d74347d7749b02d8ea57b5f5d71101297a34
Time: 2015-10-18
Author: akferoz@esri.com
File Name: functions/BlockStatistics.py
Class Name: BlockStatistics
Method Name: updatePixels


Project Name: Esri/raster-functions
Commit Name: 4275899f8bc179d071051c06fa36ac441ddc3673
Time: 2015-10-18
Author: akferoz@esri.com
File Name: functions/BlockStatistics.py
Class Name: BlockStatistics
Method Name: updatePixels


Project Name: utkuozbulak/pytorch-cnn-visualizations
Commit Name: 818b177b0d10394c1fd1c75465ff55aabadb221b
Time: 2018-12-30
Author: utku.ozbulak@gmail.com
File Name: src/gradcam.py
Class Name: GradCam
Method Name: generate_cam