Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for near perfect correlation with pystoi #9

Merged
merged 8 commits into from
May 10, 2023

Conversation

philgzl
Copy link
Contributor

@philgzl philgzl commented Apr 20, 2023

This PR significantly improves correlations with pystoi at little performance cost. When use_vad=True, the correlation is near-perfect. The only reason it's not truly perfect is because of the different resampling technique. Changes are extensive and I am ready to discuss them with you.

This also fixes two warnings:

  • one raised by torch.stft in NegSTOILoss.stft because return_complex=False is deprecated
  • one raised by torchaudio.transforms.Resample in NegSTOILoss.__init__ because resampling_method=sinc_interpolation is deprecated and should now be sinc_interp_hann.

Correlations

Below are correlation plots obtained with this fix. These were obtained using mixtures I generated which I can provide if needed. As you can see when use_vad=True we obtain near-perfect correlation. I did not include these plots in this PR because I didn't know if the same mixtures should be used to recreate the plots.

For reference below is master according to README.md vs. this PR w/ VAD. Quite an improvement IMO.

Processing times

Below I compare processing times between master this PR. The evaluated function is a NegSTOILoss.forward pass followed by a loss.backward pass where the nn.Module is the TestNet in test_torchstoi.py. When use_vad=True, processing is a bit slower, but worth the accuracy improvement IMO. With use_vad=False, it seems it's actually slightly faster. These were obtained on a HP Elitebook G6 with an Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz. I had no free GPU at hand when testing so I couldn't try on GPU.

Copy link
Owner

@mpariente mpariente left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a great improvement, thank you very much !

Few things,

  • Can you try it on a GPU to make sure that it runs ?
  • Can you sum up the changes you had to make ?
  • And adress the minor comments I left ?

Thanks again, great work !

torch_stoi/stoi.py Show resolved Hide resolved
torch_stoi/stoi.py Outdated Show resolved Hide resolved
torch_stoi/stoi.py Outdated Show resolved Hide resolved
torch_stoi/stoi.py Outdated Show resolved Hide resolved
torch_stoi/stoi.py Outdated Show resolved Hide resolved
torch_stoi/stoi.py Show resolved Hide resolved
torch_stoi/stoi.py Show resolved Hide resolved
@mpariente
Copy link
Owner

Also, feel free to change the graphs in the README within the PR, it's worth it 👀

@philgzl
Copy link
Contributor Author

philgzl commented Apr 20, 2023

  • Can you try it on a GPU to make sure that it runs ?

Will do

  • Can you sum up the changes you had to make ?
  • I stick to the steps done in pystoi. Namely I moved the VAD before the STFT. The VAD segments the signal, calculates a mask, reorganizes the frames such that speech frames are all next to each other like in pystoi, and overlap-and-adds like in pystoi. I understand the previous implementation moved the VAD after the STFT to operate directly on STFT frames and be more efficient. While I didn't check how much this makes results differ, it does make them different.
  • I removed torch.stft. This does many things under the hood that differ from the STFT in pystoi. See my comments in the code.
  • I removed the masked operations meanvar_norm, masked_mean and masked_norm. That's because for the norm, applying the mask before calculating the norm is enough as zeros do not contribute. Similarly for the mean, we can sum everything and divide by the length of the mask at the end here.

This is inspired from mpariente/pystoi#28.

  • And adress the minor comments I left ?

Done

@mpariente
Copy link
Owner

I guess you didn't yet commit the changes, but it all sounds good.

@philgzl
Copy link
Contributor Author

philgzl commented Apr 21, 2023

No not yet, I am working on it. Turns out some fixes are required to run on CUDA. Will probably finish after the weekend.

@philgzl
Copy link
Contributor Author

philgzl commented Apr 24, 2023

Done.

  • I reverted resampling_method back to 'sinc_interpolation' because the warning is raised in PyTorch 2.0 only and sinc_interp_hann actually raises an error in older versions.
  • I updated the plots.
  • After fixing with CUDA I benchmarked again vs. master and it seems like processing time does take a toll with this new code. It can be up to x2~x3 longer with batch_size=8, probably even more as the batch size keeps increasing. So if efficiency is a major concern for torch_stoi then we should maybe reconsider this PR or find ways to make it more efficient. The benchmarked code is a loss forward pass followed by a TestNet backward pass.

