-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
WIP: A new steps/data/reverberate_data_dir.py script #706
Conversation
|
||
def GetArgs(): | ||
# we add compulsary arguments as named arguments for readability | ||
parser = argparse.ArgumentParser(description="Generate corrupted data" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Reverberate the data directory with an option to add isotropic and point source noises"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the help message say that this script only deals with single channel wave files. If multi-channel noise/rir/speech files are provided one of the channels will be randomly picked.
# The noise list would have the following format: | ||
# --noise-id <string,compulsary> --noise-type <choices = (isotropic, point source),compulsary> --bg-fg-type <choices=(background|foreground), default=background> --rir-file <str, compulsary if isotropic, should not be specified if point-source> < location=(support Kaldi IO strings) > | ||
def CorruptWav(wav_scp, durations, output_dir, room_list, noise_list, snr_string, num_replica, prefix, speech_rvb_probability, noise_adding_probability, max_noises_added): | ||
rooms = list_cyclic_iterator(room_list, random_seed = 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let the user specify the random seed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vijay, I'm not sure if Python, like Perl, sets the random seed from the
current time, but if so we should probably by default set the seed to a
constant in any Python program that uses random numbers, for
reproducibility. We already do this in perl scripts that use random
numbers.
Dan
On Wed, Apr 20, 2016 at 12:17 PM, Vijayaditya Peddinti <
notifications@github.com> wrote:
In egs/wsj/s5/steps/data/reverberate_data_dir.py
#706 (comment):
- for line in open(file, 'r'):
parts = line.split()
if assert2fields:
assert(len(parts) == 2)
dict[parts[0]] = value_processor(parts[1:])
- return dict
+# This is the major function to generate pipeline command for the corruption
+# The rir list would have the following format:
+# --rir-id <string,compulsary> --room-id <string,compulsary> --receiver-position-id <string,optional> --source-position-id <string,optional> --rt-60 < <float,optional> --drr <float, optional> < location(support Kaldi IO strings) >
+# The noise list would have the following format:
+# --noise-id <string,compulsary> --noise-type <choices = (isotropic, point source),compulsary> --bg-fg-type <choices=(background|foreground), default=background> --rir-file <str, compulsary if isotropic, should not be specified if point-source> < location=(support Kaldi IO strings) >
+def CorruptWav(wav_scp, durations, output_dir, room_list, noise_list, snr_string, num_replica, prefix, speech_rvb_probability, noise_adding_probability, max_noises_added):
- rooms = list_cyclic_iterator(room_list, random_seed = 1)
let the user specify the random seed
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
https://github.com/kaldi-asr/kaldi/pull/706/files/356fa8258d848e3b092c5b894f6a7b4cab63b29c#r60470528
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been using a consistent default value in the python scripts I wrote, but I haven't done a check of all the scripts. I will create an issue requesting for a review of existing python scripts. We would also have to take care of the inline python scripts.
It seems to depend on the OS.
random.seed([x])
Initialize the basic random number generator. Optional argument x can be any hashable object. If x is omitted or None, current system time is used; current system time is also used to initialize the generator when the module is first imported. If randomness sources are provided by the operating system, they are used instead of the system time (see the os.urandom() function for details on availability). Reference
…specified random seed; always handle isotropic noise as background noise
In the current commit, background noise is always extended to the length of speech and added at the start of the speech; foreground noise is always not extended and added at the random point of the speech. For more detailed noise adding mechanism i guess we have to add more fields to the noise information list so that user can have a better control to the noise addition. |
if os.path.isfile(input_dir + "/reco2file_and_channel"): | ||
ReplicateFileType2(input_dir + "/reco2file_and_channel", output_dir + "/reco2file_and_channel", num_replica, prefix) | ||
AddPrefixToFields(input_dir + "/reco2file_and_channel", output_dir + "/reco2file_and_channel", num_replica, prefix, field = [0,1]) | ||
|
||
train_lib.RunKaldiCommand("utils/validate_data_dir.sh --no-feats {output_dir}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add --no-text in case there is no text.
@vijayaditya, what the status of this pull request? Is it OK as far as you're concerned? |
@tomkocse Could you please update one of the recipes which uses data reverberation to use this new script. I think ASpIRE is the only recipe in master branch which uses reverberation, so you can update that. (For now prepare a basic RIR list and noise list using the information available in |
@vijayaditya Do you mean making the rir_list and noise_list for the real RIR and noises in the Aspire recipe ? |
Yes. Vijay On Jul 22, 2016 8:57 PM, "tomkocse" notifications@github.com wrote:
|
@vijayaditya Can you point to me the location of your recent rerun of the aspire experiment ? That helps me for no need to repeat most of the procedures |
@vijayaditya I have finished modifying the aspire recipe to use the new steps/data/reverberate_data_dir.py . I am verifying if I can repeat your result. |
You need not worry about the replication of results right now as we do not Please test the following
--Vijay On Mon, Jul 25, 2016 at 6:40 AM, tomkocse notifications@github.com wrote:
|
…ng bugs in reverberate_data_dir.py; add aspire_prep_rir_noise_list.py for generating rir_list and noise_list for aspire
return args | ||
|
||
|
||
# This function generate the rir_list file for the aspire real RIR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function generates the rir_list file for the real RIRs being used in ASpIRE experiments. It assumes the availability of data/impulses_noises directory prepared by local/multi_condition/prepare_impulses_noises.sh.
I agree that your file pattern based pairing might be working. I am suggesting an easier way to generate these pairings as this info is already present in the data/impulses_noises/info file. I see a problem in the handling of isotropic noises. Sorry I should noticed this sooner. Isotropic noises are assigned to a room and not an RIR (i.e., room and microphone position). This makes sense as the characteristics of the noise are supposed to be similar in all directions. @sw005320 Could you please confirm if the isotropic noise recordings available in RWCP and REVERB-2014 RIR databases can be used with any RIR recorded in the same room. --Vijay |
Yes, RWCP has the isotropic noise recordings. |
@sw005320 Thanks ! |
@tomkocse Is it possible to prioritize this PR ? Could we try to get this PR in shape by tomorrow ? |
@vijay I will change the rir linkage of the iso noise to room linkage |
…r; Support using string as room id
for rir in rir_files: | ||
filename = rir.split('/')[-1] | ||
if "noise" not in filename: | ||
rir_list_file.write('--rir-id {0} --room-id {1} {2}\n'.format(str(rir_id).zfill(5), str(room_id).zfill(3), rir)) | ||
parts = filename.split('_') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than parsing the file name for the necessary parameters, @tomkocse will later submit a modified list generation function which will use information available in data/impulses_noises/info/
. This is however not a high priority change as we will preprocess the individual databases in the future and these scripts would not be part of any recipe.
There are minor changes necessary in this PR, however these are not high priority. @tomkocse Would continue work on those changes in a different PR. I would like to merge these scripts now as this a high priority requirement for some of the experiments we are working on. These scripts are isolated from the rest of the code base and are not used in any checked-in recipe other than ASpIRE. @danpovey , @jtrmal could you please perform a second review and perform the merge once @tomkocse resolves the conflicts. |
update function names; split snrs to background and foreground; user specified random seed; always handle isotropic noise as background noise Pick the RIRs and noises according to assigned probabilities. Modify wav-reverberate.cc according to the new steps/data/reverberate_data_dir.py Change the functions in signal.cc to extend the length of the convolved signal, the correct length should be original signal length + rir length - 1; add the shift option to wav-reverberate.cc Adding more comments and remove duplicate function in reverberate_data_dir.py Change option --max-noises-added to --max-noises-per-minute Adding data_lib.py; adding more comments, splitting large function in reverberate_data_dir.py adding AddPointSourceNoise() Fixing spelling mistake and modifying comments Modify the aspire recipe to use the new reverberate_data_dir.py; fixing bugs in reverberate_data_dir.py; add aspire_prep_rir_noise_list.py for generating rir_list and noise_list for aspire Changing isotropic noise linkage to a room instead of a particular rir; Support using string as room id Change comments in wav-reverberate.cc
Please go to #927 for the continuation of this PR |
No description provided.