tonic 1.4.4.dev21__tar.gz → 1.4.4.dev34__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 (177) hide show
  1. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/ChangeLog +13 -0
  2. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/PKG-INFO +1 -1
  3. tonic-1.4.4.dev34/docs/tutorials/Aug_DiskCachDataset.ipynb +179 -0
  4. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/requirements.txt +1 -0
  5. tonic-1.4.4.dev34/test/test_aug_caching.py +66 -0
  6. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/__init__.py +6 -1
  7. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/cached_dataset.py +86 -1
  8. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic.egg-info/PKG-INFO +1 -1
  9. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic.egg-info/SOURCES.txt +2 -0
  10. tonic-1.4.4.dev34/tonic.egg-info/pbr.json +1 -0
  11. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic.egg-info/requires.txt +1 -0
  12. tonic-1.4.4.dev21/tonic.egg-info/pbr.json +0 -1
  13. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/.binder/requirements.txt +0 -0
  14. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/.coveragerc +0 -0
  15. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/.github/workflows/ci-pipeline.yml +0 -0
  16. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/.pre-commit-config.yaml +0 -0
  17. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/.readthedocs.yml +0 -0
  18. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/AUTHORS +0 -0
  19. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/LICENSE.txt +0 -0
  20. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/MANIFEST.in +0 -0
  21. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/README.md +0 -0
  22. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/Makefile +0 -0
  23. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/_static/event-cameras/eventstream.png +0 -0
  24. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/_static/event-cameras/framestream.png +0 -0
  25. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/_static/event-cameras/receptive-fields.png +0 -0
  26. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/_static/event-cameras/sampling-theorems.png +0 -0
  27. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/_static/snn/neuron-models.png +0 -0
  28. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/_static/snn/surrogates.png +0 -0
  29. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/_static/tonic-logo-black-bg.png +0 -0
  30. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/_static/tonic-logo-black.png +0 -0
  31. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/_static/tonic-logo-white.png +0 -0
  32. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/_static/tonic_favicon.png +0 -0
  33. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/_templates/class_dataset.rst +0 -0
  34. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/_templates/class_transform.rst +0 -0
  35. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/about/about.rst +0 -0
  36. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/about/info.rst +0 -0
  37. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/about/prototype.rst +0 -0
  38. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/about/release_notes.rst +0 -0
  39. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/conf.py +0 -0
  40. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/datasets.rst +0 -0
  41. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/README.rst +0 -0
  42. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/representations/README.rst +0 -0
  43. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/representations/plot_tobinarep.py +0 -0
  44. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/representations/plot_toframe.py +0 -0
  45. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/representations/plot_toimage.py +0 -0
  46. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/representations/plot_totimesurface.py +0 -0
  47. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/representations/plot_tovoxelgrid.py +0 -0
  48. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/README.rst +0 -0
  49. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_centercrop.py +0 -0
  50. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_crop_time.py +0 -0
  51. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_decimation.py +0 -0
  52. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_denoise.py +0 -0
  53. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_downsample.py +0 -0
  54. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_drop_event.py +0 -0
  55. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_drop_event_by_area.py +0 -0
  56. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_drop_event_by_time.py +0 -0
  57. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_drop_pixel.py +0 -0
  58. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_event_downsampling.py +0 -0
  59. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_merge_polarities.py +0 -0
  60. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_random_crop.py +0 -0
  61. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_random_flip_lr.py +0 -0
  62. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_random_flip_ud.py +0 -0
  63. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_random_time_reversal.py +0 -0
  64. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_refractory_period.py +0 -0
  65. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_spatial_jitter.py +0 -0
  66. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_time_jitter.py +0 -0
  67. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/gallery/transformations/plot_uniform_noise.py +0 -0
  68. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/getting_involved/communication_channels.rst +0 -0
  69. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/getting_involved/contribute.rst +0 -0
  70. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/getting_involved/getting_involved.rst +0 -0
  71. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/getting_started/getting_started.rst +0 -0
  72. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/getting_started/install.rst +0 -0
  73. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/getting_started/nmnist.ipynb +0 -0
  74. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/how-tos/how-tos.rst +0 -0
  75. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/how-tos/loading-raw-events.ipynb +0 -0
  76. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/how-tos/visualizing-data.ipynb +0 -0
  77. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/how-tos/wrapping_own_data.ipynb +0 -0
  78. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/index.md +0 -0
  79. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/make.bat +0 -0
  80. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/reading_material/design_choices.rst +0 -0
  81. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/reading_material/intro-event-cameras.rst +0 -0
  82. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/reading_material/intro-snns.rst +0 -0
  83. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/reading_material/reading_material.rst +0 -0
  84. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/reading_material/training-snns.rst +0 -0
  85. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/requirements.txt +0 -0
  86. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/transformations.rst +0 -0
  87. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/tutorials/audio_transforms_tutorial.ipynb +0 -0
  88. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/tutorials/batching.ipynb +0 -0
  89. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/tutorials/davis_data.ipynb +0 -0
  90. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/tutorials/fast_dataloading.ipynb +0 -0
  91. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/tutorials/large_datasets.ipynb +0 -0
  92. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/tutorials/slicing.ipynb +0 -0
  93. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/docs/tutorials/tutorials.rst +0 -0
  94. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/setup.cfg +0 -0
  95. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/setup.py +0 -0
  96. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/dataset_utils.py +0 -0
  97. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/prototype_dataset_utils.py +0 -0
  98. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/requirements.txt +0 -0
  99. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_audio_augmentations.py +0 -0
  100. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_audio_transforms.py +0 -0
  101. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_caching.py +0 -0
  102. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_chained_transforms.py +0 -0
  103. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_data/sample.aedat4 +0 -0
  104. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_data/sample_aedat_header.aedat +0 -0
  105. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_data/sample_ncars.dat +0 -0
  106. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_data/sample_nmnist.bin +0 -0
  107. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_data/sample_stmnist.mat +0 -0
  108. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_datasets.py +0 -0
  109. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_dsec.py +0 -0
  110. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_io.py +0 -0
  111. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_prototype_datasets.py +0 -0
  112. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_representations.py +0 -0
  113. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_sliced_dataset.py +0 -0
  114. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_slicers.py +0 -0
  115. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_tonic_utils.py +0 -0
  116. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/test_transforms.py +0 -0
  117. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/torch_requirements.txt +0 -0
  118. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/test/utils.py +0 -0
  119. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/audio_augmentations.py +0 -0
  120. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/audio_transforms.py +0 -0
  121. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/collation.py +0 -0
  122. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/dataset.py +0 -0
  123. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/__init__.py +0 -0
  124. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/asl_dvs.py +0 -0
  125. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/cifar10dvs.py +0 -0
  126. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/davisdataset.py +0 -0
  127. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/dsec.py +0 -0
  128. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/dvs_lips.py +0 -0
  129. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/dvsgesture.py +0 -0
  130. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/ebssa.py +0 -0
  131. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/hsd.py +0 -0
  132. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/mvsec.py +0 -0
  133. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/ncaltech101.py +0 -0
  134. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/nmnist.py +0 -0
  135. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/pokerdvs.py +0 -0
  136. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/s_mnist.py +0 -0
  137. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/threeET_eyetracking.py +0 -0
  138. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/tum_vie.py +0 -0
  139. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/datasets/visual_place_recognition.py +0 -0
  140. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/download_utils.py +0 -0
  141. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/__init__.py +0 -0
  142. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/crop.py +0 -0
  143. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/decimate.py +0 -0
  144. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/denoise.py +0 -0
  145. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/drop_event.py +0 -0
  146. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/drop_pixel.py +0 -0
  147. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/event_downsampling.py +0 -0
  148. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/refractory_period.py +0 -0
  149. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/spatial_jitter.py +0 -0
  150. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/time_jitter.py +0 -0
  151. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/time_skew.py +0 -0
  152. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/to_averaged_timesurface.py +0 -0
  153. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/to_bina_rep.py +0 -0
  154. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/to_frame.py +0 -0
  155. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/to_timesurface.py +0 -0
  156. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/to_voxel_grid.py +0 -0
  157. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/functional/uniform_noise.py +0 -0
  158. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/io.py +0 -0
  159. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/prototype/README.md +0 -0
  160. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/prototype/__init__.py +0 -0
  161. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/prototype/datasets/__init__.py +0 -0
  162. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/prototype/datasets/ncars.py +0 -0
  163. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/prototype/datasets/nmnist.py +0 -0
  164. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/prototype/datasets/prophesee.py +0 -0
  165. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/prototype/datasets/stmnist.py +0 -0
  166. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/prototype/datasets/utils/__init__.py +0 -0
  167. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/prototype/datasets/utils/_dataset.py +0 -0
  168. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/prototype/datasets/utils/_utils.py +0 -0
  169. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/prototype/slicers.py +0 -0
  170. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/sliced_dataset.py +0 -0
  171. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/slicers.py +0 -0
  172. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/transforms.py +0 -0
  173. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic/utils.py +0 -0
  174. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic-logo-padded.png +0 -0
  175. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic.egg-info/dependency_links.txt +0 -0
  176. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic.egg-info/not-zip-safe +0 -0
  177. {tonic-1.4.4.dev21 → tonic-1.4.4.dev34}/tonic.egg-info/top_level.txt +0 -0