Edit: pressed "Comment" before finishing my message

@mpariente
Copy link
Owner

Thanks again, the benchmark is on GPU or CPU ?

@philgzl
Copy link
Contributor Author

philgzl commented Apr 27, 2023

That last benchmark was on GPU, on a V100.

@mpariente
Copy link
Owner

What is the TestNet ? Can you show just forward results please ?

@mpariente
Copy link
Owner

Which part of the code adds the most time ?

@philgzl
Copy link
Contributor Author

philgzl commented Apr 27, 2023

The TestNet is the same as in tests/test_torchstoi.py, it's just a dummy Conv1dwith a kernel size of 1.

The benchmarking script can be found here. Namely the measured function is

def to_time():
    loss = criterion(x, y).mean()
    loss.backward(retain_graph=True)

where y = nnet(x) and x is a random input.

I can try and profile the code tomorrow and see what's taking the most time. I profiled on CPU and there it was the loss.backward call that was taking the longest. But I did not profile on GPU and more importantly did not compare with master to identify the reason for the increased time.

@philgzl
Copy link
Contributor Author

philgzl commented Apr 27, 2023

Also I ran this on a computing cluster and did not make sure both codes ran on the same host. I can try and fix that too tomorrow.

@philgzl
Copy link
Contributor Author

philgzl commented May 1, 2023

Okay I made sure to run it again on the same host and processing is indeed about ~x2 times longer. Below are full torch.utils.bottleneck outputs. Maybe you can help me interpret them. I only ran this for batch_size=8 and wav_length=4 and did 2500 repetitions. From what I understand the difference can be mainly attributed to the list comprehension in _mask_audio and a longer backward.

master:

`bottleneck` is a tool that can be used as an initial step for debugging
bottlenecks in your program.

It summarizes runs of your script with the Python profiler and PyTorch's
autograd profiler. Because your script will be profiled, please ensure that it
exits in a finite amount of time.

For more complicated uses of the profilers, please see
https://docs.python.org/3/library/profile.html and
https://pytorch.org/docs/master/autograd.html#profiler for more information.
Running environment analysis...
Running your script with cProfile
use_vad=True_extended=True
batch_size=8, wav_length=4
Running your script with the autograd profiler...
use_vad=True_extended=True
batch_size=8, wav_length=4
use_vad=True_extended=True
batch_size=8, wav_length=4
--------------------------------------------------------------------------------
  Environment Summary
--------------------------------------------------------------------------------
PyTorch 1.13.1+cu117 DEBUG compiled w/ CUDA 11.7
Running with Python 3.10 and 

`pip3 list` truncated output:
numpy==1.24.1
torch==1.13.1
torch-ema==0.3
torch-stoi==0.1.2
torchaudio==0.13.1
torchvision==0.14.1
--------------------------------------------------------------------------------
  cProfile output
--------------------------------------------------------------------------------
         1825385 function calls (1805369 primitive calls) in 12.885 seconds

   Ordered by: internal time
   List reduced from 3766 to 15 due to restriction <15>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     2500    2.261    0.001    2.261    0.001 {method 'run_backward' of 'torch._C._EngineBase' objects}
    10000    2.115    0.000    2.115    0.000 {method 'pow' of 'torch._C._TensorBase' objects}
        5    1.393    0.279    1.393    0.279 {method 'cuda' of 'torch._C._TensorBase' objects}
        1    1.073    1.073    1.073    1.073 {built-in method torch.conv1d}
    10000    0.573    0.000    0.573    0.000 {built-in method torch._C._nn.im2col}
    10000    0.571    0.000    1.890    0.000 /zhome/d6/0/134239/pytorch_stoi/torch_stoi/stoi.py:229(meanvar_norm)
    10000    0.476    0.000    0.814    0.000 /zhome/d6/0/134239/pytorch_stoi/torch_stoi/stoi.py:235(masked_mean)
     5000    0.402    0.000    0.402    0.000 {built-in method torch.matmul}
     2500    0.371    0.000    6.668    0.003 /zhome/d6/0/134239/pytorch_stoi/torch_stoi/stoi.py:89(forward)
    20000    0.338    0.000    0.338    0.000 {method 'sum' of 'torch._C._TensorBase' objects}
    15000    0.320    0.000    0.320    0.000 {built-in method torch.norm}
     5000    0.300    0.000    0.300    0.000 {built-in method torch.stft}
     2500    0.247    0.000    0.573    0.000 /zhome/d6/0/134239/pytorch_stoi/torch_stoi/stoi.py:181(detect_silent_frames)
      618    0.214    0.000    0.214    0.000 {built-in method io.open_code}
    10000    0.213    0.000    0.504    0.000 /zhome/d6/0/134239/pytorch_stoi/torch_stoi/stoi.py:243(masked_norm)


--------------------------------------------------------------------------------
  autograd profiler output (CPU mode)
--------------------------------------------------------------------------------
        top 15 events sorted by cpu_time_total

-------------------------------------------------------  ------------  ------------  ------------  ------------  ------------  ------------  
                                                   Name    Self CPU %      Self CPU   CPU total %     CPU total  CPU time avg    # of Calls  
-------------------------------------------------------  ------------  ------------  ------------  ------------  ------------  ------------  
                                            aten::randn         0.17%       8.000us        47.72%       2.277ms       2.277ms             1  
                                          aten::normal_        47.36%       2.260ms        47.36%       2.260ms       2.260ms             1  
autograd::engine::evaluate_function: FftR2CBackward0...         0.10%       5.000us        31.83%       1.519ms       1.519ms             1  
                                        FftR2CBackward0        10.23%     488.000us        31.73%       1.514ms       1.514ms             1  
                                               aten::to        20.22%     965.000us        28.14%       1.343ms       1.343ms             1  
autograd::engine::evaluate_function: FftR2CBackward0...         0.08%       4.000us        22.05%       1.052ms       1.052ms             1  
                                        FftR2CBackward0         0.21%      10.000us        21.96%       1.048ms       1.048ms             1  
     autograd::engine::evaluate_function: NormBackward1         0.08%       4.000us        21.94%       1.047ms       1.047ms             1  
autograd::engine::evaluate_function: FftR2CBackward0...         0.10%       5.000us        21.90%       1.045ms       1.045ms             1  
                                          NormBackward1         0.34%      16.000us        21.86%       1.043ms       1.043ms             1  
autograd::engine::evaluate_function: FftR2CBackward0...         0.08%       4.000us        21.84%       1.042ms       1.042ms             1  
autograd::engine::evaluate_function: FftR2CBackward0...         0.08%       4.000us        21.79%       1.040ms       1.040ms             1  
                                        FftR2CBackward0         0.21%      10.000us        21.79%       1.040ms       1.040ms             1  
      autograd::engine::evaluate_function: PowBackward0        20.52%     979.000us        21.77%       1.039ms       1.039ms             1  
                                        FftR2CBackward0         0.21%      10.000us        21.75%       1.038ms       1.038ms             1  
-------------------------------------------------------  ------------  ------------  ------------  ------------  ------------  ------------  
Self CPU time total: 4.772ms

--------------------------------------------------------------------------------
  autograd profiler output (CUDA mode)
--------------------------------------------------------------------------------
        top 15 events sorted by cpu_time_total

	Because the autograd profiler uses the CUDA event API,
	the CUDA time column reports approximately max(cuda_time, cpu_time).
	Please ignore this output if your code does not use CUDA.

-------------------------------------------------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  
                                                   Name    Self CPU %      Self CPU   CPU total %     CPU total  CPU time avg     Self CUDA   Self CUDA %    CUDA total  CUDA time avg    # of Calls  
-------------------------------------------------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  
                                           aten::im2col        15.49%       1.847ms        36.03%       4.296ms       4.296ms     175.000us         1.95%       4.203ms       4.203ms             1  
                                           aten::im2col         9.01%       1.074ms        16.54%       1.972ms       1.972ms     175.000us         1.95%       1.980ms       1.980ms             1  
                                             aten::stft         6.41%     764.000us        15.89%       1.895ms       1.895ms     598.000us         6.68%     807.000us     807.000us             1  
                                            aten::randn         0.27%      32.000us        15.68%       1.869ms       1.869ms      21.000us         0.23%       1.872ms       1.872ms             1  
                                          aten::normal_        15.38%       1.834ms        15.38%       1.834ms       1.834ms       1.843ms        20.59%       1.843ms       1.843ms             1  
