5ed0c81c75f9360c11c60ed5b4bb367375ebb2bb,art/defences/preprocessor/jpeg_compression.py,JpegCompression,__call__,#JpegCompression#Any#Any#,124

Before Change



        // Prepare grayscale images for "L" mode
        if image_mode == "L":
            x = np.squeeze(x, axis=-1)

        // Compress one image at a time
        x_jpeg = x.copy()
        for idx in tqdm(np.ndindex(x.shape[:2]), desc="JPEG compression", disable=not self.verbose):

After Change


            if x.shape[-1] == 3:
                x_jpeg[idx] = self._compress(x[idx], mode="RGB")
            else:
                for i_channel in range(x.shape[-1]):
                    x_channel = x[idx[0], idx[1], ..., i_channel]
                    x_channel = self._compress(x_channel, mode="L")
                    x_jpeg[idx[0], idx[1], :, :, i_channel] = x_channel

        // Convert to ART dtype
        if self.clip_values[1] == 1.0:
            x_jpeg = x_jpeg / 255.0
        x_jpeg = x_jpeg.astype(ART_NUMPY_DTYPE)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 5ed0c81c75f9360c11c60ed5b4bb367375ebb2bb
Time: 2020-10-30
Author: beat.buesser@ie.ibm.com
File Name: art/defences/preprocessor/jpeg_compression.py
Class Name: JpegCompression
Method Name: __call__


Project Name: geometalab/OSMDeepOD
Commit Name: 285dc85691241532cd976e04a089f409e44d7493
Time: 2016-08-12
Author: samuel.kurath@gmail.com
File Name: src/detection/tensor/detector.py
Class Name: Detector
Method Name: detect_multiple


Project Name: asyml/texar
Commit Name: 635b126a3a166b30e6ea5e65e131539f701031fc
Time: 2018-11-14
Author: haoranshi97@gmail.com
File Name: texar/modules/encoders/transformer_encoders.py
Class Name: TransformerEncoder
Method Name: _build


Project Name: cornellius-gp/gpytorch
Commit Name: 0ec12f6fccb07305de1fd75527f5c156dab3c772
Time: 2020-12-16
Author: gpleiss@gmail.com
File Name: gpytorch/kernels/spectral_mixture_kernel.py
Class Name: SpectralMixtureKernel
Method Name: forward