Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jean Ibarz
ml_binaural_audio
Commits
9b54deb9
Commit
9b54deb9
authored
Feb 11, 2021
by
Jean Ibarz
Browse files
Added a model that localize a binaural signal into 3 categories (left,center,right).
parent
ffdc29ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/model.py
View file @
9b54deb9
...
...
@@ -29,3 +29,27 @@ def default_model_creator(model_config):
])
return
model
def
left_center_or_right_model_creator
(
model_config
):
"""
input: (batch, time, channels, 1),
output: the guessed azimuth, one-hot encoded in 3 categories (left, center, right)
"""
model
=
tf
.
keras
.
Sequential
([
RandomScale2DLayer
(
minval
=
model_config
[
'random_scale'
][
'minval'
],
maxval
=
model_config
[
'random_scale'
][
'maxval'
]),
RandomShift2DLayer
(
minval
=
model_config
[
'random_shift'
][
'minval'
],
maxval
=
model_config
[
'random_shift'
][
'maxval'
],
axis
=
1
),
tkl
.
Flatten
(),
tkl
.
Dense
(
units
=
10
,
activation
=
'relu'
),
tkl
.
Dropout
(
rate
=
0.2
),
tkl
.
Dense
(
units
=
10
,
activation
=
'relu'
),
tkl
.
Dropout
(
rate
=
0.2
),
tkl
.
Dense
(
units
=
10
,
activation
=
'relu'
),
tkl
.
Dropout
(
rate
=
0.2
),
tkl
.
Dense
(
units
=
3
,
activation
=
'softmax'
)
])
return
model
Write
Preview
Supports
Markdown
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