autograd::engine::evaluate_function: ConvolutionBack...         0.10%      12.000us        12.90%       1.538ms       1.538ms       6.000us         0.07%       2.835ms       2.835ms             1  
                                   ConvolutionBackward0         0.08%       9.000us        12.80%       1.526ms       1.526ms       7.000us         0.08%       2.829ms       2.829ms             1  
                             aten::convolution_backward        11.96%       1.426ms        12.72%       1.517ms       1.517ms       2.750ms        30.72%       2.822ms       2.822ms             1  
autograd::engine::evaluate_function: TransposeBackwa...         0.16%      19.000us        11.90%       1.419ms       1.419ms      17.000us         0.19%       1.422ms       1.422ms             1  
                                           aten::matmul         0.60%      71.000us        11.86%       1.414ms       1.414ms      27.000us         0.30%       1.072ms       1.072ms             1  
                                     TransposeBackward0         0.08%       9.000us        11.74%       1.400ms       1.400ms      10.000us         0.11%       1.405ms       1.405ms             1  
                                           aten::im2col         9.51%       1.134ms        11.68%       1.393ms       1.393ms       1.090ms        12.18%       1.378ms       1.378ms             1  
                                        aten::transpose        11.66%       1.390ms        11.67%       1.391ms       1.391ms      13.000us         0.15%       1.395ms       1.395ms             1  
                                           aten::im2col         9.67%       1.153ms        11.60%       1.383ms       1.383ms       1.119ms        12.50%       1.312ms       1.312ms             1  
                                           aten::im2col         9.63%       1.148ms        11.59%       1.382ms       1.382ms       1.101ms        12.30%       1.332ms       1.332ms             1  
-------------------------------------------------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  
Self CPU time total: 11.922ms
Self CUDA time total: 8.952ms

this PR:

`bottleneck` is a tool that can be used as an initial step for debugging
bottlenecks in your program.

It summarizes runs of your script with the Python profiler and PyTorch's
autograd profiler. Because your script will be profiled, please ensure that it
exits in a finite amount of time.

For more complicated uses of the profilers, please see
https://docs.python.org/3/library/profile.html and
https://pytorch.org/docs/master/autograd.html#profiler for more information.
Running environment analysis...
Running your script with cProfile
use_vad=True_extended=True
batch_size=8, wav_length=4
Running your script with the autograd profiler...
use_vad=True_extended=True
batch_size=8, wav_length=4
use_vad=True_extended=True
batch_size=8, wav_length=4
--------------------------------------------------------------------------------
  Environment Summary
--------------------------------------------------------------------------------
PyTorch 1.13.1+cu117 DEBUG compiled w/ CUDA 11.7
Running with Python 3.10 and 

`pip3 list` truncated output:
numpy==1.24.1
torch==1.13.1
torch-ema==0.3
torch-stoi==0.1.2
torchaudio==0.13.1
torchvision==0.14.1
--------------------------------------------------------------------------------
  cProfile output
--------------------------------------------------------------------------------
         2405421 function calls (2385404 primitive calls) in 25.486 seconds

   Ordered by: internal time
   List reduced from 3790 to 15 due to restriction <15>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     5000    7.153    0.001    9.511    0.002 /zhome/d6/0/134239/pytorch_stoi/torch_stoi/stoi.py:328(<listcomp>)
     2500    6.762    0.003    6.762    0.003 {method 'run_backward' of 'torch._C._EngineBase' objects}
        5    1.404    0.281    1.404    0.281 {method 'cuda' of 'torch._C._TensorBase' objects}
    45000    1.076    0.000    1.076    0.000 {built-in method torch.nn.functional.pad}
        1    1.074    1.074    1.074    1.074 {built-in method torch.conv1d}
     5000    0.973    0.000    0.973    0.000 {method 'abs' of 'torch._C._TensorBase' objects}
    52500    0.874    0.000    0.874    0.000 {method 'sum' of 'torch._C._TensorBase' objects}
    15000    0.774    0.000    0.774    0.000 {built-in method torch._C._nn.im2col}
     2500    0.429    0.000   14.713    0.006 /zhome/d6/0/134239/pytorch_stoi/torch_stoi/stoi.py:89(forward)
    40000    0.424    0.000    0.424    0.000 {built-in method torch.rsub}
     2500    0.342    0.000   11.100    0.004 /zhome/d6/0/134239/pytorch_stoi/torch_stoi/stoi.py:226(remove_silent_frames)
     5000    0.331    0.000    0.638    0.000 /zhome/d6/0/134239/pytorch_stoi/torch_stoi/stoi.py:286(rowcol_norm)
     5000    0.229    0.000    0.229    0.000 {built-in method torch._C._fft.fft_rfft}
      619    0.212    0.000    0.212    0.000 {built-in method io.open_code}
     5000    0.187    0.000    0.719    0.000 /zhome/d6/0/134239/pytorch_stoi/torch_stoi/stoi.py:268(stft)


