result
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -32,17 +32,29 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"id": "df9820b8",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "ImportError",
|
||||
"evalue": "cannot import name 'notebook_utils' from 'deafrica_tools' (/home/jovyan/remote-sensing/deafrica_tools/__init__.py)",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
|
||||
"File \u001b[0;32m<timed exec>:9\u001b[0m\n",
|
||||
"\u001b[0;31mImportError\u001b[0m: cannot import name 'notebook_utils' from 'deafrica_tools' (/home/jovyan/remote-sensing/deafrica_tools/__init__.py)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%%time\n",
|
||||
"%matplotlib inline\n",
|
||||
"\n",
|
||||
"import sys\n",
|
||||
"import os\n",
|
||||
"sys.path.insert(0, '/media/x79/2A7D-FAA0/remote-sensing')\n",
|
||||
"sys.path.insert(0, '/home/jovyan/remote-sensing')\n",
|
||||
"\n",
|
||||
"# Import ODC modules for Dask Gateway and Datacube\n",
|
||||
"import datacube\n",
|
||||
@@ -97,10 +109,30 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 2,
|
||||
"id": "3c4d6779",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"🚀 Step 1: Dask Gateway + Datacube Initialization\n",
|
||||
"======================================================================\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'notebook_utils' is not defined",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||
"File \u001b[0;32m<timed exec>:5\u001b[0m\n",
|
||||
"\u001b[0;31mNameError\u001b[0m: name 'notebook_utils' is not defined"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%%time\n",
|
||||
"\n",
|
||||
@@ -134,10 +166,23 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 3,
|
||||
"id": "15a5291c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"📍 Area of Interest:\n",
|
||||
" Bbox: (105.5, 9.2, 106.4, 10.0)\n",
|
||||
" Lon range: 105.5 to 106.4\n",
|
||||
" Lat range: 9.2 to 10.0\n",
|
||||
" Date range: 2022-09-01 to 2023-10-01\n",
|
||||
"======================================================================\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Cấu hình vùng và thời gian\n",
|
||||
"date_range = (\"2022-09-01\", \"2023-10-01\")\n",
|
||||
@@ -165,10 +210,30 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 4,
|
||||
"id": "611cd1c2",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"📥 Loading Sentinel-2 data from Planetary Computer...\n",
|
||||
"----------------------------------------------------------------------\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'load_and_process_s2' is not defined",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||
"File \u001b[0;32m<timed exec>:5\u001b[0m\n",
|
||||
"\u001b[0;31mNameError\u001b[0m: name 'load_and_process_s2' is not defined"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%%time\n",
|
||||
"\n",
|
||||
@@ -208,10 +273,30 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 5,
|
||||
"id": "3bda3dc0",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"📥 Loading Sentinel-1 data from Planetary Computer...\n",
|
||||
"----------------------------------------------------------------------\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'load_and_process_s1' is not defined",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||
"File \u001b[0;32m<timed exec>:5\u001b[0m\n",
|
||||
"\u001b[0;31mNameError\u001b[0m: name 'load_and_process_s1' is not defined"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%%time\n",
|
||||
"\n",
|
||||
@@ -249,10 +334,50 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 6,
|
||||
"id": "70925d09",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"======================================================================\n",
|
||||
"📦 Data Loading Module (No ODC Database Required)\n",
|
||||
"======================================================================\n",
|
||||
"\n",
|
||||
"💡 Usage:\n",
|
||||
" from load_data_no_odc import load_and_process_s2, load_and_process_s1\n",
|
||||
"\n",
|
||||
" bbox = (lon_min, lat_min, lon_max, lat_max)\n",
|
||||
" date_range = ('2022-09-01', '2023-10-01')\n",
|
||||
"\n",
|
||||
" data_s2 = load_and_process_s2(bbox, date_range)\n",
|
||||
" data_s1 = load_and_process_s1(bbox, date_range)\n",
|
||||
"\n",
|
||||
" # Load training data\n",
|
||||
" train = load_train_data('train/data.shp', label_mapping)\n",
|
||||
" X, y = extract_features_at_points(train, data_s2, data_s1)\n",
|
||||
" X_train, X_val, X_test, y_train, y_val, y_test = split_train_data(X, y)\n",
|
||||
"======================================================================\n",
|
||||
"\n",
|
||||
"🎯 Label mapping:\n",
|
||||
" 0: Lua tom\n",
|
||||
" 1: Lua\n",
|
||||
" 2: CHN\n",
|
||||
" 3: CLN\n",
|
||||
" 4: TS\n",
|
||||
" 5: Song\n",
|
||||
" 6: Dat xay dung\n",
|
||||
" 7: Rung\n",
|
||||
"\n",
|
||||
"📂 Loading training data from: train/ST_training_data_updated_1130points_new.shp\n",
|
||||
"📂 Loading training data from: train/ST_training_data_updated_1130points_new.shp\n",
|
||||
"❌ Error loading training data: train/ST_training_data_updated_1130points_new.shp: No such file or directory\n",
|
||||
"❌ Failed to load training data\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from load_data_no_odc import load_train_data\n",
|
||||
"\n",
|
||||
@@ -298,10 +423,32 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 7,
|
||||
"id": "62c41cd0",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"🔧 Extracting features from satellite data...\n",
|
||||
"----------------------------------------------------------------------\n",
|
||||
"❌ Missing data: Please check training data or satellite data\n",
|
||||
" train_data: ✗\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'data_sen2_monthly' is not defined",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||
"File \u001b[0;32m<timed exec>:32\u001b[0m\n",
|
||||
"\u001b[0;31mNameError\u001b[0m: name 'data_sen2_monthly' is not defined"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%%time\n",
|
||||
"from load_data_no_odc import extract_features_at_points\n",
|
||||
@@ -351,10 +498,18 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 8,
|
||||
"id": "523e1249",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"❌ Features not extracted yet. Please run Step 6 first.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from load_data_no_odc import split_train_data\n",
|
||||
"\n",
|
||||
@@ -393,10 +548,20 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 9,
|
||||
"id": "445c2d92",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"❌ Data not ready. Please run Step 7 first.\n",
|
||||
"CPU times: user 187 ms, sys: 0 ns, total: 187 ms\n",
|
||||
"Wall time: 187 ms\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%%time\n",
|
||||
"from sklearn.tree import DecisionTreeClassifier\n",
|
||||
@@ -443,10 +608,20 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 10,
|
||||
"id": "d13274e4",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"❌ Data not ready. Please run Step 7 first.\n",
|
||||
"CPU times: user 46 μs, sys: 0 ns, total: 46 μs\n",
|
||||
"Wall time: 50.8 μs\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%%time\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
@@ -516,10 +691,18 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 11,
|
||||
"id": "bc3d6b9a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"❌ Model not trained yet. Please run Step 8 first.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from sklearn.metrics import accuracy_score, classification_report, confusion_matrix\n",
|
||||
"import seaborn as sns\n",
|
||||
@@ -567,10 +750,18 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 12,
|
||||
"id": "044eefc4",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"❌ Model not trained yet or evaluation not complete.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import joblib\n",
|
||||
"import json\n",
|
||||
@@ -636,10 +827,18 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 13,
|
||||
"id": "20445068",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"⚠ Error closing cluster: name 'client' is not defined\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Close Dask Gateway cluster\n",
|
||||
"try:\n",
|
||||
@@ -700,8 +899,22 @@
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"name": "python"
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.12.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user