Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GSRP TDOA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maxence Ferrari
GSRP TDOA
Commits
bcfc4e7f
Commit
bcfc4e7f
authored
2 years ago
by
ferrari
Browse files
Options
Downloads
Patches
Plain Diff
Updated README
sklearn is now optional
parent
b289d8ed
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+42
-23
42 additions, 23 deletions
README.md
gsrp_tdoa_hyperres.py
+4
-3
4 additions, 3 deletions
gsrp_tdoa_hyperres.py
with
46 additions
and
26 deletions
README.md
+
42
−
23
View file @
bcfc4e7f
...
@@ -8,17 +8,26 @@ the GSPR loss function with a second-order polynomial.
...
@@ -8,17 +8,26 @@ the GSPR loss function with a second-order polynomial.
Prerequisite
Prerequisite
------------
------------
This program uses the following libraries (other versions might work):
This program uses the following libraries (tested with the following version):
*
cython 0.29
*
numpy 1.21
*
scipy 1.7.1
*
soundfile 0.9
*
scikit-learn 1.0 (needed if you use the hyper resolution mode)
*
pandas 1.3 (needed only for saving in a non CSV format)
*
tqdm 4.62 (optional if you want a progress bar)
Usage
Usage
-----
-----
```
usage: gsrp_tdoa_hyperres.py [-h] [-c CHANNELS] [-i INVERSE] [-f FRAME_SIZE]
usage: gsrp_tdoa_hyperres.py [-h] [-c CHANNELS] [-i INVERSE] [-f FRAME_SIZE]
[-s HOP_SIZE] [-m MAX_TDOA] [-l LOW] [-u UP]
[-s STRIDE | -p STRIDE] [-m MAX_TDOA]
[-d DECIMATE] [-t] [-e] [--start SECONDS]
[-S SECONDS] [-E SECONDS] [-l LOW] [-u UP]
[--end SECONDS]
[-d DECIMATE] [-t] [-e] [-n] [-w]
[-M {prepare,on-the-fly,auto,smart}] [-q QUOTA]
[-v]
infile outfile
infile outfile
```
Arguments
Arguments
-----
-----
...
@@ -29,10 +38,9 @@ positional arguments:
...
@@ -29,10 +38,9 @@ positional arguments:
infile The sound file to process.
infile The sound file to process.
outfile The text or npy file to write results to. Each row
outfile The text or npy file to write results to. Each row
gives the position (in samples), cross-correlation
gives the position (in samples), cross-correlation
product, the independent TDOAs (in samples), and TDOAs
product in decibel (normalized and unormalized), the
derived from the independent ones. For plots, the
independent TDOAs (in samples), and TDOAs derived from
panes give the cross-correlation product, independent
the independent ones.
TDOAS and derived TDOAs from top to bottom.
optional arguments:
optional arguments:
-h, --help show this help message and exit
-h, --help show this help message and exit
...
@@ -51,11 +59,13 @@ Channels:
...
@@ -51,11 +59,13 @@ Channels:
Size settings:
Size settings:
-f FRAME_SIZE, --frame-size FRAME_SIZE
-f FRAME_SIZE, --frame-size FRAME_SIZE
The size of the cross-correlation frames in seconds
The size of the cross-correlation frames in seconds
(default: 0.2)
(default: 0.
0
2)
-s STRIDE, --stride STRIDE
-s STRIDE, --stride STRIDE
The step between the beginnings of sequential frames
The step between the beginnings of sequential frames
in seconds (default: 0.01), or the postion in second
in seconds (default: 0.01)
if csv file path is given.
-p STRIDE, --pos STRIDE
The position in second from csv file path. Not allowed
if stride is set
-m MAX_TDOA, --max-tdoa MAX_TDOA
-m MAX_TDOA, --max-tdoa MAX_TDOA
The maximum TDOA in seconds (default: 0.0011).
The maximum TDOA in seconds (default: 0.0011).
-S SECONDS, --start SECONDS
-S SECONDS, --start SECONDS
...
@@ -76,18 +86,27 @@ Other:
...
@@ -76,18 +86,27 @@ Other:
-e, --erase Erase existing outfile. If outfile exist and --erase
-e, --erase Erase existing outfile. If outfile exist and --erase
is not provide, the script will exit.
is not provide, the script will exit.
-n, --no-hyperres Disable the hyper resolution evalutation of the TDOA
-n, --no-hyperres Disable the hyper resolution evalutation of the TDOA
-M {smart,auto,on-the-fly,prepare}, --mode {smart,auto,on-the-fly,prepare}
-w, --wide Use only one level to concatenate the normal and
How to explore the TDOA space (default: prepare).
hyperres results. Behaviour depends on the output file
'prepare' precomputes all the possible TDOA
type.
-M {prepare,on-the-fly,auto,smart}, --mode {prepare,on-the-fly,auto,smart}
How to explore the TDOA space (default: smart).
prepare precomputes all the possible TDOA
pairs and then evaluate them. All the results are save
pairs and then evaluate them. All the results are save
in memory.
in memory.
'
on-the-fly
'
compute the TDOA pairs at the same
on-the-fly compute the TDOA pairs at the same
time as it compute the loss function. Only the maximum
time as it compute the loss function. Only the maximum
is saved. Can be slower than
'
prepare
'
.
is saved. Can be slower than prepare.
'
smart
'
gradually increase the search space
dimension, '
smart gradually increase the search space
reducing the number of tdoa to evaluate.
dimension,
reducing the number of tdoa to evaluate.
'
auto
'
automatically try to pick the right
auto automatically try to pick the right
method.
method.
-q QUOTA, --quota QUOTA
Process finished with exit code 0
Memory limit in bytes for the
{BColors.BOLD}smart{BColors.ENDC} method. If hit, halt
the computation of the current frame and skip to the
next one. Note that it does not account for other
memory usage, such as the sound data. Can be a unit
such as GB, GiO, Ko, ...
-v, --verbose Activate verbose for smart mode
```
```
This diff is collapsed.
Click to expand it.
gsrp_tdoa_hyperres.py
+
4
−
3
View file @
bcfc4e7f
...
@@ -8,9 +8,6 @@ import scipy.signal as sg
...
@@ -8,9 +8,6 @@ import scipy.signal as sg
import
soundfile
as
sf
import
soundfile
as
sf
from
numpy.fft
import
rfft
,
irfft
from
numpy.fft
import
rfft
,
irfft
from
scipy.signal.windows
import
tukey
from
scipy.signal.windows
import
tukey
from
sklearn.linear_model
import
LinearRegression
from
sklearn.pipeline
import
Pipeline
from
sklearn.preprocessing
import
PolynomialFeatures
from
gsrp_smart_util
import
*
from
gsrp_smart_util
import
*
...
@@ -104,6 +101,10 @@ def corr(data, pos, w_size, max_tdoa, decimate=1, mode='prepare', hyper=True, ve
...
@@ -104,6 +101,10 @@ def corr(data, pos, w_size, max_tdoa, decimate=1, mode='prepare', hyper=True, ve
tdoas
=
np
.
zeros
((
len
(
pos
),
num_channel_pairs
+
2
),
np
.
float32
)
tdoas
=
np
.
zeros
((
len
(
pos
),
num_channel_pairs
+
2
),
np
.
float32
)
if
hyper
:
# prepare hyper res
if
hyper
:
# prepare hyper res
from
sklearn.linear_model
import
LinearRegression
from
sklearn.pipeline
import
Pipeline
from
sklearn.preprocessing
import
PolynomialFeatures
tdoas2
=
np
.
zeros
((
len
(
pos
),
num_channel_pairs
+
2
),
np
.
float32
)
tdoas2
=
np
.
zeros
((
len
(
pos
),
num_channel_pairs
+
2
),
np
.
float32
)
poly
=
PolynomialFeatures
(
2
)
poly
=
PolynomialFeatures
(
2
)
lin
=
LinearRegression
()
lin
=
LinearRegression
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment