sonusai 0.15.5__tar.gz → 0.15.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. {sonusai-0.15.5 → sonusai-0.15.8}/PKG-INFO +14 -18
  2. {sonusai-0.15.5 → sonusai-0.15.8}/README.rst +1 -1
  3. {sonusai-0.15.5 → sonusai-0.15.8}/pyproject.toml +14 -19
  4. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/generation.py +3 -1
  5. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/mixdb.py +117 -68
  6. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/truth_functions/data.py +2 -0
  7. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/truth_functions/target.py +14 -6
  8. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/__init__.py +0 -0
  9. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/aawscd_probwrite.py +0 -0
  10. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/calc_metric_spenh.py +0 -0
  11. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/data/__init__.py +0 -0
  12. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/data/genmixdb.yml +0 -0
  13. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/data/speech_ma01_01.wav +0 -0
  14. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/data/whitenoise.wav +0 -0
  15. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/data_generator/__init__.py +0 -0
  16. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/data_generator/dataset_from_mixdb.py +0 -0
  17. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/data_generator/keras_from_mixdb.py +0 -0
  18. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/data_generator/torch_from_mixdb.py +0 -0
  19. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/doc/__init__.py +0 -0
  20. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/doc/doc.py +0 -0
  21. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/doc.py +0 -0
  22. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/evaluate.py +0 -0
  23. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/genft.py +0 -0
  24. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/genmix.py +0 -0
  25. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/genmixdb.py +0 -0
  26. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/gentcst.py +0 -0
  27. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/keras_onnx.py +0 -0
  28. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/keras_predict.py +0 -0
  29. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/keras_train.py +0 -0
  30. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/lsdb.py +0 -0
  31. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/main.py +0 -0
  32. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/metrics/__init__.py +0 -0
  33. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/metrics/calc_class_weights.py +0 -0
  34. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/metrics/calc_optimal_thresholds.py +0 -0
  35. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/metrics/calc_pcm.py +0 -0
  36. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/metrics/calc_pesq.py +0 -0
  37. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/metrics/calc_sa_sdr.py +0 -0
  38. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/metrics/calc_sample_weights.py +0 -0
  39. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/metrics/calc_wer.py +0 -0
  40. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/metrics/calc_wsdr.py +0 -0
  41. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/metrics/class_summary.py +0 -0
  42. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/metrics/confusion_matrix_summary.py +0 -0
  43. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/metrics/one_hot.py +0 -0
  44. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/metrics/snr_summary.py +0 -0
  45. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/__init__.py +0 -0
  46. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/audio.py +0 -0
  47. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/augmentation.py +0 -0
  48. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/class_count.py +0 -0
  49. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/config.py +0 -0
  50. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/constants.py +0 -0
  51. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/datatypes.py +0 -0
  52. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/eq_rule_is_valid.py +0 -0
  53. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/feature.py +0 -0
  54. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/helpers.py +0 -0
  55. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/log_duration_and_sizes.py +0 -0
  56. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/mapped_snr_f.py +0 -0
  57. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/soundfile_audio.py +0 -0
  58. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/sox_audio.py +0 -0
  59. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/sox_augmentation.py +0 -0
  60. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/spectral_mask.py +0 -0
  61. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/target_class_balancing.py +0 -0
  62. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/targets.py +0 -0
  63. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/tokenized_shell_vars.py +0 -0
  64. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/torchaudio_audio.py +0 -0
  65. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/torchaudio_augmentation.py +0 -0
  66. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/truth.py +0 -0
  67. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/truth_functions/__init__.py +0 -0
  68. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/truth_functions/crm.py +0 -0
  69. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/truth_functions/energy.py +0 -0
  70. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/truth_functions/file.py +0 -0
  71. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/truth_functions/phoneme.py +0 -0
  72. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mixture/truth_functions/sed.py +0 -0
  73. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mkmanifest.py +0 -0
  74. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/mkwav.py +0 -0
  75. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/onnx_predict.py +0 -0
  76. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/plot.py +0 -0
  77. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/post_spenh_targetf.py +0 -0
  78. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/queries/__init__.py +0 -0
  79. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/queries/queries.py +0 -0
  80. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/torchl_onnx.py +0 -0
  81. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/torchl_predict.py +0 -0
  82. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/torchl_train.py +0 -0
  83. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/tplot.py +0 -0
  84. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/__init__.py +0 -0
  85. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/asl_p56.py +0 -0
  86. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/asr.py +0 -0
  87. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/asr_functions/__init__.py +0 -0
  88. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/asr_functions/aaware_whisper.py +0 -0
  89. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/asr_functions/aixplain_whisper.py +0 -0
  90. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/asr_functions/data.py +0 -0
  91. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/asr_functions/deepgram.py +0 -0
  92. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/asr_functions/fastwhisper.py +0 -0
  93. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/asr_functions/google.py +0 -0
  94. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/asr_functions/whisper.py +0 -0
  95. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/asr_manifest_functions/__init__.py +0 -0
  96. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/asr_manifest_functions/data.py +0 -0
  97. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/asr_manifest_functions/librispeech.py +0 -0
  98. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/asr_manifest_functions/vctk_noisy_speech.py +0 -0
  99. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/braced_glob.py +0 -0
  100. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/calculate_input_shape.py +0 -0
  101. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/convert_string_to_number.py +0 -0
  102. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/create_ts_name.py +0 -0
  103. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/dataclass_from_dict.py +0 -0
  104. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/db.py +0 -0
  105. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/energy_f.py +0 -0
  106. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/engineering_number.py +0 -0
  107. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/get_frames_per_batch.py +0 -0
  108. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/get_label_names.py +0 -0
  109. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/grouper.py +0 -0
  110. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/human_readable_size.py +0 -0
  111. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/keras_utils.py +0 -0
  112. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/max_text_width.py +0 -0
  113. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/numeric_conversion.py +0 -0
  114. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/onnx_utils.py +0 -0
  115. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/parallel.py +0 -0
  116. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/print_mixture_details.py +0 -0
  117. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/ranges.py +0 -0
  118. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/read_mixture_data.py +0 -0
  119. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/read_predict_data.py +0 -0
  120. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/reshape.py +0 -0
  121. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/seconds_to_hms.py +0 -0
  122. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/stacked_complex.py +0 -0
  123. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/stratified_shuffle_split.py +0 -0
  124. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/trim_docstring.py +0 -0
  125. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/wave.py +0 -0
  126. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/utils/yes_or_no.py +0 -0
  127. {sonusai-0.15.5 → sonusai-0.15.8}/sonusai/vars.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sonusai
