{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Automatic Building Footprint Extraction Using Satellite RGB and LiDAR Elevation\n", "\n", "This is the \"lite\" version of building extraction notebook. The purpose of this version is to allow reproduction on free-tier Amazon SageMaker instances. Some network accuracies may be downgraded due to these modifications." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setup\n", "\n", "\n", "\n", "First of all, if you haven't done so, please follow instructions in `README.md` to run `setup-env.sh` and `download-from-s3.sh` scripts to properly set up the Conda environment and download necessary files from S3 buckets prepared for this tutorial. Before proceeding, make sure this notebook connects with the proper kernel (`conda_[name]`, `[name]` is name of the new Conda environment you just created)." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os, time, json, random\n", "from pathlib import Path\n", "from tqdm import tqdm\n", "from p_tqdm import p_umap\n", "import numpy as np\n", "import pandas as pd\n", "import skimage\n", "import torch\n", "from torch import nn\n", "\n", "import warnings\n", "warnings.filterwarnings(\"ignore\", category=FutureWarning)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### External modules\n", "\n", "We made some customized modification to the external module `solaris` in `libs/` directory. Please refer to their [GitHub page](https://github.com/CosmiQ/solaris) for more information." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2022-11-21 23:21:11.282464: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F FMA\n", "To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.\n" ] } ], "source": [ "import libs.solaris as sol" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Plotting preferences" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_31880/1954383630.py:5: MatplotlibDeprecationWarning: The seaborn styles shipped by Matplotlib are deprecated since 3.6, as they no longer correspond to the styles shipped by seaborn. However, they will remain available as 'seaborn-v0_8-\n", "
\n", " | class_id | \n", "iou_field | \n", "TruePos | \n", "FalsePos | \n", "FalseNeg | \n", "Precision | \n", "Recall | \n", "F1Score | \n", "
---|---|---|---|---|---|---|---|---|
0 | \n", "all | \n", "iou_score_all | \n", "26 | \n", "4 | \n", "5 | \n", "0.866667 | \n", "0.83871 | \n", "0.852459 | \n", "