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life
|
| 9 |
+
- citizen-science
|
| 10 |
+
- inaturalist
|
| 11 |
+
pretty_name: iNatSpectro Bioacoustics (Dev)
|
| 12 |
+
size_categories:
|
| 13 |
+
- n<1K
|
| 14 |
---
|
| 15 |
+
# iNatSpectro Bioacoustics
|
| 16 |
+
|
| 17 |
+
A community-contributed dataset of bioacoustic spectrograms derived from research-grade [iNaturalist](https://www.inaturalist.org) audio observations. Contributions are made via the [iNatSpectro](https://www.inatspectro.org) browser extension, which renders spectrograms directly in the browser and allows users to submit the underlying float data for ML training.
|
| 18 |
+
|
| 19 |
+
## Dataset description
|
| 20 |
+
|
| 21 |
+
Each entry in this dataset corresponds to one iNaturalist audio observation. The spectrogram was computed in-browser by iNatSpectro and the raw float data submitted alongside observation metadata. Entries may include a **strong label** (an annotated time/frequency bounding box identifying where a species call occurs) or a **weak label** (species is known to be present in the audio, but the exact location is not annotated).
|
| 22 |
+
|
| 23 |
+
The dataset is append-only. Each contribution is stored as a separate JSON file at `data/{observation_id}_{unix_timestamp_ms}.json`. Consumers should deduplicate on `observation_id` if they need one entry per observation, or keep all entries for ensemble annotation purposes.
|
| 24 |
+
|
| 25 |
+
## Dataset structure
|
| 26 |
+
|
| 27 |
+
Each file is a JSON object with the following fields:
|
| 28 |
+
|
| 29 |
+
| Field | Type | Description |
|
| 30 |
+
|---|---|---|
|
| 31 |
+
| `observation_id` | string | iNaturalist observation ID |
|
| 32 |
+
| `common_name` | string \| null | Common name of the observed species |
|
| 33 |
+
| `scientific_name` | string \| null | Scientific name |
|
| 34 |
+
| `iconic_taxon_name` | string \| null | Broad taxonomic group (e.g. `"Mammalia"`) |
|
| 35 |
+
| `audio_url` | string | Source audio URL on iNaturalist |
|
| 36 |
+
| `sample_rate` | number | Sample rate of the source audio in Hz |
|
| 37 |
+
| `duration` | number | Duration of the source audio in seconds |
|
| 38 |
+
| `profile` | string | iNatSpectro analysis profile used (e.g. `"Bat"`) |
|
| 39 |
+
| `nfft` | number \| null | FFT size used |
|
| 40 |
+
| `min_freq` | number | Lowest displayed frequency in Hz |
|
| 41 |
+
| `max_freq` | number | Highest displayed frequency in Hz |
|
| 42 |
+
| `scale_mode` | string | Frequency axis scale: `"mel"`, `"log"`, or `"linear"` |
|
| 43 |
+
| `dyn_min` | number | Normalisation floor in dB |
|
| 44 |
+
| `dyn_max` | number | Normalisation ceiling in dB |
|
| 45 |
+
| `spec_columns` | number | Number of time columns (always 256) |
|
| 46 |
+
| `spec_bins` | number | Number of frequency bins (always 128) |
|
| 47 |
+
| `spec_data` | number[] | 32,768 floats — the spectrogram (see below) |
|
| 48 |
+
| `annotation` | object \| null | Bounding box for the species call (see below) |
|
| 49 |
+
| `inat_username` | string \| null | Contributor's iNaturalist username (opt-in) |
|
| 50 |
+
| `contributed_at` | string | ISO 8601 timestamp of contribution |
|
| 51 |
+
|
| 52 |
+
### `spec_data` layout
|
| 53 |
+
`spec_data` is a flattened 1D array of 32,768 raw FFT magnitude values in dB, stored in **column-major order** (time × frequency):
|
| 54 |
+
|
| 55 |
+
- 256 time columns × 128 frequency bins
|
| 56 |
+
- Index into the array: `i = col * 128 + bin`
|
| 57 |
+
- Frequency axis: bin `0` = `max_freq` (highest), bin `127` = `min_freq` (lowest)
|
| 58 |
+
- Values are on a dB scale. Use `dyn_min` and `dyn_max` to normalise to [0, 1] if needed
|
| 59 |
+
|
| 60 |
+
**Reconstruct as a 2D array (Python):**
|
| 61 |
+
```python
|
| 62 |
+
import numpy as np
|
| 63 |
+
spec = np.array(entry["spec_data"]).reshape(256, 128) # shape: (time, freq)
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
**Normalise to [0, 1]:**
|
| 67 |
+
```python
|
| 68 |
+
spec_norm = (spec - entry["dyn_min"]) / (entry["dyn_max"] - entry["dyn_min"])
|
| 69 |
+
spec_norm = np.clip(spec_norm, 0, 1)
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
### `annotation` field
|
| 73 |
+
|
| 74 |
+
`null` indicates a **weak label** — the species is confirmed present somewhere in the audio but the exact location is unknown.
|
| 75 |
+
|
| 76 |
+
When present, `annotation` is a **strong label** giving the time/frequency bounding box of the species call:
|
| 77 |
+
|
| 78 |
+
```json
|
| 79 |
+
{
|
| 80 |
+
"time_start": 1.2,
|
| 81 |
+
"time_end": 2.8,
|
| 82 |
+
"freq_low": 15000,
|
| 83 |
+
"freq_high": 80000
|
| 84 |
+
}
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
All values are in seconds (time) or Hz (frequency).
|
| 88 |
+
|
| 89 |
+
## Source data
|
| 90 |
+
|
| 91 |
+
Observations are sourced from [iNaturalist](https://www.inaturalist.org), a global citizen science platform. Only **research-grade** observations are eligible for contribution — these have community consensus on species identification.
|
| 92 |
+
|
| 93 |
+
Audio files remain hosted on iNaturalist and are referenced by `audio_url`. The spectrogram float data was computed locally in the contributor's browser using [iNatSpectro](https://www.inatspectro.org).
|
| 94 |
+
|
| 95 |
+
## How to use
|
| 96 |
+
|
| 97 |
+
```python
|
| 98 |
+
import json
|
| 99 |
+
from pathlib import Path
|
| 100 |
+
from huggingface_hub import snapshot_download
|
| 101 |
+
import numpy as np
|
| 102 |
+
# Download the dataset
|
| 103 |
+
repo_path = snapshot_download(repo_id="japht/inatspectro-bioacoustics", repo_type="dataset")
|
| 104 |
+
entries = []
|
| 105 |
+
for f in Path(repo_path, "data").glob("*.json"):
|
| 106 |
+
entries.append(json.loads(f.read_text()))
|
| 107 |
+
# Example: load a spectrogram
|
| 108 |
+
entry = entries[0]
|
| 109 |
+
spec = np.array(entry["spec_data"]).reshape(256, 128) # (time, freq)
|
| 110 |
+
spec_norm = np.clip(
|
| 111 |
+
(spec - entry["dyn_min"]) / (entry["dyn_max"] - entry["dyn_min"]),
|
| 112 |
+
0, 1
|
| 113 |
+
)
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
**Deduplicate by observation (keep latest contribution per observation):**
|
| 117 |
+
```python
|
| 118 |
+
from collections import defaultdict
|
| 119 |
+
by_obs = defaultdict(list)
|
| 120 |
+
for e in entries:
|
| 121 |
+
by_obs[e["observation_id"]].append(e)
|
| 122 |
+
deduped = [
|
| 123 |
+
sorted(v, key=lambda x: x["contributed_at"])[-1]
|
| 124 |
+
for v in by_obs.values()
|
| 125 |
+
]
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
**Filter to strong labels only:**
|
| 129 |
+
```python
|
| 130 |
+
strong = [e for e in entries if e["annotation"] is not None]
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
## License
|
| 134 |
+
|
| 135 |
+
This dataset is released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Source audio observations on iNaturalist are subject to their individual observation licenses as set by their authors. Spectrogram float data and metadata in this dataset are contributed under CC BY 4.0 by iNatSpectro users.
|
| 136 |
+
|
| 137 |
+
## Contributing
|
| 138 |
+
|
| 139 |
+
Contributions are made via the [iNatSpectro](https://www.inatspectro.org) browser extension. Open any research-grade iNaturalist observation with audio, render the spectrogram, and click **Contribute** to submit.
|