Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SpeechDatasets.jl
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PTAL
Datasets
SpeechDatasets.jl
Commits
620e3571
Commit
620e3571
authored
1 year ago
by
Martin Kocour
Committed by
Lucas Ondel Yang
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Dataset
parent
fcdc1d21
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Project.toml
+1
-0
1 addition, 0 deletions
Project.toml
src/SpeechCorpora.jl
+10
-2
10 additions, 2 deletions
src/SpeechCorpora.jl
src/dataset.jl
+57
-0
57 additions, 0 deletions
src/dataset.jl
with
68 additions
and
2 deletions
Project.toml
+
1
−
0
View file @
620e3571
...
...
@@ -7,6 +7,7 @@ version = "0.7.0"
Base64
=
"2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
HTTP
=
"cd3eb016-35fb-5094-929b-558a96fad6f3"
JSON
=
"682c06a0-de6a-54ab-a142-c8b1cf79cde6"
MLUtils
=
"f1d291b0-491e-4a28-83b9-f70985020b54"
SpeechFeatures
=
"6f3487c4-5ca2-4050-bfeb-2cf56df92307"
WAV
=
"8149f6b0-98f6-5db9-b78f-408fbbb8ef88"
...
...
This diff is collapsed.
Click to expand it.
src/SpeechCorpora.jl
+
10
−
2
View file @
620e3571
...
...
@@ -7,7 +7,9 @@ using HTTP
using
JSON
using
WAV
using
SpeechFeatures
:
AbstractAudioSource
,
CmdAudioSource
,
FileAudioSource
,
URLAudioSource
,
loadaudio
using
SpeechFeatures
import
MLUtils
export
# ManifestItem
...
...
@@ -28,11 +30,17 @@ export
# Corpora
MultilingualLibriSpeech
,
MiniLibriSpeech
,
TIMIT
TIMIT
,
# Dataset
dataset
include
(
"speechcorpus.jl"
)
include
(
"manifest_item.jl"
)
include
(
"manifest_io.jl"
)
include
(
"dataset.jl"
)
# Supported corpora
include
(
"corpora/multilingual_librispeech.jl"
)
include
(
"corpora/mini_librispeech.jl"
)
include
(
"corpora/timit.jl"
)
...
...
This diff is collapsed.
Click to expand it.
src/dataset.jl
0 → 100644
+
57
−
0
View file @
620e3571
# SPDX-License-Identifier: CECILL-2.1
"""
FastDataset(supervisions, recordings, partition)
Constructor for dataset represented as JSONL files (a.k.a. manifests).
"""
struct
SpeechDataset
<:
MLUtils
.
AbstractDataContainer
idxs
::
Vector
{
AbstractString
}
superivions
::
Dict
{
AbstractString
,
Supervision
}
recordings
::
Dict
{
AbstractString
,
Recording
}
partition
::
Symbol
end
"""
dataset(manifestroot, subset)
Load `SpeechDataset` from manifest files stored in `manifestroot`.
Partition is specified by `subset`, e.g. `:train`, `:test`.
Each item of the dataset is a nested tuple `((samples, sampling_rate), Supervision.data)`.
See also [`Supervision`](@ref).
# Examples
```julia-repl
julia> ds = dataset("
./
manifests
", :train)
SpeechDataset(
...
)
julia> ds[1]
(
(samples=[...], sampling_rate=16_000),
Dict(
"
text
" => "
Supervision
text
here
"
)
)
```
"""
function
dataset
(
manifestroot
::
AbstractString
,
subset
)
supervisions
=
load
(
Supervision
,
manifestroot
,
subset
)
recordings
=
load
(
Recording
,
manifestroot
,
subset
)
idxs
=
collect
(
keys
(
supervisions
))
SpeechDataset
(
idxs
,
supervisions
,
recordings
,
Symbol
(
subset
))
end
function
Base.getindex
(
d
::
SpeechDataset
,
key
::
AbstractString
)
sup
=
d
.
superivions
[
key
]
rec
=
d
.
recordings
[
sup
.
recording_id
]
samples
,
sr
=
load
(
rec
,
sup
)
(
samples
=
samples
,
sampling_rate
=
sr
),
sup
.
data
end
Base
.
getindex
(
d
::
SpeechDataset
,
idx
::
Integer
)
=
getindex
(
d
,
d
.
idxs
[
idx
])
# Fix1 -> partial funcion with fixed 1st argument
Base
.
getindex
(
d
::
SpeechDataset
,
idxs
::
AbstractVector
)
=
map
(
Base
.
Fix1
(
getindex
,
d
),
idxs
)
Base
.
length
(
d
::
SpeechDataset
)
=
length
(
d
.
idxs
)
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