e30b50ff849a417b8e70d121edd2e85f0565eee1,data/data_loader.py,NoiseInjection,inject_noise_sample,#NoiseInjection#Any#Any#Any#,59

Before Change


        noise_src = load_audio(noise_path)
        noise_offset_fraction = np.random.rand()
        noise_dst = np.zeros_like(data)
        src_offset = int(len(noise_src) * noise_offset_fraction)
        src_left = len(noise_src) - src_offset
        dst_offset = 0
        dst_left = len(data)
        while dst_left > 0:

After Change


    def inject_noise_sample(self, data, noise_path, noise_level):
        noise_len = get_audio_length(noise_path)
        data_len = len(data) / self.sample_rate
        noise_start = np.random.rand() * (noise_len - data_len)
        noise_end = noise_start + data_len
        noise_dst = audio_with_sox(noise_path, self.sample_rate, noise_start, noise_end)
        assert len(data) == len(noise_dst)
        noise_energy = np.sqrt(noise_dst.dot(noise_dst)/noise_dst.size)
        data_energy = np.sqrt(data.dot(data)/data.size)
        data += noise_level * noise_dst * data_energy / noise_energy
        return data
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: SeanNaren/deepspeech.pytorch
Commit Name: e30b50ff849a417b8e70d121edd2e85f0565eee1
Time: 2017-09-13
Author: jinserk.baik@gmail.com
File Name: data/data_loader.py
Class Name: NoiseInjection
Method Name: inject_noise_sample


Project Name: scipy/scipy
Commit Name: bb537f5dd71b45f3fd23162d30073b87e91deeb6
Time: 2016-09-01
Author: perimosocordiae@gmail.com
File Name: scipy/spatial/distance.py
Class Name:
Method Name: squareform


Project Name: chainer/chainercv
Commit Name: fe9b27b4e279a45a4aa16c3b289c4e600384b4da
Time: 2017-09-29
Author: yuyuniitani@gmail.com
File Name: tests/transforms_tests/image_tests/test_random_sized_crop.py
Class Name: TestRandomSizedCrop
Method Name: test_random_sized_crop