fansel commited on
Commit
c6b8dd9
·
verified ·
1 Parent(s): 8acac2d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -17
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
- ds = load_dataset("fansel/nordland")
90
- # Access a specific split
91
- train = ds["train"]
92
- test = ds["test"]
93
- # Filter by season
94
- winter_test = ds["test"].filter(lambda x: x["season"] == "winter")
95
- # Filter train section 1 (all seasons)
96
- train_section1 = ds["train"].filter(lambda x: x["section"] == "train_section1")
97
- # Filter test section 2 for a specific season
98
- test_s2_fall = ds["test"].filter(lambda x: x["section"] == "test_section2" and x["season"] == "fall")
99
- # Cross-season matching: get the same location in all four seasons
100
- frame = 42
101
- same_location = ds["test"].filter(lambda x: x["frame_id"] == frame)
102
- for sample in same_location:
103
- print(sample["season"], sample["section"]) # e.g. "fall", "test_section1"
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