3
- Version: 0.15.5
3
+ Version: 0.15.8
4
4
  Summary: Framework for building deep neural network models for sound, speech, and voice AI
5
5
  Home-page: https://aaware.com
6
6
  License: GPL-3.0-only
@@ -16,21 +16,21 @@ Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Requires-Dist: PyYAML (>=6.0.1,<7.0.0)
18
18
  Requires-Dist: aixplain (>=0.2.6,<0.3.0)
19
+ Requires-Dist: ctranslate2 (==4.1.0)
19
20
  Requires-Dist: dataclasses-json (>=0.6.1,<0.7.0)
20
21
  Requires-Dist: deepgram-sdk (>=3.0.0,<4.0.0)
21
22
  Requires-Dist: docopt (>=0.6.2,<0.7.0)
22
- Requires-Dist: faster-whisper (>=0.10.0,<0.11.0)
23
- Requires-Dist: ffmpeg (>=1.4,<2.0)
24
- Requires-Dist: greenlet (>=3.0.1,<4.0.0)
25
- Requires-Dist: grpcio (==1.60.0)
23
+ Requires-Dist: faster-whisper (>=1.0.1,<2.0.0)
24
+ Requires-Dist: h5py (>=3.11.0,<4.0.0)
26
25
  Requires-Dist: jiwer (>=3.0.3,<4.0.0)
27
- Requires-Dist: keras-tuner (>=1.4.5,<2.0.0)
26
+ Requires-Dist: keras (>=3.1.1,<4.0.0)
27
+ Requires-Dist: keras-tuner (>=1.4.7,<2.0.0)
28
28
  Requires-Dist: librosa (>=0.10.1,<0.11.0)
29
- Requires-Dist: lightning (>=2.1.0,<3.0.0)
29
+ Requires-Dist: lightning (>=2.2,<2.3)
30
30
  Requires-Dist: matplotlib (>=3.8.0,<4.0.0)
31
- Requires-Dist: onnx (==1.14.1)
31
+ Requires-Dist: onnx (>=1.14.1,<2.0.0)
32
32
  Requires-Dist: onnxruntime (>=1.16.1,<2.0.0)
33
- Requires-Dist: paho-mqtt (>=1.6.1,<2.0.0)
33
+ Requires-Dist: paho-mqtt (>=2.0.0,<3.0.0)
34
34
  Requires-Dist: pandas (>=2.1.1,<3.0.0)
35
35
  Requires-Dist: pesq (>=0.0.4,<0.0.5)
36
36
  Requires-Dist: pyaaware (>=1.5.3,<2.0.0)
@@ -38,18 +38,14 @@ Requires-Dist: pydub (>=0.25.1,<0.26.0)
38
38
  Requires-Dist: pystoi (>=0.4.0,<0.5.0)
39
39
  Requires-Dist: python-magic (>=0.4.27,<0.5.0)
40
40
  Requires-Dist: requests (>=2.31.0,<3.0.0)
41
- Requires-Dist: resampy (>=0.4.2,<0.5.0)
42
- Requires-Dist: samplerate (>=0.1.0,<0.2.0)
43
- Requires-Dist: scikit-learn (>=1.3.1,<2.0.0)
44
- Requires-Dist: sh (>=2.0.6,<3.0.0)
41
+ Requires-Dist: samplerate (>=0.2.1,<0.3.0)
45
42
  Requires-Dist: soundfile (>=0.12.1,<0.13.0)
46
43
  Requires-Dist: sox (>=1.4.1,<2.0.0)
47
- Requires-Dist: speechrecognition (>=3.10.0,<4.0.0)
44
+ Requires-Dist: speechrecognition (>=3.10.1,<4.0.0)
48
45
  Requires-Dist: tensorflow (>=2.15.0,<3.0.0)
49
- Requires-Dist: tensorflow-addons (>=0.23.0,<0.24.0)
50
46
  Requires-Dist: tf2onnx (>=1.15.1,<2.0.0)
51
- Requires-Dist: torch (>=2.1.0,<3.0.0)
52
- Requires-Dist: torchaudio (>=2.1.0,<3.0.0)
47
+ Requires-Dist: torch (>=2.2,<2.3)
48
+ Requires-Dist: torchaudio (>=2.2,<2.3)
53
49
  Requires-Dist: torchinfo (>=1.8.0,<2.0.0)
54
50
  Requires-Dist: tqdm (>=4.66.1,<5.0.0)
55
51
  Description-Content-Type: text/x-rst
@@ -59,7 +55,7 @@ Sonus AI: Framework for simplified creation of deep NN models for sound, speech,
59
55
  Sonus AI includes functions for pre-processing training and validation data and
60
56
  creating performance metrics reports for key types of Keras models:
61
57
  - recurrent, convolutional, or a combination (i.e. RCNNs)
62
- - binary, multiclass single-label, multiclass multi-label, and regresssion
58
+ - binary, multiclass single-label, multiclass multi-label, and regression
63
59
  - training with data augmentations: noise mixing, pitch and time stretch, etc.
64
60
 
65
61
  Sonus AI python functions are used by:
@@ -3,7 +3,7 @@ Sonus AI: Framework for simplified creation of deep NN models for sound, speech,
3
3
  Sonus AI includes functions for pre-processing training and validation data and
4
4
  creating performance metrics reports for key types of Keras models:
5
5
  - recurrent, convolutional, or a combination (i.e. RCNNs)
6
- - binary, multiclass single-label, multiclass multi-label, and regresssion
6
+ - binary, multiclass single-label, multiclass multi-label, and regression
7
7
  - training with data augmentations: noise mixing, pitch and time stretch, etc.
8
8
 
9
9
  Sonus AI python functions are used by:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "sonusai"
3
- version = "0.15.5"
3
+ version = "0.15.8"
4
4
  description = "Framework for building deep neural network models for sound, speech, and voice AI"
5
5
  authors = ["Chris Eddington <chris@aaware.com>", "Jason Calderwood <jason@aaware.com>"]
6
6
  maintainers = ["Chris Eddington <chris@aaware.com>", "Jason Calderwood <jason@aaware.com>"]
@@ -16,24 +16,23 @@ aawscd_probwrite = 'sonusai.aawscd_probwrite:main'
16
16
  [tool.poetry.dependencies]
17
17
  PyYAML = "^6.0.1"
18
18
  aixplain = "^0.2.6"
19
+ ctranslate2 = "4.1.0"
19
20
  dataclasses-json = "^0.6.1"
20
21
  deepgram-sdk = "^3.0.0"
21
22
  docopt = "^0.6.2"
22
- #einops = "^0"
23
- faster-whisper = "^0.10.0"
24
- ffmpeg = "^1.4"
25
- greenlet = "^3.0.1"
26
- grpcio = "1.60.0"
23
+ faster-whisper = "^1.0.1"
24
+ h5py = "^3.11.0"
27
25
  jiwer = "^3.0.3"
28
- keras-tuner = "^1.4.5"
26
+ keras = "^3.1.1"
27
+ keras-tuner = "^1.4.7"
29
28
  librosa = "^0.10.1"
30
- lightning = "^2.1.0"
29
+ lightning = "~2.2"
31
30
  matplotlib = "^3.8.0"
32
- onnx = "1.14.1"
31
+ onnx = "^1.14.1"
33
32
  #onnxruntime-gpu = "^1.16.1"
34
33
  onnxruntime = "^1.16.1"
35
34
  #openai-whisper = "^20231117"
36
- paho-mqtt = "^1.6.1"
35
+ paho-mqtt = "^2.0.0"
37
36
  pandas = "^2.1.1"
38
37
  pesq = "^0.0.4"
39
38
  pyaaware = "^1.5.3"
@@ -42,18 +41,14 @@ pystoi = "^0.4.0"
42
41
  python = ">=3.9,<3.12"
43
42
  python-magic = "^0.4.27"
44
43
  requests = "^2.31.0"
45
- resampy = "^0.4.2"
46
- samplerate = "^0.1.0"
47
- scikit-learn = "^1.3.1"
48
- sh = "^2.0.6"
44
+ samplerate = "^0.2.1"
49
45
  soundfile = "^0.12.1"
46
+ speechrecognition = "^3.10.1"
50
47
  sox = "^1.4.1"
51
- speechrecognition = "^3.10.0"
52
48
  tensorflow = "^2.15.0"
53
- tensorflow-addons = "^0.23.0"
54
49
  tf2onnx = "^1.15.1"
55
- torch = "^2.1.0"
56
- torchaudio = "^2.1.0"
50
+ torch = "~2.2"
51
+ torchaudio = "~2.2"
57
52
  torchinfo = "^1.8.0"
58
53
  tqdm = "^4.66.1"
59
54
 
@@ -63,7 +58,7 @@ ipython = "^8.16.1"
63
58
  jupyter = "^1.0.0"
64
59
  mypy = "^1.6.0"
65
60
  mypy-extensions = "^1.0.0"
66
- pytest = "^7.4.2"
61
+ pytest = "^8.1.1"
67
62
  types-pyyaml = "^6.0.12.12"
68
63
  types-requests = "^2.31.0.8"
69
64
  yappi = "^1.4.0"
@@ -433,7 +433,7 @@ def _initialize_targets_audio(mixdb: MixtureDatabase, mixture: Mixture) -> tuple
433
433
  # target_gain is used to back out the gain augmentation in order to return the target audio
434
434
  # to its normalized level when calculating truth (if needed).
435
435
  if target.augmentation.gain is not None:
436
- target.gain = 10 ** (target.augmentation.gain / 20)
436
+ target.gain = round(10 ** (target.augmentation.gain / 20), ndigits=5)
437
437
  else:
438
438
  target.gain = 1
439
439
 
@@ -507,6 +507,8 @@ def _initialize_mixture_gains(mixdb: MixtureDatabase,
507
507
  mixture.target_snr_gain *= gain_adjustment
508
508
  mixture.noise_snr_gain *= gain_adjustment
509
509
 
510
+ mixture.target_snr_gain = round(mixture.target_snr_gain, ndigits=5)
511
+ mixture.noise_snr_gain = round(mixture.noise_snr_gain, ndigits=5)
510
512
  return mixture
511
513
 
512
514
 
@@ -1,5 +1,6 @@
1
1
  from functools import cached_property
2
2
  from functools import lru_cache
3
+ from functools import partial
3
4
  from sqlite3 import Connection
4
5
  from sqlite3 import Cursor
5
6
  from typing import Any
@@ -78,8 +79,6 @@ class SQLiteContextManager:
78
79
 
79
80
  class MixtureDatabase:
80
81
  def __init__(self, location: str, test: bool = False) -> None:
81
- from functools import partial
82
-
83
82
  self.location = location
84
83
  self.db = partial(SQLiteContextManager, self.location, test)
85
84
 
@@ -380,24 +379,13 @@ class MixtureDatabase:
380
379
  t_num=spectral_mask[3],
381
380
  t_max_percent=spectral_mask[4]) for spectral_mask in results.fetchall()]
382
381
 
383
- @lru_cache
384
382
  def spectral_mask(self, sm_id: int) -> SpectralMask:
385
383
  """Get spectral mask with ID from db
386
384
 
387
385
  :param sm_id: Spectral mask ID
388
386
  :return: Spectral mask
389
387
  """
390
- with self.db() as c:
391
- spectral_mask = c.execute(
392
- "SELECT spectral_mask.f_max_width, f_num, t_max_width, t_num, t_max_percent " +
393
- "FROM spectral_mask " +
394
- "WHERE ? = spectral_mask.id",
395
- (sm_id,)).fetchone()
396
- return SpectralMask(f_max_width=spectral_mask[0],
397
- f_num=spectral_mask[1],
398
- t_max_width=spectral_mask[2],
399
- t_num=spectral_mask[3],
400
- t_max_percent=spectral_mask[4])
388
+ return _spectral_mask(self.db, sm_id)
401
389
 
402
390
  @cached_property
403
391
  def target_files(self) -> TargetFiles:
@@ -439,37 +427,13 @@ class MixtureDatabase:
439
427
  with self.db() as c:
440
428
  return [int(item[0]) for item in c.execute("SELECT target_file.id FROM target_file").fetchall()]
441
429
 
442
- @lru_cache
443
430
  def target_file(self, t_id: int) -> TargetFile:
444
431
  """Get target file with ID from db
445
432
 
446
433
  :param t_id: Target file ID
447
434
  :return: Target file
448
435
  """
449
- import json
450
-
451
- from .datatypes import TruthSetting
452
- from .datatypes import TruthSettings
453
-
454
- with self.db() as c:
455
- target = c.execute("SELECT target_file.name, samples, level_type FROM target_file WHERE ? = target_file.id",
456
- (t_id,)).fetchone()
457
-
458
- truth_settings: TruthSettings = []
459
- for ts in c.execute(
460
- "SELECT truth_setting.setting " +
461
- "FROM truth_setting, target_file_truth_setting " +
462
- "WHERE ? = target_file_truth_setting.target_file_id " +
463
- "AND truth_setting.id = target_file_truth_setting.truth_setting_id",
464
- (t_id,)).fetchall():
465
- entry = json.loads(ts[0])
466
- truth_settings.append(TruthSetting(config=entry.get('config', None),
467
- function=entry.get('function', None),
468
- index=entry.get('index', None)))
469
- return TargetFile(name=target[0],
470
- samples=target[1],
471
- level_type=target[2],
472
- truth_settings=truth_settings)
436
+ return _target_file(self.db, t_id)
473
437
 
474
438
  @cached_property
475
439
  def num_target_files(self) -> int:
@@ -499,17 +463,13 @@ class MixtureDatabase:
499
463
  with self.db() as c:
500
464
  return [int(item[0]) for item in c.execute("SELECT noise_file.id FROM noise_file").fetchall()]