@@ -1,6 +1,10 @@
1
1
  CHANGES
2
2
  =======
3
3
 
4
+ * DataSet class import was removed, the mini dataset does not inherent from that
5
+ * moving torchvision import to inside function
6
+ * moving typing-extensions to the root requirement
7
+ * moving torch import to inside function, where it is used
4
8
  * pin torchvision version to something compatible with torch 2.1
5
9
  * add torch requirements to documentation github action
6
10
  * shorten GH actions pipeline to three Python versions
@@ -12,6 +16,10 @@ CHANGES
12
16
  * Revert "fix path format on windows for test case for ThreeET\_Eyetracking"
13
17
  * fix path format on windows for test case for ThreeET\_Eyetracking
14
18
  * add test case for ThreeET\_Eyetracking
19
+ * notebook added to elaborate teh function of AugDiskCachedDataset
20
+ * test added for aug\_diskcached
21
+ * including Aug\_DiskCachedDataset in init imports
22
+ * bug fixed in Aug\_DiskCach
15
23
  * add ThreeET\_Eyetracking to the documentation
16
24
  * fix: check for empty array in DropPixel transform
17
25
  * added: tests for empty frames
@@ -32,6 +40,9 @@ v1.4.3
32
40
  * sample\_length was removed from some transforms (when not needed)
