-
Notifications
You must be signed in to change notification settings - Fork 1
/
base.html
561 lines (365 loc) · 19.3 KB
/
base.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
<!DOCTYPE html>
<html >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1"><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>Base Classes</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/theme.css " type="text/css" />
<link rel="stylesheet" href="_static/css/custom.css" type="text/css" />
<link rel="stylesheet" href="_static/css/waveform-list.css" type="text/css" />
<!-- sphinx script_files -->
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<!-- bundled in js (rollup iife) -->
<!-- <script src="_static/theme-vendors.js"></script> -->
<script src="_static/theme.js" defer></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Constants" href="constants.html" />
<link rel="prev" title="Training" href="training.html" />
</head>
<body>
<div id="app">
<div class="theme-container" :class="pageClasses"><navbar @toggle-sidebar="toggleSidebar">
<router-link to="index.html" class="home-link">
<span class="site-name">omnizart</span>
</router-link>
<div class="links">
<navlinks class="can-hide">
<div class="nav-item">
<a href="index.html#sound-samples"
class="nav-link ">
Contents
</a>
</div>
<div class="nav-item">
<a href="index.html#sound-samples"
class="nav-link ">
Command Line Interface
</a>
</div>
<div class="nav-item">
<a href="index.html#sound-samples"
class="nav-link router-link-active">
API Reference
</a>
</div>
</navlinks>
</div>
</navbar>
<div class="sidebar-mask" @click="toggleSidebar(false)">
</div>
<sidebar @toggle-sidebar="toggleSidebar">
<navlinks>
<div class="nav-item">
<a href="index.html#sound-samples"
class="nav-link ">
Contents
</a>
</div>
<div class="nav-item">
<a href="index.html#sound-samples"
class="nav-link ">
Command Line Interface
</a>
</div>
<div class="nav-item">
<a href="index.html#sound-samples"
class="nav-link router-link-active">
API Reference
</a>
</div>
</navlinks><div id="searchbox" class="searchbox" role="search">
<div class="caption"><span class="caption-text">Quick search</span>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Search" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div><div class="sidebar-links" role="navigation" aria-label="main navigation">
<div class="sidebar-group">
<p class="caption">
<span class="caption-text"><a href="index.html#sound-samples">Contents</a></span>
</p>
<ul class="">
<li class="toctree-l1 ">
<a href="quick-start.html" class="reference internal ">Quick Start</a>
</li>
<li class="toctree-l1 ">
<a href="tutorial.html" class="reference internal ">Tutorial</a>
</li>
<li class="toctree-l1 ">
<a href="demo.html" class="reference internal ">Demonstration</a>
</li>
</ul>
</div>
<div class="sidebar-group">
<p class="caption">
<span class="caption-text"><a href="index.html#sound-samples">Command Line Interface</a></span>
</p>
<ul class="">
<li class="toctree-l1 ">
<a href="music/cli.html" class="reference internal ">omnizart music</a>
</li>
<li class="toctree-l1 ">
<a href="drum/cli.html" class="reference internal ">omnizart drum</a>
</li>
<li class="toctree-l1 ">
<a href="chord/cli.html" class="reference internal ">omnizart chord</a>
</li>
<li class="toctree-l1 ">
<a href="vocal/cli.html" class="reference internal ">omnizart vocal</a>
</li>
<li class="toctree-l1 ">
<a href="vocal-contour/cli.html" class="reference internal ">omnizart vocal-contour</a>
</li>
<li class="toctree-l1 ">
<a href="beat/cli.html" class="reference internal ">omnizart beat</a>
</li>
<li class="toctree-l1 ">
<a href="patch-cnn/cli.html" class="reference internal ">omnizart patch-cnn</a>
</li>
</ul>
</div>
<div class="sidebar-group">
<p class="caption">
<span class="caption-text"><a href="index.html#sound-samples">API Reference</a></span>
</p>
<ul class="current">
<li class="toctree-l1 ">
<a href="music/api.html" class="reference internal ">Music Transcription</a>
</li>
<li class="toctree-l1 ">
<a href="drum/api.html" class="reference internal ">Drum Transcription</a>
</li>
<li class="toctree-l1 ">
<a href="chord/api.html" class="reference internal ">Chord Transcription</a>
</li>
<li class="toctree-l1 ">
<a href="vocal/api.html" class="reference internal ">Vocal Transcription</a>
</li>
<li class="toctree-l1 ">
<a href="vocal-contour/api.html" class="reference internal ">Vocal-Contour Transcription</a>
</li>
<li class="toctree-l1 ">
<a href="patch-cnn/api.html" class="reference internal ">Patch-CNN Transcription</a>
</li>
<li class="toctree-l1 ">
<a href="beat/api.html" class="reference internal ">Beat Transcription</a>
</li>
<li class="toctree-l1 ">
<a href="feature.html" class="reference internal ">Feature</a>
</li>
<li class="toctree-l1 ">
<a href="models.html" class="reference internal ">Models</a>
</li>
<li class="toctree-l1 ">
<a href="training.html" class="reference internal ">Training</a>
</li>
<li class="toctree-l1 current">
<a href="#" class="reference internal current">Base Classes</a>
<ul>
<li class="toctree-l2"><a href="#transcription" class="reference internal">Transcription</a></li>
<li class="toctree-l2"><a href="#label" class="reference internal">Label</a></li>
<li class="toctree-l2"><a href="#dataset-loader" class="reference internal">Dataset Loader</a></li>
</ul>
</li>
<li class="toctree-l1 ">
<a href="constants.html" class="reference internal ">Constants</a>
</li>
<li class="toctree-l1 ">
<a href="utils.html" class="reference internal ">Utilities</a>
</li>
</ul>
</div>
</div>
</sidebar>
<page>
<div class="body-header" role="navigation" aria-label="navigation">
<ul class="breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li>Base Classes</li>
</ul>
<ul class="page-nav">
<li class="prev">
<a href="training.html"
title="previous chapter">← Training</a>
</li>
<li class="next">
<a href="constants.html"
title="next chapter">Constants →</a>
</li>
</ul>
</div>
<hr>
<div class="content" role="main" v-pre>
<section id="module-omnizart.base">
<span id="base-classes"></span><h1>Base Classes<a class="headerlink" href="#module-omnizart.base" title="Permalink to this headline">¶</a></h1>
<p>Base classes of this project.</p>
<p>Defines common interfaces, attributes, and utilities for different tasks.</p>
<section id="transcription">
<h2>Transcription<a class="headerlink" href="#transcription" title="Permalink to this headline">¶</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="omnizart.base.BaseTranscription">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">omnizart.base.</span></span><span class="sig-name descname"><span class="pre">BaseTranscription</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">setting_class</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">conf_path</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#omnizart.base.BaseTranscription" title="Permalink to this definition">¶</a></dt>
<dd><p>Base class of transcription applications.</p>
<p class="rubric">Methods</p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#omnizart.base.BaseTranscription.get_model" title="omnizart.base.BaseTranscription.get_model"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_model</span></code></a>(settings)</p></td>
<td><p>Get the model from the python source file.</p></td>
</tr>
</tbody>
</table>
<table class="docutils align-default">
<colgroup>
<col style="width: 58%" />
<col style="width: 42%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><strong>transcribe</strong></p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="py method">
<dt class="sig sig-object py" id="omnizart.base.BaseTranscription.get_model">
<span class="sig-name descname"><span class="pre">get_model</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">settings</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#omnizart.base.BaseTranscription.get_model" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the model from the python source file.</p>
<p>This is only for those customized models that can’t export <em>arch.yaml</em> file,
and hence need to instanitiate the model from python class, which is not
that desirable as the architecture is not recorded in a stand-alone file.</p>
<p>Another way is using model.save() method to export .pb format architecture
file, but there could be troubles if you want continue to train on these
models in such format when these are customized models.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><dl class="simple">
<dt>model: tf.keras.Model</dt><dd><p>The initialized keras model.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
</dd></dl>
</section>
<section id="label">
<h2>Label<a class="headerlink" href="#label" title="Permalink to this headline">¶</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="omnizart.base.Label">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">omnizart.base.</span></span><span class="sig-name descname"><span class="pre">Label</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">start_time</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">end_time</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">note</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">instrument</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">velocity</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">64</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">start_beat</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">end_beat</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">note_value</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">is_drum</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#omnizart.base.Label" title="Permalink to this definition">¶</a></dt>
<dd><p>Interface of different label format.</p>
<p>Plays the role for generalize the label format, and subsequent dataset class should
implement functions transforming labels (whether in .mid, .txt, or .csv format)
and parse the necessary columns into attributes this class holds.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>start_time: float</strong></dt><dd><p>Onset time of the note in seconds.</p>
</dd>
<dt><strong>end_time: float</strong></dt><dd><p>Offset time of the note in seconds.</p>
</dd>
<dt><strong>note: int</strong></dt><dd><p>Midi number of the number, should be within 21~108.</p>
</dd>
<dt><strong>instrument: int</strong></dt><dd><p>Instrument number in Midi.</p>
</dd>
<dt><strong>velocity: int</strong></dt><dd><p>Velocity of keypress, should be wihtin 0~127</p>
</dd>
<dt><strong>start_beat: float</strong></dt><dd><p>Start beat index of the note.</p>
</dd>
<dt><strong>end_beat: float</strong></dt><dd><p>End beat index of the note.</p>
</dd>
<dt><strong>note_value: str</strong></dt><dd><p>Type of the note (e.g. quater, eighth, sixteenth).</p>
</dd>
<dt><strong>is_drum: bool</strong></dt><dd><p>Whether the note represents the drum note.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Attributes</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>note</strong></dt><dd></dd>
<dt><strong>velocity</strong></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>
</section>
<section id="dataset-loader">
<h2>Dataset Loader<a class="headerlink" href="#dataset-loader" title="Permalink to this headline">¶</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="omnizart.base.BaseDatasetLoader">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">omnizart.base.</span></span><span class="sig-name descname"><span class="pre">BaseDatasetLoader</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">feature_folder</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">feature_files</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">num_samples</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">100</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">slice_hop</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">feat_col_name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'feature'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#omnizart.base.BaseDatasetLoader" title="Permalink to this definition">¶</a></dt>
<dd><p>Base dataset loader for yielding training samples.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>feature_folder: Path</strong></dt><dd><p>Path to the folder that contains the extracted feature files.</p>
</dd>
<dt><strong>feature_files: list[Path]</strong></dt><dd><p>List of paths to the feature files. One of <em>feature_folder</em> or <em>feature_files</em>
must be specified.</p>
</dd>
<dt><strong>num_samples: int</strong></dt><dd><p>Total sample number to be yielded.</p>
</dd>
<dt><strong>slice_hop: int</strong></dt><dd><p>Hop size when initializing the start index.</p>
</dd>
<dt><strong>feat_col_name: str</strong></dt><dd><p>Name of the feature column stored in the <em>.hdf</em> feature files.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Yields</dt>
<dd class="field-even"><dl class="simple">
<dt>feature:</dt><dd><p>Input feature for training the model.</p>
</dd>
<dt>label:</dt><dd><p>Coressponding label representation.</p>
</dd>
</dl>
</dd>
</dl>
<p class="rubric">Methods</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 60%" />
<col style="width: 40%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><strong>get_dataset</strong></p></td>
<td></td>
</tr>
</tbody>
</table>
</dd></dl>
</section>
</section>
</div>
<div class="page-nav">
<div class="inner"><ul class="page-nav">
<li class="prev">
<a href="training.html"
title="previous chapter">← Training</a>
</li>
<li class="next">
<a href="constants.html"
title="next chapter">Constants →</a>
</li>
</ul><div class="footer" role="contentinfo">
© Copyright 2020, MCTLab.
<br>
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 4.3.1 with <a href="https://github.com/schettino72/sphinx_press_theme">Press Theme</a> 0.8.0.
</div>
</div>
</div>
</page>
</div></div>
</body>
</html>