Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Torchaudio
Commits
b00bacf7
Unverified
Commit
b00bacf7
authored
Sep 15, 2021
by
nateanl
Committed by
GitHub
Sep 15, 2021
Browse files
Add normalization to steering vector solutions in MVDR Module (#1765)
parent
ddb04e7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
examples/beamforming/mvdr.py
examples/beamforming/mvdr.py
+4
-3
No files found.
examples/beamforming/mvdr.py
View file @
b00bacf7
...
...
@@ -272,7 +272,9 @@ class MVDR(torch.nn.Module):
numerator
=
torch
.
linalg
.
solve
(
psd_n
,
stv
).
squeeze
(
-
1
)
# (..., freq, channel)
# denominator = stv^H @ psd_n.inv() @ stv
denominator
=
torch
.
einsum
(
"...d,...d->..."
,
[
stv
.
conj
().
squeeze
(
-
1
),
numerator
])
beamform_vector
=
numerator
/
(
denominator
.
real
.
unsqueeze
(
-
1
)
+
eps
)
# normalzie the numerator
scale
=
stv
.
squeeze
(
-
1
)[...,
self
.
ref_channel
,
None
].
conj
()
beamform_vector
=
numerator
*
scale
/
(
denominator
.
real
.
unsqueeze
(
-
1
)
+
eps
)
return
beamform_vector
...
...
@@ -315,8 +317,7 @@ class MVDR(torch.nn.Module):
phi
=
torch
.
linalg
.
solve
(
psd_n
,
psd_s
)
# psd_n.inv() @ psd_s
stv
=
torch
.
einsum
(
"...fec,...c->...fe"
,
[
phi
,
reference_vector
])
stv
=
stv
.
unsqueeze
(
-
1
)
for
_
in
range
(
3
):
stv
=
torch
.
matmul
(
phi
,
stv
)
stv
=
torch
.
matmul
(
phi
,
stv
)
stv
=
torch
.
matmul
(
psd_s
,
stv
)
return
stv
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment