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

EuroSAT: use percentile normalization during plotting #2557

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
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
11 changes: 9 additions & 2 deletions torchgeo/datasets/eurosat.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@

from .errors import DatasetNotFoundError, RGBBandsMissingError
from .geo import NonGeoClassificationDataset
from .utils import Path, check_integrity, download_url, extract_archive, rasterio_loader
from .utils import (
Path,
check_integrity,
download_url,
extract_archive,
percentile_normalization,
rasterio_loader,
)


class EuroSAT(NonGeoClassificationDataset):
Expand Down Expand Up @@ -268,7 +275,7 @@ def plot(

image = np.take(sample['image'].numpy(), indices=rgb_indices, axis=0)
image = np.rollaxis(image, 0, 3)
image = np.clip(image / 3000, 0, 1)
image = percentile_normalization(image)

label = cast(int, sample['label'].item())
label_class = self.classes[label]
Expand Down