Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
735312c
wip - mozambique, get Nandi working again too
gabrieltseng Nov 5, 2025
13b8631
finnicking
gabrieltseng Nov 5, 2025
e3f7d2d
Maybe this will fix it?
gabrieltseng Nov 6, 2025
2e64bed
ctrl + z
gabrieltseng Nov 6, 2025
2a4b9f6
Add an explicit nodata value to the geotiff
gabrieltseng Nov 7, 2025
714b75a
Update lockfile
gabrieltseng Nov 10, 2025
5c14ceb
Fix merge conflicts
gabrieltseng Nov 10, 2025
3567479
Reshuffling
gabrieltseng Nov 10, 2025
f17e284
Add scripts
gabrieltseng Nov 10, 2025
c04a43f
Add RSLP finetuning yaml and readme
gabrieltseng Nov 10, 2025
5719962
oops
gabrieltseng Nov 10, 2025
7d0c5df
linting
gabrieltseng Nov 10, 2025
53caaf3
Remove duplicate keys in Nandi config
gabrieltseng Nov 10, 2025
f52b7d5
Update model.yaml to reflect rslp_finetuning.yaml
gabrieltseng Nov 11, 2025
1cfb86d
train val split
gabrieltseng Nov 12, 2025
009693b
Remove rslearn_projects dependency
gabrieltseng Nov 13, 2025
7cdc8d8
More notes in the README
gabrieltseng Nov 13, 2025
049a818
Add train / val / test numbers
gabrieltseng Nov 13, 2025
24f4d7c
Update readme, update finetuning yaml to use latest script
gabrieltseng Nov 13, 2025
6792322
more small changes - actually use the val set
gabrieltseng Nov 13, 2025
d704aaf
Dont load all layers
gabrieltseng Nov 13, 2025
d8c6c06
ctrl + z
gabrieltseng Nov 13, 2025
e566ab7
more notes
gabrieltseng Nov 13, 2025
e9631b6
Fix patch size
gabrieltseng Nov 14, 2025
f720d8a
oops
gabrieltseng Nov 14, 2025
d491aa0
crop type
gabrieltseng Nov 14, 2025
60a5a6a
Update filepath
gabrieltseng Nov 14, 2025
f1f44e2
ok its a bit more involved than I thought
gabrieltseng Nov 14, 2025
9528433
classes are strings in the crop type case
gabrieltseng Nov 14, 2025
c29a6c3
:facepalm:
gabrieltseng Nov 14, 2025
d74c79a
test
gabrieltseng Nov 14, 2025
58a78a2
ctrl + z
gabrieltseng Nov 14, 2025
746922a
ctrl + z
gabrieltseng Nov 14, 2025
f35eaaa
:shrug:
gabrieltseng Nov 14, 2025
3f51e13
Confusion matrices don't work
gabrieltseng Nov 14, 2025
55e1cec
Add the CM back in
gabrieltseng Nov 14, 2025
d0bb638
multiclass
gabrieltseng Nov 14, 2025
5bb837c
I want the best cm
gabrieltseng Nov 14, 2025
404852e
9?
gabrieltseng Nov 14, 2025
3e923bb
:pray:
gabrieltseng Nov 14, 2025
b9b86f9
rm cm
gabrieltseng Nov 14, 2025
7e57bc4
train all the models together now?
gabrieltseng Nov 14, 2025
07ee7ef
matching time windows for all privinces
gabrieltseng Nov 14, 2025
1a8357c
Use the new data
gabrieltseng Nov 15, 2025
3aa7b29
get the ints back for crop type
gabrieltseng Nov 17, 2025
49b72b8
label raster to handle crop types too
gabrieltseng Nov 17, 2025
3bab927
crop type yaml
gabrieltseng Nov 17, 2025
86b340a
ckpt to path
gabrieltseng Nov 17, 2025
93f4469
iterating
gabrieltseng Nov 17, 2025
e6f2622
just save the encoder
gabrieltseng Nov 17, 2025
2a9384d
more utility scripts
gabrieltseng Nov 17, 2025
78713ce
no workers
gabrieltseng Nov 17, 2025
8ff02d5
start from a finetuned encoder
gabrieltseng Nov 17, 2025
5a2ca1a
cleanup readme
gabrieltseng Nov 17, 2025
04455a4
patch size is part of the init now
gabrieltseng Nov 17, 2025
36d14b2
monitor val accuracy instead of val loss
gabrieltseng Nov 18, 2025
647f277
restore_config
gabrieltseng Nov 18, 2025
3c3c69d
Fix restore config
gabrieltseng Nov 18, 2025
6785ef5
Remove unnecessary script since RestoreConfig should be used in the yaml
gabrieltseng Nov 18, 2025
a528f2d
:facepalm:
gabrieltseng Nov 18, 2025
7a5b9df
Update restoreconfig ckpt
gabrieltseng Nov 18, 2025
f57295b
not from checkpoint
gabrieltseng Nov 18, 2025
15a62c5
Update README
gabrieltseng Nov 19, 2025
6795215
Add OlmoEarth Run for the croptype case as well
gabrieltseng Nov 19, 2025
367f31c
Cleanup points_per_class script
gabrieltseng Nov 19, 2025
56f54c0
Update dataset.config
gabrieltseng Nov 19, 2025
ca6483b
(unnecessarily?) update model.yaml
gabrieltseng Nov 19, 2025
d97e64d
We don't want min_matches to be 12 here
gabrieltseng Nov 19, 2025
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
1 change: 1 addition & 0 deletions olmoearth_projects/projects/mozambique_lulc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Mozambique Land Use Land Cover (LULC) mapping project."""
102 changes: 102 additions & 0 deletions olmoearth_projects/projects/mozambique_lulc/create_label_raster.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
"""Create label_raster from label.

If you run this, you will need to update the config.json for the dataset
to include the following entry:

"label_raster": {
"band_sets": [
{
"bands": [
"label"
],
"dtype": "int32"
}
],
"type": "raster"
},
"""

import argparse
import multiprocessing

import numpy as np
import tqdm
from rslearn.dataset.dataset import Dataset
from rslearn.dataset.window import Window
from rslearn.utils.raster_format import GeotiffRasterFormat
from rslearn.utils.vector_format import GeojsonVectorFormat
from upath import UPath

LULC_CLASS_NAMES = [
"invalid",
"Water",
"Bare Ground",
"Rangeland",
"Flooded Vegetation",
"Trees",
"Cropland",
"Buildings",
]
CROPTYPE_CLASS_NAMES = [
"invalid",
"corn",
"cassava",
"rice",
"sesame",
"beans",
"millet",
"sorghum",
]
PROPERTY_NAME = "category"
BAND_NAME = "label"


def create_label_raster(window: Window) -> None:
"""Create label raster for the given window."""
label_dir = window.get_layer_dir("label")
features = GeojsonVectorFormat().decode_vector(
label_dir, window.projection, window.bounds
)
class_name = features[0].properties[PROPERTY_NAME]
try:
class_id = LULC_CLASS_NAMES.index(class_name)
except ValueError:
class_id = CROPTYPE_CLASS_NAMES.index(class_name)

# Draw the class_id in the middle 1x1 of the raster.
raster = np.zeros(
(1, window.bounds[3] - window.bounds[1], window.bounds[2] - window.bounds[0]),
dtype=np.uint8,
)
raster[:, raster.shape[1] // 2, raster.shape[2] // 2] = class_id
raster_dir = window.get_raster_dir("label_raster", [BAND_NAME])
GeotiffRasterFormat().encode_raster(
raster_dir, window.projection, window.bounds, raster
)
window.mark_layer_completed("label_raster")


if __name__ == "__main__":
multiprocessing.set_start_method("forkserver")
parser = argparse.ArgumentParser()
parser.add_argument(
"--ds_path",
type=str,
required=True,
help="Path to the dataset",
)
parser.add_argument(
"--workers",
type=int,
default=64,
help="Number of worker processes to use",
)
args = parser.parse_args()

dataset = Dataset(UPath(args.ds_path))
windows = dataset.load_windows(workers=args.workers, show_progress=True)
p = multiprocessing.Pool(args.workers)
outputs = p.imap_unordered(create_label_raster, windows)
for _ in tqdm.tqdm(outputs, total=len(windows)):
pass
p.close()
Loading
Loading