501
465
 
502
- @lru_cache
503
466
  def noise_file(self, n_id: int) -> NoiseFile:
504
467
  """Get noise file with ID from db
505
468
 
506
469
  :param n_id: Noise file ID
507
470
  :return: Noise file
508
471
  """
509
- with self.db() as c:
510
- noise = c.execute("SELECT noise_file.name, samples FROM noise_file WHERE ? = noise_file.id",
511
- (n_id,)).fetchone()
512
- return NoiseFile(name=noise[0], samples=noise[1])
472
+ return _noise_file(self.db, n_id)
513
473
 
514
474
  @cached_property
515
475
  def num_noise_files(self) -> int:
@@ -540,17 +500,13 @@ class MixtureDatabase:
540
500
  return [int(item[0]) for item in
541
501
  c.execute("SELECT impulse_response_file.id FROM impulse_response_file").fetchall()]
542
502
 
543
- @lru_cache
544
503
  def impulse_response_file(self, ir_id: int) -> str:
545
504
  """Get impulse response file with ID from db
546
505
 
547
506
  :param ir_id: Impulse response file ID
548
507
  :return: Noise
549
508
  """
550
- with self.db() as c:
551
- return str(c.execute(
552
- "SELECT impulse_response_file.file FROM impulse_response_file WHERE ? = impulse_response_file.id",
553
- (ir_id + 1,)).fetchone()[0])
509
+ return _impulse_response_file(self.db, ir_id)
554
510
 
555
511
  @cached_property
556
512
  def num_impulse_response_files(self) -> int:
@@ -593,31 +549,13 @@ class MixtureDatabase:
593
549
  with self.db() as c:
594
550
  return [int(item[0]) - 1 for item in c.execute("SELECT mixture.id FROM mixture").fetchall()]
595
551
 
596
- @lru_cache
597
552
  def mixture(self, m_id: int) -> Mixture:
598
553
  """Get mixture record with ID from db
599
554
 
600
555
  :param m_id: Zero-based mixture ID
601
556
  :return: Mixture record
602
557
  """
603
- from .helpers import to_mixture
604
- from .helpers import to_target
605
-
606
- with self.db() as c:
607
- mixture = c.execute(
608
- "SELECT mixture.name, noise_file_id, noise_augmentation, noise_offset, noise_snr_gain, " +
609
- "random_snr, snr, samples, spectral_mask_id, spectral_mask_seed, target_snr_gain, id " +
610
- "FROM mixture " +
611
- "WHERE ? = mixture.id",
612
- (m_id + 1,)).fetchone()
613
-
614
- targets = [to_target(target) for target in c.execute(
615
- "SELECT target.file_id, augmentation, gain " +
616
- "FROM target, mixture_target " +
617
- "WHERE ? = mixture_target.mixture_id AND target.id = mixture_target.target_id",
618
- (mixture[11],)).fetchall()]
619
-
620
- return to_mixture(mixture, targets)
558
+ return _mixture(self.db, m_id)
621
559
 
622
560
  @cached_property
623
561
  def mixid_width(self) -> int:
@@ -1127,3 +1065,114 @@ class MixtureDatabase:
1127
1065
  class_count[cl] = int(np.sum(truth_t[:, cl] >= self.class_weights_thresholds[cl]))
1128
1066
 
1129
1067
  return class_count