33
41
  * Fix: silent frames is now supported in uniform noise
34
42
  * Fix: silent frame support
43
+ * importing TypedDict from typing\_extensions for python 3.7
44
+ * adding typing-extensions to requirments
45
+ * small fixes and cleanup
35
46
  * noise related augmentations removed
36
47
  * Fix: wrong range of histogram in drop\_pixel
37
48
  * Testing with python>=3.8 and python<=3.11
@@ -51,11 +62,13 @@ v1.4.3
51
62
  * adding torchaudio
52
63
  * removing conflicting requirements
53
64
  * updated the required version of torch
65
+ * dict keys updated to more generic
54
66
  * RIR test updated
55
67
  * removing hard coded room impulse audio from RIR transform
56
68
  * requirments updated with torch and torchaudio versions
57
69
  * removing torchaudio dependency temporarily to run the tests
58
70
  * torchaudio added to requirements
71
+ * AugDiskCachedDataset added
59
72
  * tests\_passed
60
73
  * tests for audio augmentations
61
74
  * tests for added transforms
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tonic
3
- Version: 1.4.4.dev21
3
+ Version: 1.4.4.dev34
4
4
  Summary: Neuromorphic datasets and transformations.
5
5
  Home-page: UNKNOWN
6
6
  Author: The Neuromorphs of Telluride
