This repository contains a Jupyter notebook based tool for interactive, human-in-the-loop classification of geospatial data using the Tessera foundation model embeddings.
The tool allows a user to define an area of interest, visualize the high-dimensional embedding data with PCA, and iteratively train a machine learning model by simply clicking on the map to label.
- Interactive Map Interface: Pan and zoom on a satellite or terrain basemap.
- Data-Driven Visualization: Uses PCA to create a false-color visualization of Tessera embeddings.
- Point-and-Click Training: Simply click on the map to add labeled training points.
- Custom Classes & Colors: Dynamically add new classes and customize their colors with a color picker.
- Live Classification: Train a k-Nearest Neighbors model and classify the map with a click.
- Iterative Refinement: Add more pins to correct mistakes and re-run the classification for immediate (relatively) feedback.
This tool is designed to run in a local Python environment with git installed.
-
Clone the Repository:
git clone https://github.com/ucam-eo/tessera-interactive-map.git cd tessera-interactive-map -
Create and Activate a Virtual Environment:
python -m venv venv source venv/bin/activate -
Install Dependencies: The required packages are listed in
requirements.txt.pip install -r requirements.txt
For jupyter lab, also run
python -m ipykernel install --user --name=venvto register the kernel
-
Open the Project: Open the cloned repository folder in VS Code or Jupyter Notebook, or whatever else that runs ipynb files.
-
Open the Notebook: Using the file browser on the left, find and open the main notebook file.
-
Run the Cells: The notebook is organized into sequential steps. Run each cell in order from top to bottom.
- Step 1: Setup: Loads packages.
- Step 2: Region of Interest: Defines the Region of Interest (ROI) by setting latitude/longitude boundaries.
- Step 3: Interactive UI: Downloads the Tessera embedding tiles for your ROI, stitches them together, and uses PCA to generate the false color image. This step may take a while. This is the main interface. After everything is done, it displays the map, the embedding overlay, and all the widgets.
Once the notebook opens, you're ready to begin. Run the top cell.
Run the ROI selector cell. Define your bounding box with the tool by dragging a square.
Click Run to execute the cell below the ROI selector in the notebook. This may take a couple of minutes.
Once processing completes, a map will appear in the notebook.
Use the class selector to pick an existing class or create a new one. You can customize the color using the color palette.
Click directly on the map to place pins for each class. Clicking a pin again will remove it.
Once you’ve added pins from at least two classes, click the Classify button to begin the classification.
After processing, a classification map based on your input will appear. You may iterate on this by adding or removing labels or classes and reclassifying.