Skip to content

Commit

Permalink
doc edits and app tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcCoru committed Oct 23, 2023
1 parent 4bc5e12 commit db0be26
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 9 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Add conda to system path
- name: Set up venv
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
pip install --upgrade pip
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
- name: Install dependencies
run: |
conda env update --file environment.yml --name base
pip install -r requirements.txt
- name: Lint with flake8
run: |
conda install flake8 importlib_metadata
pip install flake8 importlib_metadata
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
Expand Down
22 changes: 22 additions & 0 deletions app/preprocess/extract_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import yaml
import torch
import data
import numpy as np
import os

SHOTS = 10
APP_DATA_DIR = "/data/meteor-paper/app"

config = yaml.safe_load(open("data/config.yaml"))

datasets = ["eurosat", "anthroprotect", "dfc2020", "denethor", "floatingobjects", "nwpuresisc45"]
for name in datasets:
## Load Data
dataconfig = config["data"][name]
support_input, support_target, query_input, query_target, classes, bands = data.__dict__[name](dataconfig["datapath"],
shots=SHOTS)

os.makedirs(APP_DATA_DIR, exist_ok=True)
filename = os.path.join(APP_DATA_DIR, name + ".npy")
print(f"writing {filename}")
np.save(filename, support_input.numpy())
7 changes: 6 additions & 1 deletion app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@
*/
}

/*
function reset(){
location.reload();
}
*/

function reset() {
// delete everything in the canvas
d3.select('svg').selectAll('*').remove();
Expand All @@ -270,7 +276,6 @@
document.getElementById("btn").innerHTML = "done!"
}


get_nodes()
updateInfo()
</script>
Empty file added doc/deforestationdata.md
Empty file.
Binary file added doc/deforestfigure.pdf
Binary file not shown.
Binary file added doc/deforestfigure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,17 @@ call it via
```
python train/main.py --start-from-pretrained
```

## Demo Application

run app

```
cd app
# install python and requirements
bash setup.sh
# start server
env/bin/python serve.py
```
9 changes: 7 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
torch==2.0.0
torch>=1.9.2
torchvision>=0.10.1
tqdm
ordered-set
ordered-set
scikit-learn
rasterio
h5py
numpy
pandas
1 change: 0 additions & 1 deletion train/utils/data/fewshotsen12ms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import numpy as np
import pandas as pd
import rasterio
import torch

from torch.utils.data.sampler import RandomSampler
from torchmeta.transforms import ClassSplitter
Expand Down

0 comments on commit db0be26

Please sign in to comment.