@@ -0,0 +1,179 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "## Using Aug_DiskCachedDataset for efficient caching of augmented copies\n",
8
+ "- `Aug_DiskCachedDataset` is a modified version of `DiskCachedDataset` that is useful while applying deterministic augmentations on data samples. \n",
9
+ "\n",
10
+ "- This is the case when the parameter space of augmentation is desceret, for instance applying `pitchshift` on audio data in which shift parameter (semitone) can only take N values.\n",
11
+ "\n",
12
+ "- Using `DiskCachedDataset` and setting `num_copies` to N is likely to cause 2 issues:\n",
13
+ "\n",
14
+ " - Copies might not be unique, as copy_index is not linked to the augmentation parameter \n",
15
+ " - And there is no guarantee that copies cover the desired augmentation space\n",
16
+ " \n",
17
+ "\n",
18
+ "\n",
19
+ "- `Aug_DiskCachedDataset` resolves this limitation by mapping and linking copy index to augmentation parameter. Following considerations need to be takes into account:\n",
20
+ "\n",
21
+ " - The user needs to pass `all_transforms` dict as input with seperated transforms `pre_aug`, `aug`, `post_aug` (spesifying transforms that are applied before and after augmentations, also augmentation transforms). \n",
22
+ " \n",
23
+ " - The augmentation class receives `aug_index` (aug_index = copy) as initialization parameter also `caching=True` needs to be set (please see `tonic.audio_augmentations`)\n",
24
+ "\n",
25
+ "- Follwing is a simple example to show function of `Aug_DiskCachedDataset`"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "markdown",
30
+ "metadata": {},
31
+ "source": [
32
+ "### A simple dataset "
33
+ ]
34
+ },
35
+ {
36
+ "cell_type": "code",
37
+ "execution_count": 1,
38
+ "metadata": {},
39
+ "outputs": [],
40
+ "source": [
41
+ "# %%writefile mini_dataset.py\n",
42
+ "import warnings\n",
43
+ "warnings.filterwarnings('ignore')\n",
44
+ "from torch.utils.data import Dataset\n",
45
+ "import numpy as np\n",
46
+ "\n",
47
+ "class mini_dataset(Dataset):\n",
48
+ " def __init__(self) -> None:\n",
49
+ " super().__init__()\n",
50
+ " np.random.seed(0)\n",
51
+ " self.data = np.random.rand(10, 16000)\n",
52
+ " self.transform = None\n",
53
+ " self.target_transform = None\n",
54
+ "\n",
55
+ " def __getitem__(self, index):\n",
56
+ " sample = self.data[index]\n",
57
+ " label = 1\n",
58
+ " if sample.ndim==1:\n",
59
+ " sample = sample[None,...]\n",
60
+ " if self.transform is not None:\n",
61
+ " sample = self.transform(sample)\n",
62
+ " if self.target_transform is not None:\n",
63
+ " label = self.target_transform(label) \n",
64
+ "\n",
65
+ " return sample, label "
66
+ ]
67
+ },
68
+ {
69
+ "cell_type": "markdown",
70
+ "metadata": {},
71
+ "source": [
72
+ "### Initializing `Aug_DiskCachedDataset` with transforms"
73
+ ]
74
+ },
75
+ {
76
+ "cell_type": "code",
77
+ "execution_count": 2,
78
+ "metadata": {},
79
+ "outputs": [],
80
+ "source": [
81
+ "from tonic.cached_dataset import Aug_DiskCachedDataset, load_from_disk_cache\n",
82
+ "from tonic.audio_transforms import AmplitudeScale, FixLength\n",
83
+ "from tonic.audio_augmentations import RandomPitchShift\n",
84
+ "\n",
85
+ "all_transforms = {}\n",
86
+ "all_transforms[\"pre_aug\"] = [AmplitudeScale(max_amplitude = 0.150)]\n",
87
+ "all_transforms[\"augmentations\"] = [RandomPitchShift(samplerate=16000, caching=True)]\n",
88
+ "all_transforms[\"post_aug\"] = [FixLength(16000)]\n",
89
+ "\n",
90
+ "# number of copies is set to number of augmentation params (factors)\n",
91
+ "n = len(RandomPitchShift(samplerate=16000, caching=True).factors)\n",
92
+ "Aug_cach = Aug_DiskCachedDataset(dataset=mini_dataset(), cache_path='cache/', all_transforms = all_transforms, num_copies=n)"
93
+ ]
94
+ },
95
+ {
96
+ "cell_type": "markdown",
97
+ "metadata": {},
98
+ "source": [
99
+ "### Generating all copies of a data sample\n",
100
+ " - 10 augmented versions of data sample with index = 0 are generated"
101
+ ]
102
+ },
103
+ {
104
+ "cell_type": "code",
105
+ "execution_count": 3,
106
+ "metadata": {},
107
+ "outputs": [],
108
+ "source": [
109
+ "sample_index = 0\n",
110
+ "Aug_cach.generate_all(sample_index)"
111
+ ]
112
+ },
113
+ {
114
+ "cell_type": "markdown",
115
+ "metadata": {},
116
+ "source": [
117
+ "### To verify\n",
118
+ " - loading the saved copies \n",
119
+ " - and comparing them with the ones generated out of `Aug_DiskCacheDataset` with the same transforms and matching augmentation parameter \n",
120
+ " - they are equal\n"
121
+ ]
122
+ },
123
+ {
124
+ "cell_type": "code",
125
+ "execution_count": 7,
126
+ "metadata": {},
127
+ "outputs": [
128
+ {
129
+ "name": "stdout",
130
+ "output_type": "stream",
131
+ "text": [
132
+ "True\n",
133
+ "True\n",
134
+ "True\n",
135
+ "True\n",
136
+ "True\n",
137
+ "True\n",
138
+ "True\n",
139
+ "True\n",
140
+ "True\n",
141
+ "True\n"
142
+ ]
143
+ }
144
+ ],
145
+ "source": [
146
+ "from torchvision.transforms import Compose\n",
147
+ "\n",
148
+ "for i in range(n):\n",
149
+ " transform = Compose([AmplitudeScale(max_amplitude = 0.150),RandomPitchShift(samplerate=16000, caching=True, aug_index=i), FixLength(16000)])\n",
150
+ " ds = mini_dataset()\n",
151
+ " ds.transform = transform\n",
152
+ " sample = ds[sample_index][0]\n",
153
+ " data, targets = load_from_disk_cache('cache/' + '0_' + str(i) + '.hdf5' )\n",
154
+ " print((sample==data).all())\n"
155
+ ]
156
+ }
157
+ ],
158
+ "metadata": {
159
+ "kernelspec": {
160
+ "display_name": "py_310",
161
+ "language": "python",
162
+ "name": "python3"
163
+ },
164
+ "language_info": {
165
+ "codemirror_mode": {
166
+ "name": "ipython",
167
+ "version": 3
168
+ },
169
+ "file_extension": ".py",
170
+ "mimetype": "text/x-python",
171
+ "name": "python",
172
+ "nbconvert_exporter": "python",
173
+ "pygments_lexer": "ipython3",
174
+ "version": "3.10.2"
175
+ }
176
+ },
177
+ "nbformat": 4,
178
+ "nbformat_minor": 2
179
+ }
@@ -7,3 +7,4 @@ typing_extensions
7
7
  librosa