1068
+
1069
+
1070
+ @lru_cache
1071
+ def _spectral_mask(db: partial, sm_id: int) -> SpectralMask:
1072
+ """Get spectral mask with ID from db
1073
+
1074
+ :param db: Database context
1075
+ :param sm_id: Spectral mask ID
1076
+ :return: Spectral mask
1077
+ """
1078
+ with db() as c:
1079
+ spectral_mask = c.execute(
1080
+ "SELECT spectral_mask.f_max_width, f_num, t_max_width, t_num, t_max_percent " +
1081
+ "FROM spectral_mask " +
1082
+ "WHERE ? = spectral_mask.id",
1083
+ (sm_id,)).fetchone()
1084
+ return SpectralMask(f_max_width=spectral_mask[0],
1085
+ f_num=spectral_mask[1],
1086
+ t_max_width=spectral_mask[2],
1087
+ t_num=spectral_mask[3],
1088
+ t_max_percent=spectral_mask[4])
1089
+
1090
+
1091
+ @lru_cache
1092
+ def _target_file(db: partial, t_id: int) -> TargetFile:
1093
+ """Get target file with ID from db
1094
+
1095
+ :param db: Database context
1096
+ :param t_id: Target file ID
1097
+ :return: Target file
1098
+ """
1099
+ import json
1100
+
1101
+ from .datatypes import TruthSetting
1102
+ from .datatypes import TruthSettings
1103
+
1104
+ with db() as c:
1105
+ target = c.execute("SELECT target_file.name, samples, level_type FROM target_file WHERE ? = target_file.id",
1106
+ (t_id,)).fetchone()
1107
+
1108
+ truth_settings: TruthSettings = []
1109
+ for ts in c.execute(
1110
+ "SELECT truth_setting.setting " +
1111
+ "FROM truth_setting, target_file_truth_setting " +
1112
+ "WHERE ? = target_file_truth_setting.target_file_id " +
1113
+ "AND truth_setting.id = target_file_truth_setting.truth_setting_id",
1114
+ (t_id,)).fetchall():
1115
+ entry = json.loads(ts[0])
1116
+ truth_settings.append(TruthSetting(config=entry.get('config', None),
1117
+ function=entry.get('function', None),
1118
+ index=entry.get('index', None)))
1119
+ return TargetFile(name=target[0],
1120
+ samples=target[1],
1121
+ level_type=target[2],
1122
+ truth_settings=truth_settings)
1123
+
1124
+
1125
+ @lru_cache
1126
+ def _noise_file(db: partial, n_id: int) -> NoiseFile:
1127
+ """Get noise file with ID from db
1128
+
1129
+ :param db: Database context
1130
+ :param n_id: Noise file ID
1131
+ :return: Noise file
1132
+ """
1133
+ with db() as c:
1134
+ noise = c.execute("SELECT noise_file.name, samples FROM noise_file WHERE ? = noise_file.id",
1135
+ (n_id,)).fetchone()
1136
+ return NoiseFile(name=noise[0], samples=noise[1])
1137
+
1138
+
1139
+ @lru_cache
1140
+ def _impulse_response_file(db: partial, ir_id: int) -> str:
1141
+ """Get impulse response file with ID from db
1142
+
1143
+ :param db: Database context
1144
+ :param ir_id: Impulse response file ID
1145
+ :return: Noise
1146
+ """
1147
+ with db() as c:
1148
+ return str(c.execute(
1149
+ "SELECT impulse_response_file.file FROM impulse_response_file WHERE ? = impulse_response_file.id",
1150
+ (ir_id + 1,)).fetchone()[0])
1151
+
1152
+
1153
+ @lru_cache
1154
+ def _mixture(db: partial, m_id: int) -> Mixture:
1155
+ """Get mixture record with ID from db
1156
+
1157
+ :param db: Database context
1158
+ :param m_id: Zero-based mixture ID
1159
+ :return: Mixture record
1160
+ """
1161
+ from .helpers import to_mixture
1162
+ from .helpers import to_target
1163
+
1164
+ with db() as c:
1165
+ mixture = c.execute(
1166
+ "SELECT mixture.name, noise_file_id, noise_augmentation, noise_offset, noise_snr_gain, " +
1167
+ "random_snr, snr, samples, spectral_mask_id, spectral_mask_seed, target_snr_gain, id " +
1168
+ "FROM mixture " +
1169
+ "WHERE ? = mixture.id",
1170
+ (m_id + 1,)).fetchone()
1171
+
1172
+ targets = [to_target(target) for target in c.execute(
1173
+ "SELECT target.file_id, augmentation, gain " +
1174
+ "FROM target, mixture_target " +
1175
+ "WHERE ? = mixture_target.mixture_id AND target.id = mixture_target.target_id",
1176
+ (mixture[11],)).fetchall()]
1177
+
1178
+ return to_mixture(mixture, targets)
@@ -23,6 +23,8 @@ class Data:
23
23
  num_classes=config.num_classes,