--------------------------------------------------------------------------------
  autograd profiler output (CPU mode)
--------------------------------------------------------------------------------
        top 15 events sorted by cpu_time_total

-------------------  ------------  ------------  ------------  ------------  ------------  ------------  
               Name    Self CPU %      Self CPU   CPU total %     CPU total  CPU time avg    # of Calls  
-------------------  ------------  ------------  ------------  ------------  ------------  ------------  
        aten::index         0.38%      27.000us        39.70%       2.797ms       2.797ms             1  
        aten::index         0.34%      24.000us        39.67%       2.795ms       2.795ms             1  
        aten::index         0.34%      24.000us        39.48%       2.782ms       2.782ms             1  
        aten::index        13.26%     934.000us        39.31%       2.770ms       2.770ms             1  
      aten::nonzero         0.45%      32.000us        39.21%       2.763ms       2.763ms             1  
      aten::nonzero         0.48%      34.000us        39.20%       2.762ms       2.762ms             1  
      aten::nonzero        13.24%     933.000us        39.03%       2.750ms       2.750ms             1  
        aten::index         7.85%     553.000us        34.35%       2.420ms       2.420ms             1  
        aten::randn         0.16%      11.000us        31.85%       2.244ms       2.244ms             1  
        aten::index         0.64%      45.000us        31.65%       2.230ms       2.230ms             1  
      aten::normal_        31.59%       2.226ms        31.59%       2.226ms       2.226ms             1  
        aten::index         0.43%      30.000us        30.87%       2.175ms       2.175ms             1  
      aten::nonzero         1.12%      79.000us        30.85%       2.174ms       2.174ms             1  
      aten::nonzero         0.68%      48.000us        30.32%       2.136ms       2.136ms             1  
    cudaMemcpyAsync        29.04%       2.046ms        29.04%       2.046ms       2.046ms             1  
-------------------  ------------  ------------  ------------  ------------  ------------  ------------  
Self CPU time total: 7.046ms

--------------------------------------------------------------------------------
  autograd profiler output (CUDA mode)
--------------------------------------------------------------------------------
        top 15 events sorted by cpu_time_total

	Because the autograd profiler uses the CUDA event API,
	the CUDA time column reports approximately max(cuda_time, cpu_time).
	Please ignore this output if your code does not use CUDA.

-------------------------------------------------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  
                                                   Name    Self CPU %      Self CPU   CPU total %     CPU total  CPU time avg     Self CUDA   Self CUDA %    CUDA total  CUDA time avg    # of Calls  
