Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ studio-pf.log

# Credentials and secrets
.geostudio_config_file
geostudio_config_file
*.env
.env.local
secrets.yml
Expand Down
8 changes: 8 additions & 0 deletions workshop/docs/notebooks/lab1-getting-started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"source": [
"# Lab 1\n",
"\n",
"\n",
"<a href=\"https://colab.research.google.com/github/terrastackai/geospatial-studio/blob/main/workshop/docs/notebooks/lab1-getting-started.ipynb\" target=\"_blank\" rel=\"noopener noreferrer\">\n",
" <img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\">\n",
"</a>\n",
"\n",
"\n",
"**Getting Started with IBM Geospatial Studio**\n",
"\n",
"⏱️ **Estimated Duration:** 10 minutes \n",
Expand Down Expand Up @@ -228,6 +234,8 @@
"BASE_STUDIO_UI_URL=https://localhost:4180\n",
"\"\"\"\n",
"\n",
"# If you are using jupyter lab, create a normal file to view it on the fileviewer. `geostudio_config_file`\n",
"\n",
"# Write to file\n",
"with open('.geostudio_config_file', 'w') as f:\n",
" f.write(config_content)\n",
Expand Down
10 changes: 9 additions & 1 deletion workshop/docs/notebooks/lab2-onboarding-examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"source": [
"# Lab 2\n",
"\n",
"\n",
"<a href=\"https://colab.research.google.com/github/terrastackai/geospatial-studio/blob/main/workshop/docs/notebooks/lab2-onboarding-examples.ipynb\" target=\"_blank\" rel=\"noopener noreferrer\">\n",
" <img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\">\n",
"</a>\n",
"\n",
"\n",
"**Onboarding Pre-computed Examples**\n",
"\n",
"⏱️ **Estimated Duration:** 20 minutes \n",
Expand Down Expand Up @@ -116,6 +122,8 @@
"outputs": [],
"source": [
"# Initialize the client\n",
"# If you are using jupyter lab, create a normal file to view it on the fileviewer. `geostudio_config_file`\n",
"\n",
"client = Client(geostudio_config_file=\".geostudio_config_file\")\n",
"\n",
"print(\"✅ Connected to Geospatial Studio!\")"
Expand Down Expand Up @@ -403,7 +411,7 @@
"\n",
"2. **Navigate to the Inference Lab:**\n",
" - Click on \"Inference Lab\" in the left sidebar\n",
" - Or go directly to: `https://localhost:4180/inference`\n",
" - Or go directly to: `https://localhost:4180/inference#inference`\n",
"\n",
"3. **Find Your Example:**\n",
" - Look for \"My Examples\" section\n",
Expand Down
7 changes: 7 additions & 0 deletions workshop/docs/notebooks/lab3-running-inference.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
"source": [
"# Lab 3\n",
"\n",
"\n",
"<a href=\"https://colab.research.google.com/github/terrastackai/geospatial-studio/blob/main/workshop/docs/notebooks/lab3-running-inference.ipynb\" target=\"_blank\" rel=\"noopener noreferrer\">\n",
" <img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\">\n",
"</a>\n",
"\n",
"**Upload Model Checkpoints and Run Inference**\n",
"\n",
"⏱️ **Estimated Duration:** 30 minutes \n",
Expand Down Expand Up @@ -132,6 +137,8 @@
"outputs": [],
"source": [
"# Initialize the client\n",
"# If you are using jupyter lab, create a normal file to view it on the fileviewer. `geostudio_config_file`\n",
"\n",
"client = Client(geostudio_config_file=\".geostudio_config_file\")\n",
"\n",
"print(\"✅ Connected to Geospatial Studio\")"
Expand Down
456 changes: 447 additions & 9 deletions workshop/docs/notebooks/lab4-burnscars-workflow.ipynb

Large diffs are not rendered by default.

152 changes: 128 additions & 24 deletions workshop/docs/notebooks/lab5-gesa-burnscars-workflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"# Lab 5\n",
"\n",
"\n",
"<a href=\"https://colab.research.google.com/github/terrastackai/geospatial-studio/blob/gesa-workshop-notebooks/workshop/docs/notebooks/lab5-gesa-burnscars-workflow.ipynb\" target=\"_blank\" rel=\"noopener noreferrer\">\n",
"<a href=\"https://colab.research.google.com/github/terrastackai/geospatial-studio/blob/main/workshop/docs/notebooks/lab5-gesa-burnscars-workflow.ipynb\" target=\"_blank\" rel=\"noopener noreferrer\">\n",
" <img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\">\n",
"</a>\n",
"\n",
"\n",
"![Geospatial Studio banner](https://raw.githubusercontent.com/terrastackai/geospatial-studio/gesa-workshop-notebooks/workshop/docs/assets/banner.png)\n",
"![Geospatial Studio banner](https://raw.githubusercontent.com/terrastackai/geospatial-studio/main/workshop/docs/assets/banner.png)\n",
"\n",
"## 🌍 Geospatial Exploration and Orchestration Studio \n",
"\n",
Expand Down Expand Up @@ -142,17 +142,17 @@
"Raw satellite data showing the area affected by wildfire:\n",
"\n",
"<!-- ![Fire Input](../assets/fire-input.png) -->\n",
"<img src=\"https://raw.githubusercontent.com/terrastackai/geospatial-studio/gesa-workshop-notebooks/workshop/docs/assets/fire-input.png\" alt=\"RGB Input\" width=\"588\" height=\"300\">\n",
"<img src=\"https://raw.githubusercontent.com/terrastackai/geospatial-studio/main/workshop/docs/assets/fire-input.png\" alt=\"RGB Input\" width=\"588\" height=\"300\">\n",
"\n",
"#### Model Prediction\n",
"The fine-tuned model identifies burn scar areas:\n",
"\n",
"<img src=\"https://raw.githubusercontent.com/terrastackai/geospatial-studio/gesa-workshop-notebooks/workshop/docs/assets/fire-prediction.png\" alt=\"Fire Prediction\" width=\"588\" height=\"300\">\n",
"<img src=\"https://raw.githubusercontent.com/terrastackai/geospatial-studio/main/workshop/docs/assets/fire-prediction.png\" alt=\"Fire Prediction\" width=\"588\" height=\"300\">\n",
"\n",
"#### Prediction Overlay\n",
"Burn scar predictions overlaid on the original imagery for validation:\n",
"\n",
"<img src=\"https://raw.githubusercontent.com/terrastackai/geospatial-studio/gesa-workshop-notebooks/workshop/docs/assets/fire-prediction-overlayed.png\" alt=\"Fire Prediction Overlayed\" width=\"588\" height=\"300\">\n",
"<img src=\"https://raw.githubusercontent.com/terrastackai/geospatial-studio/main/workshop/docs/assets/fire-prediction-overlayed.png\" alt=\"Fire Prediction Overlayed\" width=\"588\" height=\"300\">\n",
"\n",
"<!-- ![Fire Prediction Overlayed](../assets/fire-prediction-overlayed.png) -->\n",
"\n",
Expand Down Expand Up @@ -259,7 +259,9 @@
"#############################################################\n",
"# Initialize Geostudio client using a geostudio config file\n",
"#############################################################\n",
"gfm_client = Client(geostudio_config_file=\".geostudio_config_file\")"
"# If you are using jupyter lab, create a normal file to view it on the fileviewer. `geostudio_config_file`\n",
"\n",
"gfm_client = Client(geostudio_config_file=\"geostudio_config_file\")"
]
},
{
Expand All @@ -280,12 +282,6 @@
"In this section, we'll explore how to review datasets that have already been prepared and onboarded to the Geospatial Studio. This is useful for understanding what data is available before starting a fine-tuning task."
]
},
{
"cell_type": "markdown",
"id": "ae7d34b9",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -309,10 +305,16 @@
"source": [
"# Get detailed information about a specific burn scars dataset\n",
"# If you know the dataset name or ID, you can retrieve its details\n",
"burn_scars_dataset_id = \"geodata-e8hwqfrvtsgwfgsx7agvgk\"\n",
"burn_scars_dataset_id = \"select-dataset_id-from-DataFrame-above\"\n",
"burn_scars_dataset_id"
]
},
{
"cell_type": "markdown",
"id": "31fee87f",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -381,10 +383,18 @@
"source": [
"# List all the base models onboarded in the cluster\n",
"base_models = gfm_client.list_base_models()['results']\n",
"display(DataFrame(base_models))\n",
"\n",
"display(DataFrame(base_models))\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "06dfa760",
"metadata": {},
"outputs": [],
"source": [
"# Select Prithvi_EO_V2_300M model\n",
"prithvi_eo_v2_300m_base_model_id = \"28ad8b4f-13ba-4567-b28f-bb16758324c3\""
"prithvi_eo_v2_300m_base_model_id = \"select-base_model-id-from-DataFrame-above\""
]
},
{
Expand Down Expand Up @@ -429,10 +439,18 @@
"source": [
"# List all the templates onboarded in the cluster\n",
"tune_templates = gfm_client.list_tune_templates()['results']\n",
"display(DataFrame(tune_templates))\n",
"\n",
"display(DataFrame(tune_templates))\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7aecd8db",
"metadata": {},
"outputs": [],
"source": [
"# Select segmentation template\n",
"segmentation_template_id = \"8573acf1-5ee7-4291-bcfe-357408080445\""
"segmentation_template_id = \"select-template-id-from-DataFrame-above\""
]
},
{
Expand Down Expand Up @@ -512,6 +530,8 @@
"5. **Completion**: Finalizing and storing the trained model\n",
"\n",
"**Expected Duration:**\n",
"\n",
"These times are dependent on the tuning config e.g. number of epochs, batch size, dataset size, etc.\n",
"- Modern GPU (V100/A100): 30-45 minutes\n",
"- Older GPU: 45-90 minutes\n",
"- CPU: Not recommended (2 hrs + Using Terramind tiny )\n",
Expand Down Expand Up @@ -727,7 +747,7 @@
" \"visible_by_default\": \"True\"\n",
" }\n",
" ],\n",
" \"tune_id\" : \"geotune-k9xhhztv6rqub8usa4xjdp\"\n",
" \"tune_id\" : tune_id\n",
"}\n",
"\n",
"print(\"📋 Inference Configuration:\")\n",
Expand All @@ -745,7 +765,6 @@
"source": [
"# Submit the inference request\n",
"print(\"\\n🚀 Submitting inference request...\\n\")\n",
"tune_id = \"geotune-k9xhhztv6rqub8usa4xjdp\"\n",
"\n",
"inference_response = gfm_client.try_out_tune(tune_id=tune_id, data=inference_payload)\n",
"\n",
Expand Down Expand Up @@ -824,20 +843,105 @@
"outputs": [],
"source": [
"# The best model already onboarded in the cluster\n",
"best_burnscars_model = \"geotune-mgmshlc8b9mwksedrghray\"\n",
"best_burnscars_model = \"replace-with-best-burnscars_model_id\" \n",
"# Run an inference on the best model\n",
"gfm_client.try_out_tune(tune_id=tune_id, data={**inference_payload, \"description\": \"Best Model Inference\", \"tune_id\":best_burnscars_model})\n",
"gfm_client.try_out_tune(tune_id=tune_id, data={**inference_payload, \"description\": \"Burns Best Model Inference\", \"tune_id\":best_burnscars_model})\n",
"\n",
"\n",
"# Use 5.1 instructions to view the results in the UI"
]
},
{
"cell_type": "markdown",
"id": "44a8b962",
"metadata": {},
"source": [
"## 7.0 Download artifacts : Download our trained model artifacts\n",
"\n",
"With the trained model, we will download the checkpoint and config that we can re-use for running inferences. \n",
"\n",
"We will use wget/curl to download the artifacts. Otherwise, you can grab the links and download directly to your local machine.\n",
"\n",
"---"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "33e73e49",
"metadata": {},
"outputs": [],
"source": [
"# Get the download URLs for the trained model artifacts\n",
"artifact_urls = gfm_client.download_tune(tune_id=tune_id)\n",
"artifact_urls"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "download-artifacts",
"metadata": {},
"outputs": [],
"source": [
"# Extract URLs\n",
"config_url = artifact_urls['config_url']\n",
"checkpoint_url = artifact_urls['checkpoint_url']\n",
"\n",
"print(f\"Config URL: {config_url}\")\n",
"print(f\"Checkpoint URL: {checkpoint_url}\")\n",
"print(\"\\n--- Download Commands ---\\n\")\n",
"\n",
"# Using wget\n",
"print(\"Using wget:\")\n",
"print(f\"wget -O config_deploy.yaml '{config_url}'\")\n",
"print(f\"wget -O model_checkpoint.ckpt '{checkpoint_url}'\")\n",
"\n",
"# Using wget\n",
"print(\"\\nUsing curl:\")\n",
"print(f\"curl -o config_deploy.yaml '{config_url}'\")\n",
"print(f\"curl -o model_checkpoint.ckpt '{checkpoint_url}'\")"
]
},
{
"cell_type": "markdown",
"id": "5339feab",
"metadata": {},
"source": [
"\n",
"### 7.1 Extra: Upload Completed tune artifacts\n",
"For models tuned outside the GEOStudio platform, you can upload the model artifacts and use them to ran inferences.\n",
"\n",
"\n",
"```py\n",
"\n",
"burns_json = {\n",
" \"name\": \"name_of_your_tune\",\n",
" \"description\": \"name_of_your_tune\",\n",
" \"tune_config_url\": \"https://url-to-download-your-config/your-tune-config.yaml\",\n",
" \"tune_checkpoint_url\": \"https://url-to-download-your-checkpoint/your-checkpoint.ckpt\",\n",
" # These are optional and can be updated when running the inference\n",
" \"model_input_data_spec\": {\n",
" \"bands\": [], # bands used to train your dataset\n",
" \"connector\": \"your_terrakit_connector\",\n",
" \"collection\": \"the_collection_name\",\n",
" \"file_suffix\": \"file_suffix_of_your_train_dataset\",\n",
" },\n",
" \"geoserver_push\": {}, # geoserver layers\n",
" \"post_processing\": {}, # post_processing options\n",
"}\n",
"\n",
"tune_response = gfm.upload_completed_tunes(burns_json)\n",
"\n",
"___"
]
},
{
"cell_type": "markdown",
"id": "summary-section-2",
"metadata": {},
"source": [
"## 7. Summary and Key Takeaways\n",
"## 8. Summary and Key Takeaways\n",
"\n",
"Congratulations! You've completed an end-to-end machine learning workflow for geospatial AI with a burnscars example. 🎉\n",
"\n",
Expand Down
Loading
Loading