24
24
  truth_mutex=config.mutex)
25
25
 
26
+ self.num_bands = fg.num_bands
27
+ self.ttype = fg.ftransform_ttype
26
28
  self.frame_size = fg.ftransform_R
27
29
 
28
30
  if len(target_audio) % self.frame_size != 0:
@@ -13,12 +13,13 @@ Calculates the true transform of the target using the STFT
13
13
  configuration defined by the feature. This will include a
14
14
  forward transform window if defined by the feature.
15
15
 
16
- Output shape: [:, 2 * bins] (stacked real, imag)
16
+ Output shape: [:, num_classes]
17
+ (target stacked real, imag; or real only for tdac-co)
17
18
  """
18
19
 
19
20
  from sonusai import SonusAIError
20
21
 
21
- if data.config.num_classes != 2 * data.target_fft.bins:
22
+ if data.config.num_classes != data.num_bands:
22
23
  raise SonusAIError(f'Invalid num_classes for target_f truth: {data.config.num_classes}')
23
24
 
24
25
  target_freq = _execute_fft(data.target_audio, data.target_fft, len(data.offsets))
@@ -28,6 +29,7 @@ Output shape: [:, 2 * bins] (stacked real, imag)
28
29
  frame_size=data.frame_size,
29
30
  zero_based_indices=data.zero_based_indices,
30
31
  bins=data.target_fft.bins,
32
+ ttype=data.ttype,
31
33
  start=0,
32
34
  truth=data.truth)
33
35
 
@@ -43,11 +45,13 @@ using the STFT configuration defined by the feature. This
43
45
  will include a forward transform window if defined by the
44
46
  feature.
45
47
 
46
- Output shape: [:, 4 * bins] (target stacked real, imag; mixture stacked real, imag)
48
+ Output shape: [:, 2 * num_classes]
49
+ (target stacked real, imag; or real only for tdac-co)
50
+ (mixture stacked real, imag; or real only for tdac-co)
47
51
  """
48
52
  from sonusai import SonusAIError
49
53
 
50
- if data.config.num_classes != 2 * data.target_fft.bins + 2 * data.mixture_fft.bins:
54
+ if data.config.num_classes != 2 * data.num_bands:
51
55
  raise SonusAIError(f'Invalid num_classes for target_mixture_f truth: {data.config.num_classes}')
52
56
 
53
57
  target_freq = _execute_fft(data.target_audio, data.target_fft, len(data.offsets))
@@ -59,6 +63,7 @@ Output shape: [:, 4 * bins] (target stacked real, imag; mixture stacked real, im
59
63
  frame_size=data.frame_size,
60
64
  zero_based_indices=data.zero_based_indices,
61
65
  bins=data.target_fft.bins,
66
+ ttype=data.ttype,
62
67
  start=0,
63
68
  truth=data.truth)
64
69
 
@@ -67,6 +72,7 @@ Output shape: [:, 4 * bins] (target stacked real, imag; mixture stacked real, im
67
72
  frame_size=data.frame_size,
68
73
  zero_based_indices=data.zero_based_indices,
69
74
  bins=data.target_fft.bins,
75
+ ttype=data.ttype,
70
76
  start=data.target_fft.bins * 2,
71
77
  truth=data.truth)
72
78
 
@@ -125,6 +131,7 @@ def _stack_real_imag(data: AudioF,
125
131
  frame_size: int,
126
132
  zero_based_indices: list[int],
127
133
  bins: int,
134
+ ttype: str,
128
135
  start: int,
129
136
  truth: Truth) -> Truth:
130
137
  import numpy as np
@@ -134,7 +141,8 @@ def _stack_real_imag(data: AudioF,
134
141
  b = _get_bin_slice(index + start, bins)
135
142
  truth[i, b] = np.real(data)
136
143
 
137
- b = _get_bin_slice(b.stop, bins)
138
- truth[i, b] = np.imag(data)
144
+ if ttype != 'tdac-co':
145
+ b = _get_bin_slice(b.stop, bins)
146
+ truth[i, b] = np.imag(data)
139
147
 
140
148
  return truth
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes