florinbarbisch
commited on
Commit
·
672e5a7
1
Parent(s):
ab6af5b
Removed: sidebar and option to run locally
Browse files- inference.py +3 -8
- pages/2_Perform_Crop_Classification.py +0 -23
inference.py
CHANGED
|
@@ -203,14 +203,9 @@ def crop_predictions_to_gdf(field_ids, targets, predictions, transform, crs, cla
|
|
| 203 |
return gdf
|
| 204 |
|
| 205 |
def perform_inference(lon, lat, model, config, debug=False):
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
field_ids_path = "./data/field_ids_cog.tif"
|
| 210 |
-
else:
|
| 211 |
-
features_path = "https://huggingface.co/datasets/crop-classification/zueri-crop-2/resolve/main/stacked_features_cog.tif"
|
| 212 |
-
labels_path = "https://huggingface.co/datasets/crop-classification/zueri-crop-2/resolve/main/labels_cog.tif"
|
| 213 |
-
field_ids_path = "https://huggingface.co/datasets/crop-classification/zueri-crop-2/resolve/main/field_ids_cog.tif"
|
| 214 |
|
| 215 |
# Local paths for stats and dataset info
|
| 216 |
stats_path = "./data/chips_stats.yaml"
|
|
|
|
| 203 |
return gdf
|
| 204 |
|
| 205 |
def perform_inference(lon, lat, model, config, debug=False):
|
| 206 |
+
features_path = "https://huggingface.co/datasets/crop-classification/zueri-crop-2/resolve/main/stacked_features_cog.tif"
|
| 207 |
+
labels_path = "https://huggingface.co/datasets/crop-classification/zueri-crop-2/resolve/main/labels_cog.tif"
|
| 208 |
+
field_ids_path = "https://huggingface.co/datasets/crop-classification/zueri-crop-2/resolve/main/field_ids_cog.tif"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
|
| 210 |
# Local paths for stats and dataset info
|
| 211 |
stats_path = "./data/chips_stats.yaml"
|
pages/2_Perform_Crop_Classification.py
CHANGED
|
@@ -31,29 +31,6 @@ def perform_inference_step():
|
|
| 31 |
lat, lon = st.session_state["selected_location"]
|
| 32 |
|
| 33 |
# Sidebar
|
| 34 |
-
st.sidebar.header("Settings")
|
| 35 |
-
|
| 36 |
-
# Timestep Slider
|
| 37 |
-
timestep = st.sidebar.slider("Select Timestep", 1, 9, 5)
|
| 38 |
-
|
| 39 |
-
# Band Dropdown
|
| 40 |
-
band_options = {
|
| 41 |
-
"RGB": [1, 2, 3], # Adjust indices based on the actual bands in your GeoTIFF
|
| 42 |
-
"NIR": [4],
|
| 43 |
-
"SWIR1": [5],
|
| 44 |
-
"SWIR2": [6]
|
| 45 |
-
}
|
| 46 |
-
vmin_vmax = {
|
| 47 |
-
"RGB": (89, 1878),
|
| 48 |
-
"NIR": (165, 5468),
|
| 49 |
-
"SWIR1": (120, 3361),
|
| 50 |
-
"SWIR2": (94, 2700)
|
| 51 |
-
}
|
| 52 |
-
selected_band = st.sidebar.selectbox("Select Satellite Band to Display", options=list(band_options.keys()), index=0)
|
| 53 |
-
|
| 54 |
-
# Calculate the band indices based on the selected timestep
|
| 55 |
-
selected_bands = [band + (timestep - 1) * 6 for band in band_options[selected_band]]
|
| 56 |
-
|
| 57 |
instructions = """
|
| 58 |
Click the button "Perform Crop Classification".
|
| 59 |
|
|
|
|
| 31 |
lat, lon = st.session_state["selected_location"]
|
| 32 |
|
| 33 |
# Sidebar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
instructions = """
|
| 35 |
Click the button "Perform Crop Classification".
|
| 36 |
|