Update README.md
Browse files
README.md
CHANGED
|
@@ -112,20 +112,19 @@ import datasets as ds
|
|
| 112 |
import PIL.Image as Image
|
| 113 |
import io
|
| 114 |
|
| 115 |
-
#
|
| 116 |
-
|
| 117 |
|
| 118 |
# streaming only the evaluation set
|
| 119 |
commfor_eval_stream = ds.load_dataset("OwensLab/CommunityForensics", split='PublicEval', streaming=True)
|
| 120 |
|
| 121 |
-
# streaming only 10% of training data. Note that this does not contain the full set of models!
|
| 122 |
-
commfor_train_stream_10p = ds.load_dataset("OwensLab/CommunityForensics", split='Systematic[:10%]+Manual[:10%]', streaming=True)
|
| 123 |
-
|
| 124 |
# optionally shuffle the streaming dataset
|
| 125 |
-
|
| 126 |
|
| 127 |
# usage example
|
| 128 |
-
for i, data in enumerate(
|
|
|
|
|
|
|
| 129 |
img, label = Image.open(io.BytesIO(data['image_data'])), data['label']
|
| 130 |
## Your operations here ##
|
| 131 |
# e.g., img_torch = torchvision.transforms.functional.pil_to_tensor(img)
|
|
|
|
| 112 |
import PIL.Image as Image
|
| 113 |
import io
|
| 114 |
|
| 115 |
+
# steaming only the systematic set. Note that when streaming, you can only load specific splits
|
| 116 |
+
commfor_sys_stream = ds.load_dataset("OwensLab/CommunityForensics", split='Systematic', streaming=True)
|
| 117 |
|
| 118 |
# streaming only the evaluation set
|
| 119 |
commfor_eval_stream = ds.load_dataset("OwensLab/CommunityForensics", split='PublicEval', streaming=True)
|
| 120 |
|
|
|
|
|
|
|
|
|
|
| 121 |
# optionally shuffle the streaming dataset
|
| 122 |
+
commfor_sys_stream = commfor_sys_stream.shuffle(seed=123, buffer_size=3000)
|
| 123 |
|
| 124 |
# usage example
|
| 125 |
+
for i, data in enumerate(commfor_sys_stream):
|
| 126 |
+
if i>=10000: # use only first 10000 samples
|
| 127 |
+
break
|
| 128 |
img, label = Image.open(io.BytesIO(data['image_data'])), data['label']
|
| 129 |
## Your operations here ##
|
| 130 |
# e.g., img_torch = torchvision.transforms.functional.pil_to_tensor(img)
|