-------------------------------------------------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  
                                           aten::im2col        39.62%       4.221ms        41.38%       4.408ms       4.408ms       3.282ms        38.22%       3.390ms       3.390ms             1  
                                            aten::index         0.54%      57.000us        22.47%       2.394ms       2.394ms      48.000us         0.56%       1.092ms       1.092ms             1  
                                            aten::index         0.53%      56.000us        22.31%       2.377ms       2.377ms      48.000us         0.56%       1.089ms       1.089ms             1  
                                            aten::index         0.50%      53.000us        22.22%       2.367ms       2.367ms      44.000us         0.51%       1.084ms       1.084ms             1  
                                            aten::index         9.20%     980.000us        22.15%       2.360ms       2.360ms     972.000us        11.32%       1.102ms       1.102ms             1  
                                            aten::index         0.51%      54.000us        22.13%       2.357ms       2.357ms      47.000us         0.55%       1.092ms       1.092ms             1  
                                            aten::index         0.50%      53.000us        21.98%       2.341ms       2.341ms      44.000us         0.51%       1.089ms       1.089ms             1  
                                          aten::nonzero         0.60%      64.000us        21.72%       2.314ms       2.314ms      72.000us         0.84%       1.014ms       1.014ms             1  
    autograd::engine::evaluate_function: IndexBackward0         0.09%      10.000us        21.68%       2.310ms       2.310ms      11.000us         0.13%       2.314ms       2.314ms             1  
                                         IndexBackward0        11.10%       1.182ms        21.59%       2.300ms       2.300ms      54.000us         0.63%       2.303ms       2.303ms             1  
                                          aten::nonzero         9.11%     970.000us        21.57%       2.298ms       2.298ms     979.000us        11.40%       1.012ms       1.012ms             1  
                                          aten::nonzero         9.06%     965.000us        21.50%       2.290ms       2.290ms     976.000us        11.37%       1.011ms       1.011ms             1  
                                          aten::nonzero         9.08%     967.000us        21.41%       2.281ms       2.281ms     982.000us        11.44%       1.017ms       1.017ms             1  
                                          aten::nonzero         9.05%     964.000us        21.24%       2.263ms       2.263ms     981.000us        11.42%       1.014ms       1.014ms             1  
                                            aten::index         0.54%      57.000us        21.21%       2.259ms       2.259ms      47.000us         0.55%       1.086ms       1.086ms             1  
-------------------------------------------------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  ------------  
Self CPU time total: 10.653ms
Self CUDA time total: 8.587ms

Comment on lines +328 to +330
return torch.stack([
pad(xi[mi], (0, 0, 0, len(xi) - mi.sum())) for xi, mi in zip(x, mask)
])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the list comprehension which takes the most time, and it makes sense that it does.

@mpariente
Copy link
Owner

Thanks for running the profiler !

I think a x2 in computation time still worth the improvement, specially that it will be negligible when compared to the NN's training time.

@mpariente
Copy link
Owner

I merged this PR in pystoi, can you update the code here to reflect the changes in the pystoi repo ?

@philgzl
Copy link
Contributor Author

philgzl commented May 1, 2023

I think a x2 in computation time still worth the improvement, specially that it will be negligible when compared to the NN's training time.

I also think it's worth the improvement. The time increase also happens inside backward though, so it might scale with the network size.

I merged this PR in pystoi, can you update the code here to reflect the changes in the pystoi repo ?

Sure. I will also try and think of a way to avoid this list comprehension.

@mpariente
Copy link
Owner

The time increase also happens inside backward though, so it might scale with the network size.

I don't think so. Backward through the loss is the first operation of the overall backward, the backward time of the whole architecture is independent of the loss, you just need the gradients as input.

@philgzl
Copy link
Contributor Author

philgzl commented May 8, 2023

Latest commit now reflects mpariente/pystoi#33. I made new correlation plots and checked it is still strong. I can commit them if you want.

Dunno if we should mention the correlation is against the latest commit in pystoi, since no new pystoi version was released after mpariente/pystoi#33. The correlation against current pystoi version i.e. pre-mpariente/pystoi#33 would not be as strong.

@mpariente
Copy link
Owner

Dunno if we should mention the correlation is against the latest commit in pystoi

Sure, add a commit tag somewhere in a comment.

The correlation against current pystoi version i.e. pre-mpariente/pystoi#33 would not be as strong.

Do you think the difference is that big ?

@mpariente
Copy link
Owner

Could you make a correlation plot between the former and new version of pySTOI please ?

@philgzl
Copy link
Contributor Author

philgzl commented May 10, 2023

Okay the difference is very small so I guess it's fine.

Correlation vs. new pystoi (should be 100% with VAD if it wasn't for the different resampling technique):

Correlation vs. old pystoi (i.e. pystoi now discards 1 or 2 frames at the end):

@mpariente
Copy link
Owner

Thanks ! It's roughly the same, right ?

@philgzl
Copy link
Contributor Author

philgzl commented May 10, 2023

Yes, I can't see the difference unless I superimpose the plots and keep Alt-Tabbing

@mpariente
Copy link
Owner

So please add a comment in the code, and the Readme, and we'll merge this.

@philgzl
Copy link
Contributor Author

philgzl commented May 10, 2023

Done. Also updated the docstring to sound less dissuasive about using this vs. pystoi, while still emphasizing on the difference. Maybe you can have a look.

@mpariente mpariente merged commit eb58aae into mpariente:master May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants