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

Batch Processing #38

Open
farhana-shahid opened this issue May 24, 2020 · 6 comments
Open

Batch Processing #38

farhana-shahid opened this issue May 24, 2020 · 6 comments

Comments

@farhana-shahid
Copy link

The batch_process method appears to behave arbitrarily. I have hundreds of audio recordings (avg duration: 45s). The batch_process method hangs arbitrarily after processing 3/10+/30+ audio files. Even when I passed single audio files in the input_files list, it paused arbitrarily without producing the output csv file of the last audio even though the method printed its ok message. What might go wrong here? I have tensorflow-gpu support in my pc. So, there should not be any problem in this regard!

@DavidDoukhan
Copy link
Member

Dear @farhana-shahid ,
Thanks for your interest in this program.
For now, i did not noticed any arbitrary behavior with the batch_process method.
Could you provide me more details on the context in which these problems occur ?

  • Could you provide me the exact code example where this problem occur using a single audio file in the input_files list ? The output of the program would also be usefull.
  • Do this behavior also occur using the wav and mp3 examples found in https://github.com/ina-foss/inaSpeechSegmenter/tree/master/media ?
  • could you run the unit tests and tell me if some of these tests fail ? For doing this, you can run program run_tests.py at the root of the repository.

Lastly, I woud need some more details on your host configuration:

  • operating system
  • cpu
  • ram
  • gpu (output of nvidia-smi)
  • python version
  • inaspeechsegmenter version
  • tensorflow version
  • any other relevant information

Kind regards,

@farhana-shahid
Copy link
Author

farhana-shahid commented May 24, 2020

Dear @DavidDoukhan ,

Thank you for your quick response. At first, I tried using cmd. I passed my audio directory as regex for -i.
ina_speech_segmenter.py -i "F:\R1\Data\SS FM/females/*.wav" -o F:\R1\Code\Gender\ina\data -d sm -g true
After producing a few (5~10+) csv files the program just hangs in there.

So, I opened ina_speech_segmenter.py in Jupyter notebook and wanted to see what's going wrong. I initialized the arguments in the code to run without cmd inputs.

import argparse
import glob
import os
import distutils.util
import warnings

warnings.filterwarnings("ignore")
input_path='F:\R1\Data\SS FM/females'
inputs = os.listdir(input_path)
input_files = [os.path.join(input_path, e) for e in inputs]

odir = 'F:\R1\Code\Gender\ina\data'
odir=odir.strip(" \t\n\r").rstrip('/')

# Do processings
from inaSpeechSegmenter import Segmenter, seg2csv

# load neural network into memory, may last few seconds
gender = bool(distutils.util.strtobool('true'))
seg = Segmenter(vad_engine ='sm', detect_gender = gender, ffmpeg='ffmpeg')

with warnings.catch_warnings():
    base = [os.path.splitext(os.path.basename(e))[0] for e in input_files]
    output_files = [os.path.join(odir, e + '.csv') for e in base]
    seg.batch_process(input_files, output_files, verbose=True)

This time the program stuck after processing 8 files! The program is still running but producing no output message or processing any audio files! And no csv for the f105 though it printed ok.

batch_processing 281 files
1/281 [('F:\R1\Code\Gender\ina\data\f1.csv', 0, 'ok')]
2/281 [('F:\R1\Code\Gender\ina\data\f10.csv', 0, 'ok')]
3/281 [('F:\R1\Code\Gender\ina\data\f100.csv', 0, 'ok')]
4/281 [('F:\R1\Code\Gender\ina\data\f101.csv', 0, 'ok')]
5/281 [('F:\R1\Code\Gender\ina\data\f102.csv', 0, 'ok')]
6/281 [('F:\R1\Code\Gender\ina\data\f103.csv', 0, 'ok')]
7/281 [('F:\R1\Code\Gender\ina\data\f104.csv', 0, 'ok')]
8/281 [('F:\R1\Code\Gender\ina\data\f105.csv', 0, 'ok')]

I thought maybe I should not call batch_process method with too many audio files in input_files list. So, I had added another external loop to pass a single audio file to batch_process method using the input_files list . But that also stucks after processing a few files! I made these changes:

with warnings.catch_warnings():
    for file in input_files:
        base = [os.path.splitext(os.path.basename(file))[0]]
        output_files = [os.path.join(odir, e + '.csv') for e in base]
        seg.batch_process([file], output_files, verbose=True)

Now it called batch_process method with two single wav files and stuck in there! No csv for f10 though there is ok msg!

batch_processing 1 files
1/1 [('F:\R1\Code\Gender\ina\data\f1.csv', 0, 'ok')]
batch_processing 1 files
1/1 [('F:\R1\Code\Gender\ina\data\f10.csv', 0, 'ok')]

The program worked fine with the wav example in the media folder. But the mp3 example got stuck. Though it printed ok massage, there was no 0021.csv! I tried after some time. Then it worked fine with the mp3 file.

Configuration:
OS: Windows10
CPU: Intel(R) Core(TM) i5-8265U CPU @1.60GHz 1.80 GHz
RAM: 8GB
Python version: 3.7.4 (anaconda), 3.8.3 (pc)
Tensorflow version: 2.1.0
inaSpeechSegmenter version: 0.6.2
GPU:
image

I hope this helps. Please let me know in case any other information is required.

Regards.

@DavidDoukhan
Copy link
Member

Dear @farhana-shahid ,

Thanks for this report.

I need one more information: which ffmpeg version are you using ?

In order to help you efficiently, I would really need the output of the unit tests of the program.
Could you run the program run_tests.py located at the root of the repository and provide me the output? An alternative way to launch this program would be to do python setup.py test at the root of the repository once the program is installed.

Lastly, In case your doing tests in a notebook with the content of ina_speech_segmenter.py, could you remove the line "with warnings.catch_warnings():".
These warnings may contain usefull informations for identifying the causes of your problem.

Kind regards,

@farhana-shahid
Copy link
Author

Hello @DavidDoukhan ,

I am using ffmpeg version 1.4

Here, is the output of run_tests.py program

image

As per your suggestion, I have removed the line with warnings.catch_warnings(): from notebook. Amazingly now it has worked fine and correctly produced outputs for all my audio files in the directory! There was no warning message. I wonder how this line would have influenced the program outcome! There is no reason after all.

@DavidDoukhan
Copy link
Member

Dear @farhana-shahid ,
I will need some time to fix this issue. I still did not manage to reproduce it (I'm not used to windows and it seems this bug is windows related).

Meanwhile, my recommendation is to use older versions of inaspeechsegmenter.
You could either:

  • git checkout 84d16f3 within git repository and reinstall the software corresponding to this version
  • pip install inaspeechsegmenter==0.5.1 that will download an older version on pypi

In these versions, the batch_process method was not introduced, but the script inaspeechsegmenter.py should do the job.

Kind regards,

@farhana-shahid
Copy link
Author

Thank you for all the kind support.

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

No branches or pull requests

2 participants