Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -85,23 +85,35 @@ Each sample contains:
|
|
| 85 |
| `test_section3` | 2300 – 3449 | 1,150 |
|
| 86 |
## Usage
|
| 87 |
```python
|
| 88 |
-
from datasets import load_dataset
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
#
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
## Citation
|
| 106 |
Please cite this publication if you use this partitioned version of the dataset.
|
| 107 |
```bibtex
|
|
|
|
| 85 |
| `test_section3` | 2300 – 3449 | 1,150 |
|
| 86 |
## Usage
|
| 87 |
```python
|
| 88 |
+
from datasets import load_dataset, Value
|
| 89 |
+
|
| 90 |
+
ds = load_dataset("fansel/nordland")
|
| 91 |
+
|
| 92 |
+
# season and section are stored as ClassLabel
|
| 93 |
+
# Cast them to plain strings once for natural filtering:
|
| 94 |
+
ds = (ds
|
| 95 |
+
.cast_column("season", Value("string"))
|
| 96 |
+
.cast_column("section", Value("string")))
|
| 97 |
+
|
| 98 |
+
# Access splits
|
| 99 |
+
train, test = ds["train"], ds["test"]
|
| 100 |
+
|
| 101 |
+
# Filter by season
|
| 102 |
+
winter_test = test.filter(lambda x: x["season"] == "winter")
|
| 103 |
+
|
| 104 |
+
# Filter train section 1, all seasons
|
| 105 |
+
train_section1 = train.filter(lambda x: x["section"] == "train_section1")
|
| 106 |
+
|
| 107 |
+
# Filter test section 2, season fall
|
| 108 |
+
test_s2_fall = test.filter(
|
| 109 |
+
lambda x: x["section"] == "test_section2" and x["season"] == "fall"
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
+
# Cross-season matching: same frame_id across seasons
|
| 113 |
+
same_location = test.filter(lambda x: x["frame_id"] == 42)
|
| 114 |
+
for sample in same_location:
|
| 115 |
+
print(sample["season"], sample["section"])
|
| 116 |
+
```
|
| 117 |
## Citation
|
| 118 |
Please cite this publication if you use this partitioned version of the dataset.
|
| 119 |
```bibtex
|