Skip to content

Commit

Permalink
SpaceNet2 update (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashnair1 authored and adamjstewart committed Mar 19, 2022
1 parent 798e911 commit a54fabf
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 31 deletions.
Binary file modified tests/data/spacenet/sn2_AOI_2_Vegas.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/datasets/test_spacenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def dataset(
radiant_mlhub = pytest.importorskip("radiant_mlhub", minversion="0.2.1")
monkeypatch.setattr(radiant_mlhub.Collection, "fetch", fetch_collection)
test_md5 = {
"sn2_AOI_2_Vegas": "b3236f58604a9d746c4e09b3e487e427",
"sn2_AOI_2_Vegas": "6ceae7ff8c557346e8a4c8b6c61cc1b9",
"sn2_AOI_3_Paris": "811e6a26fdeb8be445fed99769fa52c5",
"sn2_AOI_4_Shanghai": "139d1627d184c74426a85ad0222f7355",
"sn2_AOI_5_Khartoum": "435535120414b74165aa87f051c3a2b3",
Expand Down
31 changes: 1 addition & 30 deletions torchgeo/datasets/spacenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ class SpaceNet2(SpaceNet):

dataset_id = "spacenet2"
collection_md5_dict = {
"sn2_AOI_2_Vegas": "cdc5df70920adca870a9fd0dfc4cca26",
"sn2_AOI_2_Vegas": "a5a8de355290783b88ac4d69c7ef0694",
"sn2_AOI_3_Paris": "8299186b7bbfb9a256d515bad1b7f146",
"sn2_AOI_4_Shanghai": "4e3e80f2f437faca10ca2e6e6df0ef99",
"sn2_AOI_5_Khartoum": "8070ff9050f94cd9f0efe9417205d7c3",
Expand Down Expand Up @@ -553,35 +553,6 @@ def __init__(
root, image, collections, transforms, download, api_key, checksum
)

# TODO: Remove this once radiantearth/radiant-mlhub#65 is fixed
def _load_files(self, root: str) -> List[Dict[str, str]]:
"""Return the paths of the files in the dataset.
Args:
root: root dir of dataset
Returns:
list of dicts containing paths for each pair of image and label
"""
files = []
pat = re.compile("img1" + re.escape(os.sep))
for collection in self.collections:
images = glob.glob(os.path.join(root, collection, "*", self.filename))
images = sorted(images)
for imgpath in images:
if collection == "sn2_AOI_2_Vegas" and pat.search(imgpath):
lbl_path = os.path.join(
os.path.dirname(os.path.dirname(imgpath)),
"_common",
"labels.geojson",
)
else:
lbl_path = os.path.join(
os.path.dirname(imgpath) + "-labels", self.label_glob
)
files.append({"image_path": imgpath, "label_path": lbl_path})
return files


class SpaceNet4(SpaceNet):
"""SpaceNet 4: Off-Nadir Buildings Dataset.
Expand Down

0 comments on commit a54fabf

Please sign in to comment.