8
8
  pbr
9
9
  expelliarmus
10
+ typing-extensions
@@ -0,0 +1,66 @@
1
+ import os
2
+
3
+ import numpy as np
4
+
5
+ from tonic.audio_augmentations import RandomPitchShift
6
+ from tonic.audio_transforms import AmplitudeScale, FixLength
7
+ from tonic.cached_dataset import Aug_DiskCachedDataset, load_from_disk_cache
8
+
9
+
10
+ class mini_dataset:
11
+ def __init__(self) -> None:
12
+ np.random.seed(0)
13
+ self.data = np.random.rand(10, 16000)
14
+ self.transform = None
15
+ self.target_transform = None
16
+
17
+ def __getitem__(self, index):
18
+ sample = self.data[index]
19
+ label = 1
20
+ if sample.ndim == 1:
21
+ sample = sample[None, ...]
22
+ if self.transform is not None:
23
+ sample = self.transform(sample)
24
+ if self.target_transform is not None:
25
+ label = self.target_transform(label)
26
+
27
+ return sample, label
28
+
29
+
30
+ def test_aug_disk_caching():
31
+ from torchvision.transforms import Compose
32
+
33
+ all_transforms = {}
34
+ all_transforms["pre_aug"] = [AmplitudeScale(max_amplitude=0.150)]
35
+ all_transforms["augmentations"] = [RandomPitchShift(samplerate=16000, caching=True)]
36
+ all_transforms["post_aug"] = [FixLength(16000)]
37
+ # number of copies is set to number of augmentation params (factors)
38
+ n = len(RandomPitchShift(samplerate=16000, caching=True).factors)
39
+ Aug_cach = Aug_DiskCachedDataset(
40
+ dataset=mini_dataset(),
41
+ cache_path="cache/",
42
+ all_transforms=all_transforms,
43
+ num_copies=n,
44
+ )
45
+
46
+ if not os.path.isdir("cache/"):
47
+ os.mkdir("cache/")
48
+
49
+ sample_index = 0
50
+ Aug_cach.generate_all(sample_index)
51
+
52
+ for i in range(n):
53
+ transform = Compose(
54
+ [
55
+ AmplitudeScale(max_amplitude=0.150),
56
+ RandomPitchShift(samplerate=16000, caching=True, aug_index=i),
57
+ FixLength(16000),
58
+ ]
59
+ )
60
+ ds = mini_dataset()
61
+ ds.transform = transform
62
+ augmented_sample = ds[sample_index][0]
63
+ loaded_sample, targets = load_from_disk_cache(
64
+ "cache/" + "0_" + str(i) + ".hdf5"
65
+ )
66
+ assert (augmented_sample == loaded_sample).all()
@@ -1,7 +1,12 @@
1
1
  from pbr.version import VersionInfo
