frgfm
commited on
Commit
·
6555ae7
1
Parent(s):
682d42e
feat: Added dataset info files
Browse files- dataset_infos.json +60 -0
- openfire.py +85 -0
dataset_infos.json
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"default": {
|
3 |
+
"description": "OpenFire is an image classification dataset for wildfire detection, collected\n from web searches.",
|
4 |
+
"citation": "@software{Pyronear_PyroVision_2019,\ntitle={Pyrovision: wildfire early detection},\nauthor={Pyronear contributors},\nyear={2019},\nmonth={October},\npublisher = {GitHub},\nhowpublished = {\\url{https://github.com/pyronear/pyro-vision}}\n}\n",
|
5 |
+
"homepage": "https://pyronear.org/pyro-vision/datasets.html#openfire",
|
6 |
+
"license": "Apache License 2.0",
|
7 |
+
"features": {
|
8 |
+
"image_url": {
|
9 |
+
"dtype": "string",
|
10 |
+
"id": null,
|
11 |
+
"_type": "Value"
|
12 |
+
},
|
13 |
+
"is_wildfire": {
|
14 |
+
"dtype": "bool",
|
15 |
+
"id": null,
|
16 |
+
"_type": "Value"
|
17 |
+
},
|
18 |
+
},
|
19 |
+
"post_processed": null,
|
20 |
+
"supervised_keys": null,
|
21 |
+
"task_templates": null,
|
22 |
+
"builder_name": "openfire",
|
23 |
+
"config_name": "default",
|
24 |
+
"version": {
|
25 |
+
"version_str": "1.0.0",
|
26 |
+
"description": null,
|
27 |
+
"major": 1,
|
28 |
+
"minor": 0,
|
29 |
+
"patch": 0
|
30 |
+
},
|
31 |
+
"splits": {
|
32 |
+
"train": {
|
33 |
+
"name": "train",
|
34 |
+
"num_bytes": 792971,
|
35 |
+
"num_examples": 7143,
|
36 |
+
"dataset_name": "openfire"
|
37 |
+
},
|
38 |
+
"validation": {
|
39 |
+
"name": "validation",
|
40 |
+
"num_bytes": 88419,
|
41 |
+
"num_examples": 792,
|
42 |
+
"dataset_name": "openfire"
|
43 |
+
}
|
44 |
+
},
|
45 |
+
"download_checksums": {
|
46 |
+
"https://huggingface.co/datasets/pyronear/openfire/resolve/main/data/openfire_train.json": {
|
47 |
+
"num_bytes": 792971,
|
48 |
+
"checksum": "d912c0b4c4fb89f482c1ad8e4b47c79202efbeedc832a29f779944afd17118be"
|
49 |
+
},
|
50 |
+
"https://huggingface.co/datasets/pyronear/openfire/resolve/main/data/openfire_val.json": {
|
51 |
+
"num_bytes": 88419,
|
52 |
+
"checksum": "31235919c7ed278731f6511eae42c7d27756a88e86a9b32d7b1ff105dc31097d"
|
53 |
+
},
|
54 |
+
},
|
55 |
+
"download_size": 821390,
|
56 |
+
"post_processing_size": null,
|
57 |
+
"dataset_size": 821390,
|
58 |
+
"size_in_bytes": 821390
|
59 |
+
}
|
60 |
+
}
|
openfire.py
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2022, Pyronear.
|
2 |
+
|
3 |
+
# This program is licensed under the Apache License 2.0.
|
4 |
+
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
|
5 |
+
|
6 |
+
"""OpenFire dataset."""
|
7 |
+
|
8 |
+
import os
|
9 |
+
import json
|
10 |
+
|
11 |
+
import datasets
|
12 |
+
|
13 |
+
|
14 |
+
_HOMEPAGE = "https://pyronear.org/pyro-vision/datasets.html#openfire"
|
15 |
+
|
16 |
+
_LICENSE = "Apache License 2.0"
|
17 |
+
|
18 |
+
_CITATION = """\
|
19 |
+
@software{Pyronear_PyroVision_2019,
|
20 |
+
title={Pyrovision: wildfire early detection},
|
21 |
+
author={Pyronear contributors},
|
22 |
+
year={2019},
|
23 |
+
month={October},
|
24 |
+
publisher = {GitHub},
|
25 |
+
howpublished = {\url{https://github.com/pyronear/pyro-vision}}
|
26 |
+
}
|
27 |
+
"""
|
28 |
+
|
29 |
+
_DESCRIPTION = """\
|
30 |
+
OpenFire is an image classification dataset for wildfire detection, collected
|
31 |
+
from web searches.
|
32 |
+
"""
|
33 |
+
|
34 |
+
|
35 |
+
_REPO = "https://huggingface.co/datasets/pyronear/openfire/resolve/main/data"
|
36 |
+
_URLS = {
|
37 |
+
"train": f"{_REPO}/openfire_train.json",
|
38 |
+
"validation": f"{_REPO}/openfire_val.json",
|
39 |
+
}
|
40 |
+
|
41 |
+
|
42 |
+
class OpenFire(datasets.GeneratorBasedBuilder):
|
43 |
+
"""OpenFire dataset."""
|
44 |
+
|
45 |
+
VERSION = datasets.Version("1.0.0")
|
46 |
+
|
47 |
+
def _info(self):
|
48 |
+
return datasets.DatasetInfo(
|
49 |
+
description=_DESCRIPTION,
|
50 |
+
features=datasets.Features(
|
51 |
+
{
|
52 |
+
"image_url": datasets.Value("string", id=None),
|
53 |
+
"is_wildfire": datasets.Value("bool"),
|
54 |
+
}
|
55 |
+
),
|
56 |
+
supervised_keys=None,
|
57 |
+
homepage=_HOMEPAGE,
|
58 |
+
license=_LICENSE,
|
59 |
+
citation=_CITATION,
|
60 |
+
)
|
61 |
+
|
62 |
+
def _split_generators(self, dl_manager):
|
63 |
+
data_dir = dl_manager.download_and_extract(_URLS)
|
64 |
+
return [
|
65 |
+
datasets.SplitGenerator(
|
66 |
+
name=datasets.Split.TRAIN,
|
67 |
+
gen_kwargs={
|
68 |
+
"annot_file": data_dir["train"],
|
69 |
+
},
|
70 |
+
),
|
71 |
+
datasets.SplitGenerator(
|
72 |
+
name=datasets.Split.VALIDATION,
|
73 |
+
gen_kwargs={
|
74 |
+
"annot_file": data_dir["validation"],
|
75 |
+
},
|
76 |
+
),
|
77 |
+
]
|
78 |
+
|
79 |
+
def _generate_examples(self, annot_file):
|
80 |
+
with open(annot_file, "rb") as f:
|
81 |
+
urls = json.load(f)
|
82 |
+
for label in range(2):
|
83 |
+
for url in urls[str(label)]:
|
84 |
+
yield idx, {"image_url": url, "is_wildfire": bool(label)}
|
85 |
+
idx += 1
|