Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding OSCD dataset #233

Merged
merged 77 commits into from
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
ca10f26
OSCD: initial template
iejMac Nov 10, 2021
a5f7b2f
updating download pattern
iejMac Nov 10, 2021
6a382a1
package: including OSCD in torchgeo.datasets
iejMac Nov 10, 2021
4c5996b
download: adapting download method to OSCD dataset + adding simple te…
iejMac Nov 10, 2021
3ef976f
_load_files method: temporary implementation
iejMac Nov 10, 2021
bfb73ef
OCSD: minimum working example, needs plenty improvement
iejMac Nov 10, 2021
0430b13
adding OSCD to docs
iejMac Nov 11, 2021
d1fc012
Moving test to appropriate location
iejMac Nov 11, 2021
bf0792f
Merge branch 'main' of https://github.com/iejMac/torchgeo into oscd
iejMac Nov 11, 2021
5f96aaa
OSCD: remove sort_bands and use utils.sort_sentinel2_bands
iejMac Nov 11, 2021
50d82f9
Using rasterio instead of tifffile
iejMac Nov 11, 2021
4f29155
remove useless import
iejMac Nov 11, 2021
3f3c9b3
Merge branch 'main' of https://github.com/iejMac/torchgeo into oscd
iejMac Nov 12, 2021
1e17bda
style changes
iejMac Nov 12, 2021
e12a0a2
fix: style
iejMac Nov 12, 2021
a005873
Merge branch 'main' of https://github.com/iejMac/torchgeo into oscd
iejMac Nov 15, 2021
42acbf7
Merge branch 'main' of https://github.com/iejMac/torchgeo into oscd
iejMac Nov 16, 2021
c774fcd
Developing tests for OSCD dataset
iejMac Nov 16, 2021
0d8e7c5
Updating dataset description
iejMac Nov 16, 2021
544d144
change name
iejMac Nov 16, 2021
b3da718
style fixes
iejMac Nov 16, 2021
7f66f6b
fixing mypy errors
iejMac Nov 16, 2021
2596506
style fixes
iejMac Nov 16, 2021
4cd64c1
cast to string to fix typing errors
iejMac Nov 16, 2021
491e4ed
style change
iejMac Nov 16, 2021
ffa6978
isort fix
iejMac Nov 16, 2021
164003d
remove TODO
iejMac Nov 16, 2021
ef8e92e
adding dataset for testing
iejMac Nov 16, 2021
dca02a1
change len
iejMac Nov 16, 2021
96a5947
check if sum is concatdataset
iejMac Nov 16, 2021
5fbdad3
isort fix
iejMac Nov 16, 2021
8513d6e
fixing some issues + correct md5 in dataset
iejMac Nov 17, 2021
9a2626b
closing rasterio file handles
iejMac Nov 17, 2021
961ebdc
removing some TODO's
iejMac Nov 17, 2021
ebf24c7
transitioning to fake data
iejMac Nov 17, 2021
730807f
mypy fix attempt
iejMac Nov 17, 2021
554d187
set fake data md5
iejMac Nov 17, 2021
e430f67
flake8 fix
iejMac Nov 17, 2021
8b32728
starting plot method
iejMac Nov 17, 2021
8770ff4
updating plot method
iejMac Nov 17, 2021
488978c
no predictions for now
iejMac Nov 17, 2021
36b8a82
fixing style errors
iejMac Nov 17, 2021
4cc5b2c
add testing for plot
iejMac Nov 17, 2021
bed3b40
making some changes to fake testing data
iejMac Nov 17, 2021
0b00589
full coverage
iejMac Nov 17, 2021
75b204e
Use RGB channels in the plot function
calebrob6 Nov 17, 2021
ffc64ff
adding shape tests in test_getitem
iejMac Nov 18, 2021
d889cbd
Merge branch 'oscd' of https://github.com/iejMac/torchgeo into oscd
iejMac Nov 18, 2021
dca5475
remove features and add to description
iejMac Nov 18, 2021
e4cdac9
fixing some things
iejMac Nov 18, 2021
e743f29
transitioning to authors dataset link
iejMac Nov 19, 2021
7c39193
No need to change file names + adapt test dataset
iejMac Nov 19, 2021
4bc7a92
adapting tests to new data format
iejMac Nov 19, 2021
d7c60ab
Update docs/api/datasets.rst
iejMac Nov 19, 2021
64b4028
closing plot at end of terst
iejMac Nov 19, 2021
0698a86
add versionadded
iejMac Nov 19, 2021
9d4a505
style fixes + indentation fixes
iejMac Nov 19, 2021
9c1f5b0
style fixes
iejMac Nov 19, 2021
dfda240
forgot the .zip
iejMac Nov 19, 2021
bfee62b
fix zipfile name
iejMac Nov 19, 2021
56b75df
temporary fix for flake8
iejMac Nov 19, 2021
ca93b69
Add link to docs
iejMac Nov 19, 2021
d40677e
forgot to adjust this
iejMac Nov 19, 2021
ad2ce34
changing flake8 solve
iejMac Nov 19, 2021
52046e9
slimming down the test dataset
iejMac Nov 19, 2021
cfbf26c
removing imgs_x files which aren't needed for current testing but mig…
iejMac Nov 19, 2021
9e320d6
Revert "removing imgs_x files which aren't needed for current testing…
iejMac Nov 19, 2021
d8148ec
nevermind, this was the issue
iejMac Nov 19, 2021
9488979
trying to remove these once again
iejMac Nov 19, 2021
9ef8b73
adding band choosing functionality
iejMac Nov 19, 2021
826d7a2
removing double code
iejMac Nov 19, 2021
3f7f800
removing more double code
iejMac Nov 19, 2021
c75b1ae
flake8 fix
iejMac Nov 19, 2021
24879ef
adding one more training sample to dummy dataset and testing split
iejMac Nov 19, 2021
e0fa092
typing numpy array
iejMac Nov 19, 2021
9d55b03
back to this
iejMac Nov 19, 2021
9615cb8
Fixing tests and mypy
calebrob6 Nov 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fixing tests and mypy
  • Loading branch information
calebrob6 committed Nov 19, 2021
commit 9615cb8b882c8370b6990470dca248f3b0f9f839
2 changes: 1 addition & 1 deletion tests/datasets/test_oscd.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_getitem(self, dataset: OSCD) -> None:

def test_len(self, dataset: OSCD) -> None:
if dataset.split == "train":
assert len(dataset) == 2
assert len(dataset) == 1
else:
assert len(dataset) == 1

Expand Down
4 changes: 2 additions & 2 deletions torchgeo/datasets/oscd.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,14 @@ def plot(

rgb_inds = [3, 2, 1] if self.bands == "all" else [0, 1, 2]

def get_masked(img: Tensor) -> Array:
def get_masked(img: Tensor) -> Array: # type: ignore[type-arg]
rgb_img = img[rgb_inds].float().numpy()
per02 = np.percentile(rgb_img, 2) # type: ignore[no-untyped-call]
per98 = np.percentile(rgb_img, 98) # type: ignore[no-untyped-call]
rgb_img = (np.clip((rgb_img - per02) / (per98 - per02), 0, 1) * 255).astype(
np.uint8
)
array: Array = draw_semantic_segmentation_masks(
array: Array = draw_semantic_segmentation_masks( # type: ignore[type-arg]
torch.from_numpy(rgb_img), # type: ignore[attr-defined]
sample["mask"],
alpha=alpha,
Expand Down