2
2
 
3
3
  from . import collation, datasets, io, slicers, transforms, utils
4
- from .cached_dataset import CachedDataset, DiskCachedDataset, MemoryCachedDataset
4
+ from .cached_dataset import (
5
+ Aug_DiskCachedDataset,
6
+ CachedDataset,
7
+ DiskCachedDataset,
8
+ MemoryCachedDataset,
9
+ )
5
10
  from .dataset import Dataset
6
11
  from .sliced_dataset import SlicedDataset
7
12
 
@@ -1,9 +1,17 @@
1
1
  import logging
2
2
  import os
3
+ import sys
4
+
5
+ if sys.version_info >= (3, 8):
6
+ from typing import Callable, Iterable, Optional, Tuple, TypedDict, Union
7
+ else:
8
+ from typing import Callable, Iterable, Optional, Tuple, Union
9
+ from typing_extensions import TypedDict
10
+
11
+ import random
3
12
  import shutil
4
13
  from dataclasses import dataclass, field
5
14
  from pathlib import Path
6
- from typing import Callable, Iterable, Optional, Tuple, Union
7
15
  from warnings import warn
8
16
 
9
17
  import h5py
@@ -227,6 +235,83 @@ def load_from_disk_cache(file_path: Union[str, Path]) -> Tuple:
227
235
  return data_list, target_list
228
236
 
229
237
 
