forked from microsoft/torchgeo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NASA Marine Debris: radiant mlhub -> source coop (microsoft#2183)
- Loading branch information
1 parent
f6a49b8
commit 900e8a1
Showing
23 changed files
with
102 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
import os | ||
|
||
import numpy as np | ||
import rasterio as rio | ||
from rasterio import Affine | ||
from rasterio.crs import CRS | ||
|
||
SIZE = 32 | ||
DTYPE = np.uint8 | ||
|
||
np.random.seed(0) | ||
|
||
profile = { | ||
'driver': 'GTiff', | ||
'dtype': DTYPE, | ||
'width': SIZE, | ||
'height': SIZE, | ||
'count': 3, | ||
'crs': CRS.from_epsg(4326), | ||
'transform': Affine( | ||
2.1457672119140625e-05, | ||
0.0, | ||
-87.626953125, | ||
0.0, | ||
-2.0629065249348766e-05, | ||
15.977172621632805, | ||
), | ||
} | ||
|
||
os.makedirs('source', exist_ok=True) | ||
os.makedirs('labels', exist_ok=True) | ||
|
||
files = [ | ||
'20160928_153233_0e16_16816-29821-16', | ||
'20160928_153233_0e16_16816-29824-16', | ||
'20160928_153233_0e16_16816-29825-16', | ||
'20160928_153233_0e16_16816-29828-16', | ||
'20160928_153233_0e16_16816-29829-16', | ||
] | ||
for file in files: | ||
with rio.open(os.path.join('source', f'{file}.tif'), 'w', **profile) as f: | ||
for i in range(1, 4): | ||
Z = np.random.randint(np.iinfo(DTYPE).max, size=(SIZE, SIZE), dtype=DTYPE) | ||
f.write(Z, i) | ||
|
||
count = np.random.randint(5) | ||
x = np.random.randint(SIZE, size=count) | ||
y = np.random.randint(SIZE, size=count) | ||
dx = np.random.randint(5, size=count) | ||
dy = np.random.randint(5, size=count) | ||
label = np.ones(count) | ||
Z = np.stack([x, y, x + dx, y + dy, label], axis=-1) | ||
np.save(os.path.join('labels', f'{file}.npy'), Z) |
Binary file added
BIN
+288 Bytes
tests/data/nasa_marine_debris/labels/20160928_153233_0e16_16816-29821-16.npy
Binary file not shown.
Binary file added
BIN
+208 Bytes
tests/data/nasa_marine_debris/labels/20160928_153233_0e16_16816-29824-16.npy
Binary file not shown.
Binary file added
BIN
+208 Bytes
tests/data/nasa_marine_debris/labels/20160928_153233_0e16_16816-29825-16.npy
Binary file not shown.
Binary file added
BIN
+128 Bytes
tests/data/nasa_marine_debris/labels/20160928_153233_0e16_16816-29828-16.npy
Binary file not shown.
Binary file added
BIN
+208 Bytes
tests/data/nasa_marine_debris/labels/20160928_153233_0e16_16816-29829-16.npy
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-208 Bytes
...ris_labels/nasa_marine_debris_labels_20160928_153233_0e16_16816-29821-16/pixel_bounds.npy
Binary file not shown.
Binary file removed
BIN
-208 Bytes
...ris_labels/nasa_marine_debris_labels_20160928_153233_0e16_16816-29824-16/pixel_bounds.npy
Binary file not shown.
Binary file removed
BIN
-168 Bytes
...ris_labels/nasa_marine_debris_labels_20160928_153233_0e16_16816-29825-16/pixel_bounds.npy
Binary file not shown.
Binary file removed
BIN
-208 Bytes
...ris_labels/nasa_marine_debris_labels_20160928_153233_0e16_16816-29828-16/pixel_bounds.npy
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-1.69 KB
...is_source/nasa_marine_debris_source_20160928_153233_0e16_16816-29821-16/image_geotiff.tif
Binary file not shown.
Binary file removed
BIN
-1.69 KB
...is_source/nasa_marine_debris_source_20160928_153233_0e16_16816-29824-16/image_geotiff.tif
Binary file not shown.
Binary file removed
BIN
-1.69 KB
...is_source/nasa_marine_debris_source_20160928_153233_0e16_16816-29825-16/image_geotiff.tif
Binary file not shown.
Binary file removed
BIN
-1.69 KB
...is_source/nasa_marine_debris_source_20160928_153233_0e16_16816-29828-16/image_geotiff.tif
Binary file not shown.
Binary file added
BIN
+3.37 KB
tests/data/nasa_marine_debris/source/20160928_153233_0e16_16816-29821-16.tif
Binary file not shown.
Binary file added
BIN
+3.37 KB
tests/data/nasa_marine_debris/source/20160928_153233_0e16_16816-29824-16.tif
Binary file not shown.
Binary file added
BIN
+3.37 KB
tests/data/nasa_marine_debris/source/20160928_153233_0e16_16816-29825-16.tif
Binary file not shown.
Binary file added
BIN
+3.37 KB
tests/data/nasa_marine_debris/source/20160928_153233_0e16_16816-29828-16.tif
Binary file not shown.
Binary file added
BIN
+3.37 KB
tests/data/nasa_marine_debris/source/20160928_153233_0e16_16816-29829-16.tif
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters