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

Use cropharvest.bands.BANDS_MAX to normalize data in train.py #28

Merged
merged 5 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion openmapflow/templates/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pandas as pd
import torch
import yaml
from cropharvest.bands import BANDS_MAX
from datasets import datasets
from sklearn.metrics import (
ConfusionMatrixDisplay,
Expand Down Expand Up @@ -85,7 +86,7 @@ def __init__(self):

def forward(self, x):
with torch.no_grad():
x = x * 1e-4 # TODO Fix
x = x / torch.tensor(BANDS_MAX)
x = x.transpose(2, 1)
x = self.model(x).squeeze(dim=1)
x = torch.sigmoid(x)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
scripts=["openmapflow/scripts/openmapflow", "openmapflow/scripts/deploy.sh"],
install_requires=[
"cmocean",
"cropharvest>=0.3.0",
"cropharvest>=0.4.0",
"dvc[gdrive]>=2.10.1",
"earthengine-api",
"h5py>=3.1.0,!=3.7.0",
Expand Down