238
+ @dataclass
239
+ class Aug_DiskCachedDataset(DiskCachedDataset):
240
+ """Aug_DiskCachedDataset is a child class from DiskCachedDataset with further customizations to
241
+ handle augmented copies of a sample. The goal of this customization is to map the indices of
242
+ cached files (copy) to augmentation parameters. This is useful in a category of augmentations
243
+ where the range of parameter is rather disceret and non probabilistic, for instance an audio
244
+ sample is being augmented with noise and SNR can take only N=5 values. Passing copy_index to
245
+ augmentation Class as an init argument ensures that each copy will be a a distinct augmented
246
+ sample with a trackable parameter.
247
+
248
+ 'generate_all' method generates all augmented vesions of a sample.
249
+ 'generate_copy' method generates the missing variant (augmented version)
250
+
251
+
252
+
253
+ Therefore all transforms applied to the dataset are categorized by the keys: "pre_aug", "augmentations"
254
+ and "post_aug".
255
+
256
+ Args:
257
+ 'all_transforms' is a dictionarty passed to this class containing information about all transforms.
258
+ """
259
+
260
+ all_transforms: Optional[TypedDict] = None
261
+
262
+ def __post_init__(self):
263
+ self.pre_aug = self.all_transforms["pre_aug"]
264
+ self.aug = self.all_transforms["augmentations"]
265
+ self.post_aug = self.all_transforms["post_aug"]
266
+
267
+ def generate_all(self, item):
268
+ for copy in range(0, self.num_copies):
269
+ file_path = os.path.join(self.cache_path, f"{item}_{copy}.hdf5")
270
+ try:
271
+ data, targets = load_from_disk_cache(file_path)
272
+ except (FileNotFoundError, OSError) as _:
273
+ self.generate_copy(item, copy)
274
+
275
+ def generate_copy(self, item, copy):
276
+ from torchvision.transforms import Compose
277
+
278
+ file_path = os.path.join(self.cache_path, f"{item}_{copy}.hdf5")
279
+ # copy index is passed to augmentation (callable)
280
+ self.aug[0].aug_index = copy
281
+ augmentation = self.aug
282
+ self.dataset.transform = Compose(self.pre_aug + augmentation + self.post_aug)
283
+ data, targets = self.dataset[item]
284
+ save_to_disk_cache(data, targets, file_path=file_path, compress=self.compress)
285
+
286
+ def __getitem__(self, item) -> Tuple[object, object]:
287
+ if self.dataset is None and item >= self.n_samples:
288
+ raise IndexError(f"This dataset only has {self.n_samples} items.")
289
+
290
+ copy = random.randint(0, self.num_copies - 1)
291
+ file_path = os.path.join(self.cache_path, f"{item}_{copy}.hdf5")
292
+ try:
293
+ data, targets = load_from_disk_cache(file_path)
294
+
295
+ except (FileNotFoundError, OSError) as _:
296
+ logging.info(
297
+ f"Data {item}: {file_path} not in cache, generating it now",
298
+ stacklevel=2,
299
+ )
300
+ self.generate_copy(item, copy)
301
+
302
+ # format might change during save to hdf5, i.e. tensors -> np arrays
303
+ # We load the sample here again to keep the output format consistent.
304
+ data, targets = load_from_disk_cache(file_path)
305
+
306
+ if self.transform is not None:
307
+ data = self.transform(data)
308
+ if self.target_transform is not None:
309
+ targets = self.target_transform(targets)
310
+ if self.transforms is not None:
311
+ data, targets = self.transforms(data, targets)
312
+ return data, targets
313
+
314
+
230
315
  class CachedDataset(DiskCachedDataset):
231
316
  """Deprecated class that points to DiskCachedDataset for now but will be removed in a future
232
317
  release.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tonic
3
- Version: 1.4.4.dev21
3
+ Version: 1.4.4.dev34
4
4
  Summary: Neuromorphic datasets and transformations.
5
5
  Home-page: UNKNOWN
6
6
  Author: The Neuromorphs of Telluride
@@ -77,6 +77,7 @@ docs/reading_material/intro-event-cameras.rst
77
77
  docs/reading_material/intro-snns.rst
78
78
  docs/reading_material/reading_material.rst
79
79
  docs/reading_material/training-snns.rst
80
+ docs/tutorials/Aug_DiskCachDataset.ipynb
80
81
  docs/tutorials/audio_transforms_tutorial.ipynb
81
82
  docs/tutorials/batching.ipynb
82
83
  docs/tutorials/davis_data.ipynb
@@ -89,6 +90,7 @@ test/prototype_dataset_utils.py
89
90
  test/requirements.txt
90
91
  test/test_audio_augmentations.py
91
92
  test/test_audio_transforms.py
93
+ test/test_aug_caching.py
92
94
  test/test_caching.py
93
95
  test/test_chained_transforms.py
94
96
  test/test_datasets.py
@@ -0,0 +1 @@
1
+ {"git_version": "d67aa25", "is_release": false}
@@ -7,3 +7,4 @@ typing_extensions
7
7
  librosa
8
8
  pbr
9
9
  expelliarmus
10
+ typing-extensions
@@ -1 +0,0 @@
1
- {"git_version": "5a20a54", "is_release": false}
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