Upload SkyScenes.py
Browse files- SkyScenes.py +113 -0
SkyScenes.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import collections
|
| 2 |
+
import json
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
import datasets
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
# _HOMEPAGE = "
|
| 9 |
+
# _LICENSE = "CC BY 4.0"
|
| 10 |
+
# _CITATION = """\
|
| 11 |
+
# @misc{ buildings-instance-segmentation_dataset,
|
| 12 |
+
# title = { Buildings Instance Segmentation Dataset },
|
| 13 |
+
# type = { Open Source Dataset },
|
| 14 |
+
# author = { Roboflow Universe Projects },
|
| 15 |
+
# howpublished = { \\url{ https://universe.roboflow.com/roboflow-universe-projects/buildings-instance-segmentation } },
|
| 16 |
+
# url = { https://universe.roboflow.com/roboflow-universe-projects/buildings-instance-segmentation },
|
| 17 |
+
# journal = { Roboflow Universe },
|
| 18 |
+
# publisher = { Roboflow },
|
| 19 |
+
# year = { 2023 },
|
| 20 |
+
# month = { jan },
|
| 21 |
+
# note = { visited on 2023-01-18 },
|
| 22 |
+
# }
|
| 23 |
+
# """
|
| 24 |
+
# _CATEGORIES = ['building']
|
| 25 |
+
# _ANNOTATION_FILENAME = "_annotations.coco.json"
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class SKYSCENESConfig(datasets.BuilderConfig):
|
| 29 |
+
"""Builder Config for satellite-building-segmentation"""
|
| 30 |
+
|
| 31 |
+
def __init__(self, data_urls, **kwargs):
|
| 32 |
+
"""
|
| 33 |
+
BuilderConfig for satellite-building-segmentation.
|
| 34 |
+
Args:
|
| 35 |
+
data_urls: `dict`, name to url to download the zip file from.
|
| 36 |
+
**kwargs: keyword arguments forwarded to super.
|
| 37 |
+
"""
|
| 38 |
+
super(SKYSCENESConfig, self).__init__(version=datasets.Version("1.0.0"), **kwargs)
|
| 39 |
+
self.data_urls = data_urls
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class SKYSCENES(datasets.GeneratorBasedBuilder):
|
| 43 |
+
"""satellite-building-segmentation instance segmentation dataset"""
|
| 44 |
+
|
| 45 |
+
VERSION = datasets.Version("1.0.0")
|
| 46 |
+
BUILDER_CONFIGS = [
|
| 47 |
+
SKYSCENESConfig(
|
| 48 |
+
name="full",
|
| 49 |
+
description="Full version of skyscenes dataset.",
|
| 50 |
+
data_urls={
|
| 51 |
+
"Images": "https://huggingface.co/datasets/hoffman-lab/SkyScenes/blob/main/Images/H_15_P_0/ClearNight/Town01.tar.gz",
|
| 52 |
+
"Segment": "https://huggingface.co/datasets/hoffman-lab/SkyScenes/blob/main/Images/H_15_P_0/ClearNight/Town02.tar.gz",
|
| 53 |
+
"Depth": "https://huggingface.co/datasets/hoffman-lab/SkyScenes/blob/main/Images/H_15_P_0/ClearNight/Town03.tar.gz",
|
| 54 |
+
},
|
| 55 |
+
),
|
| 56 |
+
SATELLITEBUILDINGSEGMENTATIONConfig(
|
| 57 |
+
name="mini",
|
| 58 |
+
description="Mini version of satellite-building-segmentation dataset.",
|
| 59 |
+
data_urls={
|
| 60 |
+
"Images": "https://huggingface.co/datasets/hoffman-lab/SkyScenes/blob/main/Images/H_15_P_0/ClearNight/Town01.tar.gz",
|
| 61 |
+
"Segment": "https://huggingface.co/datasets/hoffman-lab/SkyScenes/blob/main/Images/H_15_P_0/ClearNight/Town02.tar.gz",
|
| 62 |
+
"Depth": "https://huggingface.co/datasets/hoffman-lab/SkyScenes/blob/main/Images/H_15_P_0/ClearNight/Town03.tar.gz",
|
| 63 |
+
},
|
| 64 |
+
)
|
| 65 |
+
]
|
| 66 |
+
|
| 67 |
+
# def _info(self):
|
| 68 |
+
# features = datasets.Features(
|
| 69 |
+
# {
|
| 70 |
+
# "image_id": datasets.Value("int64"),
|
| 71 |
+
# "image": datasets.Image(),
|
| 72 |
+
# "width": datasets.Value("int32"),
|
| 73 |
+
# "height": datasets.Value("int32"),
|
| 74 |
+
# "objects": datasets.Sequence(
|
| 75 |
+
# {
|
| 76 |
+
# "id": datasets.Value("int64"),
|
| 77 |
+
# "area": datasets.Value("int64"),
|
| 78 |
+
# "bbox": datasets.Sequence(datasets.Value("float32"), length=4),
|
| 79 |
+
# "segmentation": datasets.Sequence(datasets.Sequence(datasets.Value("float32"))),
|
| 80 |
+
# "category": datasets.ClassLabel(names=_CATEGORIES),
|
| 81 |
+
# }
|
| 82 |
+
# ),
|
| 83 |
+
# }
|
| 84 |
+
# )
|
| 85 |
+
# return datasets.DatasetInfo(
|
| 86 |
+
# features=features,
|
| 87 |
+
# homepage=_HOMEPAGE,
|
| 88 |
+
# citation=_CITATION,
|
| 89 |
+
# license=_LICENSE,
|
| 90 |
+
# )
|
| 91 |
+
|
| 92 |
+
def _split_generators(self, dl_manager):
|
| 93 |
+
data_files = dl_manager.download_and_extract(self.config.data_urls)
|
| 94 |
+
return [
|
| 95 |
+
datasets.SplitGenerator(
|
| 96 |
+
name=datasets.Split.IMAGES,
|
| 97 |
+
gen_kwargs={
|
| 98 |
+
"folder_dir": data_files["Images"],
|
| 99 |
+
},
|
| 100 |
+
),
|
| 101 |
+
datasets.SplitGenerator(
|
| 102 |
+
name=datasets.Split.SEGMENT,
|
| 103 |
+
gen_kwargs={
|
| 104 |
+
"folder_dir": data_files["Segment"],
|
| 105 |
+
},
|
| 106 |
+
),
|
| 107 |
+
datasets.SplitGenerator(
|
| 108 |
+
name=datasets.Split.DEPTH,
|
| 109 |
+
gen_kwargs={
|
| 110 |
+
"folder_dir": data_files["Depth"],
|
| 111 |
+
},
|
| 112 |
+
),
|
| 113 |
+
]
|