@@ -104,7 +104,7 @@ dataset to use should be based on the dataset's size as well as its intended pur
104
104
105
105
## Sources
106
106
107
- For now, there is only one dataset source available with Burn, but more to come!
107
+ For now, there are only a couple of dataset sources available with Burn, but more to come!
108
108
109
109
### Hugging Face
110
110
@@ -131,6 +131,55 @@ fn main() {
131
131
We see that items must derive ` serde::Serialize ` , ` serde::Deserialize ` , ` Clone ` , and ` Debug ` , but
132
132
those are the only requirements.
133
133
134
+ ### Images
135
+
136
+ ` ImageFolderDataset ` is a generic vision dataset used to load images from disk. It is currently
137
+ available for multi-class and multi-label classification tasks.
138
+
139
+ ``` rust, ignore
140
+ // Create an image classification dataset from the root folder,
141
+ // where images for each class are stored in their respective folder.
142
+ //
143
+ // For example:
144
+ // root/dog/dog1.png
145
+ // root/dog/dog2.png
146
+ // ...
147
+ // root/cat/cat1.png
148
+ let dataset = ImageFolderDataset::new_classification("path/to/dataset/root").unwrap();
149
+ ```
150
+
151
+ ``` rust, ignore
152
+ // Create a multi-label image classification dataset from a list of items,
153
+ // where each item is a tuple `(image path, labels)`, and a list of classes
154
+ // in the dataset.
155
+ //
156
+ // For example:
157
+ let items = vec![
158
+ ("root/dog/dog1.png", vec!["animal".to_string(), "dog".to_string()]),
159
+ ("root/cat/cat1.png", vec!["animal".to_string(), "cat".to_string()]),
160
+ ];
161
+ let dataset = ImageFolderDataset::new_multilabel_classification_with_items(
162
+ items,
163
+ &["animal", "cat", "dog"],
164
+ )
165
+ .unwrap();
166
+ ```
167
+
168
+ ### Comma-Separated Values (CSV)
169
+
170
+ Loading records from a simple CSV file in-memory is simple with the ` InMemDataset ` :
171
+
172
+ ``` rust, ignore
173
+ // Build dataset from csv with tab ('\t') delimiter.
174
+ // The reader can be configured for your particular file.
175
+ let mut rdr = csv::ReaderBuilder::new();
176
+ let rdr = rdr.delimiter(b'\t');
177
+
178
+ let dataset = InMemDataset::from_csv("path/to/csv", rdr).unwrap();
179
+ ```
180
+
181
+ Note that this requires the ` csv ` crate.
182
+
134
183
** What about streaming datasets?**
135
184
136
185
There is no streaming dataset API with Burn, and this is by design! The learner struct will iterate
0 commit comments