rAPIdtools
A high-performance toolkit for performing large-scale AI inference and localization on post-disaster geospatial datasets.
Overview
The UW RAPID Facility collects terabytes of perishable, hyper-resolution data in the aftermath of natural disasters. As remote sensing technology has evolved, the core challenge in natural hazards engineering has shifted: the primary bottleneck is no longer data collection, but turning that raw data into actionable intelligence.
rapidtools is a high-performance Python package designed to eliminate this bottleneck. It delivers a seamless, object-oriented pipeline that connects raw spatial datasets with state-of-the-art Large Vision-Language Models (VLMs). Whether analyzing ten damaged homes or one hundred thousand regional assets, rapidtools equips researchers with the tools to automate complex feature extraction, pinpoint structural damage, and unlock engineering-grade insights at unprecedented speed.
High-Level Impact & Key Features
Large-scale geospatial ingestion
Seamlessly fuse massive local orthomosaics, regional shapefiles, and street-view vector tiles. The PhysicalAssetCollection engine provides fast lookups, spatial filtering, and native conversions between GeoJSON, ESRI Shapefiles, and Pandas DataFrames.
Scalable AI Inference (Local & Cloud)
Run deployments tailored to your resources. Deploy powerful local vision-language models directly on consumer hardware: Google's Gemma-4 (E2B to 31B), Meta's Llama 4 and Llama 3.2 Vision, Meta's open-weight Muse Glimmer, Alibaba's Qwen3.8 / Qwen3.6 / Qwen3.5 / Qwen3-VL, or any Hugging Face checkpoint (Gemma 3, LLaVA, InternVL, Pixtral, Granite Vision, ...) through HFVisionAssetAnalyzer, using dynamic batching, automated tensor precision scaling, and strict VRAM garbage collection to prevent Out-Of-Memory (OOM) crashes. Alternatively, scale instantly using built-in integrations for enterprise APIs (OpenAI GPT-5.x/GPT-6, Google Gemini 3.x, Anthropic Claude Opus 5 / Fable 5.1, Meta Muse Spark, Alibaba Qwen via Model Studio), which feature thread-safe global cooldowns and exponential backoff to handle rate limits automatically.
Keyless Aerial and Street-Level Imagery
Pull imagery for any footprint without provider API keys. GoogleAerialImageExtractor and BingAerialImageExtractor stitch satellite tiles for GeoJSON polygons (or yield raw tiles for ML pipelines), GoogleOrthomosaicExtractor / BingOrthomosaicExtractor synthesize georeferenced GeoTIFFs for a region, and GoogleStreetViewImageExtractor locates the nearest Google Street View panorama for each asset, downloads it, crops the field of view that covers the asset footprint (optionally with the decoded depth map) and attaches the result to the asset. Mapillary street-level imagery remains available through MapillaryImageExtractor.
Street-Level Object Discovery
Build an inventory from the survey itself. MapillaryFeatureExtractor reads Mapillary's segmentation detections as metadata (no image downloads), drops the survey vehicle, places every sighting from the camera geometry and triangulates objects seen from several positions; MapillaryObjectImageExtractor then crops the closest views of each object for a vision-language model. Classes outside Mapillary's vocabulary fall back to SAM 3 on thumbnails.
Intelligent Feature Regularization Move beyond raw AI pixel masks. The toolkit includes sophisticated geometric regularizers that instantly translate semantic segmentations into usable, GIS-ready asset geometries.
Advanced Line-of-Sight Localization
Automate the extraction of the perfect viewing angle. Using KD-Trees, STRtrees, and ray-casting math, rapidtools can dynamically calculate asset principal axes and cull occluded perspectives (e.g., ignoring images where a target building is blocked by a neighboring structure) to guarantee your AI only analyzes the right data.
Installation
You can install the latest stable release directly via pip:
pip install rapidtools
Documentation
The published documentation lives at rapid-facility.github.io/rAPIdtools. It is built with Sphinx and the Book theme. Install the docs extra once, then build:
pip install -e ".[docs]"
cd docs
make html
Open docs/build/html/index.html in your browser for the user guide, the
worked examples and the API reference (one page per class, generated from
the docstrings).
Project Structure
Designed for flexibility and scale, rapidtools utilizes a cleanly decoupled architecture that makes extending workflows and managing complex data pipelines effortless:
rapidtools.core: Domain models representing your data (PhysicalAsset,PhysicalAssetCollection,ImageAsset,BoundingBox).rapidtools.data_sources: Clients for fetching raw data from external APIs and massive local files (e.g.,MapillaryClient,GoogleStreetViewClient,OrthomosaicReader,BingAerialImageExtractor,GoogleAerialImageExtractor).rapidtools.models: Base wrappers and handlers for executing ML models natively or via cloud APIs (Gemma4Inference,SAM3Inference,GeminiInference,MuseSparkInference,QwenInference, ...). See the table below.rapidtools.processing: High-level workflow components (Extractors, Segmenters, Analyzers, and Regularizers) designed to snap together effortlessly into thePipelineengine.rapidtools.gui: The browser-based application (rapidtools-gui) and the headless workflow behind it.rapidtools.jobs: The JSON job interface (rapidtools-job): a workflow written as a file that the GUI, a scheduler or another system hands torapidtoolsto run.
The rAPIdtools API in Five Lines
Every model is created through one factory and every analysis step is the same class, so switching providers is a one-word change:
import rapidtools as rt
rt.configure_logging() # opt in to progress output
buildings = rt.PhysicalAssetCollection.from_geojson('buildings.geojson')
pipeline = rt.Pipeline([
rt.AerialImageryExtractor('ortho.tif', save_directory='crops', buffer_m=20),
rt.AssetAnalyzer('gemini', prompt='Rate the damage 0-5 as JSON.'), # or 'claude', 'openai', 'muse_spark',
]) # 'qwen', 'gemma4', 'llama', 'qwen_vl', 'hf'
buildings = pipeline.run(buildings)
AssetAnalyzer('gemini', ...)builds the model for you; hosted providers read their key from the environment (GOOGLE_API_KEY,ANTHROPIC_API_KEY, ...) or takeapi_key=.rt.load(provider, **kwargs)builds a wrapper on its own, andrt.list_providers()andrt.catalog(provider)describe them without importing PyTorch.AssetAnalyzer(model_or_provider, prompt, ...)replaces the provider-specificXAssetAnalyzerclasses (still importable, deprecated). Hosted models run threaded with aRateLimitPolicy(shared cooldown after failures, then retry passes for the assets that failed, so timeouts and 429s do not leave holes); local models run sequentially or in batches. Hosted wrappers taketimeout=(default 60 s) for slow responses. Passgeneration=GenerationConfig(json_mode=True, temperature=0.0)for per-call options.AerialImageryExtractorjudges imagery coverage from the raster's mask (nodata value, alpha band or internal mask). By default a crop is skipped when more thanmax_missing_data_ratioof it is empty; passmin_footprint_coverage=0.3to keep every building whose footprint is at least 30% imaged, with edge crops padded so they keep their size.SAM3OrthoFeatureExtractor(prompt, ...)scans a whole orthomosaic for a text concept. By default touching detections dissolve into one polygon (roofs, roads, vegetation); passmerge_overlaps=Falsefor countable objects such as vehicles to keep one asset per detected instance, with its SAM 3confidence, and only remove cross-tile duplicates.- Pipeline steps declare a
Stage(DETECT,EXTRACT_IMAGERY,REGULARIZE,SEGMENT,ANALYZE,EXPORT), so steps can be added in any order. import rapidtoolsis side-effect free and fast (about half a second); PyTorch and Transformers load only when a model is built, so pipelines of extractors and regularizers never pay for them. Mapillary components readMAPILLARY_ACCESS_TOKENwhen no token is passed. Callrapidtools.login()to authenticate with the Hugging Face Hub for gated weights, or let local model wrappers do it when they load.
Quick Start: Aerial Damage Detection Pipeline
Run state-of-the-art damage assessments completely offline. This example demonstrates how to download rapidtools sample datasets, extract building-specific image patches from a local drone orthomosaic, and analyze them using a local Gemma-4 vision model that does not require paid API usage or cloud tokens.
import rapidtools as rt
rt.configure_logging()
# 1. Download the example datasets from the rapidtools registry
raster_path, footprint_path, prompt_path = rt.download_dataset(
['eaton_patch2', 'altadena_sample_buildings', 'aerial_chs_prompts']
)
# 2. Load the regional building footprints
buildings = rt.PhysicalAssetCollection.from_geojson(footprint_path)
pipeline = rt.Pipeline([
# 3. Crop the orthomosaic around each building and draw a reference
# outline. The outline can trace the footprint itself (default), its
# bounding box, rotated bounding box, convex hull or corner brackets,
# optionally pushed away from the asset, in any width and color.
rt.AerialImageryExtractor(
raster_path,
save_directory='eaton_fire_aerial_feb25/overlaid_imagery',
overlay_asset_outline=True,
outline_shape='rotated_bbox',
outline_buffer='2 m',
outline_width='1%',
),
# 4. Apply the prompt to every crop with a local Gemma 4 model. Any
# provider name works here ('gemini', 'claude', 'openai', ...); hosted
# ones read their API key from the environment.
rt.AssetAnalyzer('gemma4', prompt=prompt_path, batch_size=8),
])
# 5. Run it and export the AI-enriched inventory for GIS mapping
buildings = pipeline.run(buildings)
print(buildings) # one line: how many assets, of which types
buildings.to_geojson('eaton_footprints_CHS_with_gemma4.geojson', include_images=False)
Graphical Interface: Detect Assets and Run Inference Without Code
rapidtools ships with a local web application that wraps the end-to-end detect / extract / analyze workflow, for aerial imagery and for street-level surveys. It runs on the Python standard library (no extra dependencies) and opens in your browser.
rapidtools-gui # console script installed with the package
python -m rapidtools.gui # equivalent; add --port/--output-dir/--no-browser as needed
Or from Python:
from rapidtools.gui import launch_asset_analysis_app
launch_asset_analysis_app()
The app walks through three steps while the aerial image stays on screen and is updated with every result:
- Imagery: find the place on the map (satellite basemap, RAPID survey coverage, address search) and draw a box, then stitch a Bing or Google basemap over it (no API key), load a GeoTIFF from your computer, download a UW RAPID sample, or (coming soon) fetch it from TACC. Street-level discovery can start from the box alone.
- Detect & analyze: find the assets, choose where their imagery comes from, and pick the model and prompt.
- Assets: detect them in the image with SAM 3 (on a Bing or Google basemap, or the image itself, with an option to keep every instance of countable objects such as vehicles separate), discover objects along a Mapillary street survey (
vehicles, utility poles, fire hydrantsare located from Mapillary's own detections within the image extent, with the survey vehicle removed and sightings triangulated), or load a file with their locations. - Imagery for analysis: aerial crops from the loaded image (with edge handling), Google Street View panoramas cropped to each footprint (no key), Mapillary panoramas of each footprint, or the closest Mapillary views of each discovered object. The asset can be marked on every crop with an outline, bounding box or corner brackets.
- Model: every analysis model in
rapidtoolsis available: Google Gemini, Anthropic Claude, OpenAI, Meta Muse Spark, and Qwen through their APIs; Gemma-4, Llama Vision, Muse Glimmer, and Qwen locally; and, under Other open models, any Hugging Face vision-language checkpoint with optional 4-bit loading. Fetch models lists the model IDs your API key can access. Temperature, output length and JSON mode live under Advanced options. - Prompt: load one of the sample prompts (aerial CHS, street-level CHS, street-level recovery), a file, or open the prompt builder. The builder walks through task and role, output fields (which become the asset attributes), visual indicators for every class, analysis steps and edge cases, and assembles a prompt in the layout of the sample prompts. Its assistant uses any of the same model backends (the analysis model, or a local Gemma-4 / Qwen) to draft the whole specification from a one-line description, refine it on request, suggest indicators for a class, review the finished prompt, or import an existing prompt into the builder.
- Assets: detect them in the image with SAM 3 (on a Bing or Google basemap, or the image itself, with an option to keep every instance of countable objects such as vehicles separate), discover objects along a Mapillary street survey (
- Results: hover over assets to inspect their attributes, click one to see the exact image crops the model analyzed, color the overlay by any inferred attribute, browse the attribute table, and download the GeoJSON outputs.
Sharing the app
Run the server on the machine that has the GPU and the imagery, bind it to the network, and protect it with an access token:
rapidtools-gui --host 0.0.0.0 --token auto --data-root /data/eaton --no-browser
The terminal prints a share link of the form http://<host>:8765/?token=.... Anyone opening that link (or entering the token on the sign-in page) can use the app; everyone else gets the sign-in page. --data-root limits the file browser and every file path to one directory, and RAPIDTOOLS_GUI_TOKEN can supply the token instead of the flag. Everyone connected shares one workspace and one job queue, so this suits a small team taking turns rather than many simultaneous users. Keep the server on your institution's network or a VPN; the token protects the app, not the transport, which is plain HTTP.
The image panel streams the original pixels when you zoom in (toggle Full resolution to fall back to the lightweight preview), so multi-gigabyte orthomosaics can be inspected at native resolution without loading them into the browser.
Bounding boxes can be drawn on a satellite map that also shows where the RAPID street survey has images. Progress and log output stream into the page while the heavy lifting runs on a background thread, and Cancel stops detection or inference at the next tile or batch, keeping any results produced so far. Long runs offer to send an email or webhook message (or a browser alert) when they finish, and the tab can be closed and reopened in the meantime. The same workflow is available headlessly through rapidtools.gui.AssetAnalysisWorkflow for scripting, and the prompt builder through rapidtools.gui.PromptSpec, assemble_prompt and PromptAssistant.
Job Files: Run a Workflow From JSON
A whole workflow can be written down as a JSON job file: an ordered list of steps, where a later step can use what an earlier one produced. The graphical interface works this way itself (every run it starts is a job file under <output folder>/jobs), so the same work can be rerun from a terminal, queued by a scheduler or submitted by another system.
{
"schema": "rapidtools.job",
"schema_version": "1.0",
"output_dir": "output/eaton",
"steps": [
{"id": "sample", "type": "data.download", "params": {"dataset": "eaton_patch1"}},
{
"id": "detect",
"type": "detect.aerial",
"inputs": {"raster": {"step": "sample", "output": "file"}},
"params": {"assets": ["building"], "basemap": "bing"}
},
{
"id": "grade",
"type": "analyze.vlm",
"inputs": {
"raster": {"step": "sample", "output": "file"},
"assets": {"step": "detect", "output": "assets"}
},
"params": {
"prompt": "Damage: [none, minor, major, destroyed]",
"backend": "gemini",
"api_key": {"$env": "GEMINI_API_KEY"}
}
}
]
}
rapidtools-job run job.json # console script installed with the package
rapidtools-job validate job.json # check a job without running it
rapidtools-job steps # the step types and their options, as JSON
python -m rapidtools.jobs run job.json # equivalent to the console script
Or from Python:
from rapidtools.jobs import run_job
run_job('job.json').raise_for_status()
Every step is checked before the first one runs, and a result file (job.result.json, next to the job file) is rewritten at every change of state with each step's status, output files and summary. run exits with 0 when the job finished, 1 when a step failed, 2 when the job file is invalid and 3 when it was canceled. API keys stay out of job files: write {"$env": "VARIABLE"}, or {"$secret": "name"} with a separate --secrets file. The JSON job interface page is the full specification, with JSON Schemas for the three file types, and examples/jobs has jobs ready to run.
Supported Models
Every wrapper exposes list_known_models() (the curated catalog below, no network) and list_available_models(api_key) (live listing from the provider where one exists). Pass any listed ID as model_id; the default is marked in bold.
| Provider / family | load() name · wrapper |
Key (env var) | Models |
|---|---|---|---|
| Google Gemini (API) | 'gemini' · GeminiInference |
GOOGLE_API_KEY |
gemini-3.8-flash, gemini-3.7-flash, gemini-3.6-flash, gemini-3.5-flash, gemini-3.5-flash-lite (analyzer default), gemini-3.1-pro-preview, gemini-3.1-flash-lite, gemini-3.1-flash-image, gemini-3.1-flash-lite-image, gemini-3-flash-preview, gemini-3-pro-image, gemini-omni-1.1-flash |
| Anthropic Claude (API) | 'claude' · ClaudeInference |
ANTHROPIC_API_KEY |
claude-fable-5-1, claude-fable-5, claude-opus-5, claude-opus-4-8, claude-opus-4-7, claude-opus-4-6, claude-sonnet-5, claude-sonnet-4-6, claude-haiku-4-5 |
| OpenAI (API) | 'openai' · OpenAIInference |
OPENAI_API_KEY |
gpt-6-astra, gpt-6-sol, gpt-6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna, gpt-5.5, gpt-5.5-pro, gpt-5.4, gpt-5.4-pro, gpt-5.4-mini, gpt-5.4-nano, gpt-5.2, gpt-5.1, o3, o3-pro, gpt-4.1, gpt-4.1-mini, gpt-4o, gpt-4o-mini |
| Meta Muse Spark (API) | 'muse_spark' · MuseSparkInference |
MODEL_API_KEY |
muse-spark-1.3, muse-spark-1.3-contributor, muse-spark-1.2, muse-spark-1.2-contributor, muse-spark-1.1 |
| Alibaba Qwen (API, Model Studio) | 'qwen' · QwenInference |
DASHSCOPE_API_KEY |
qwen3.8-max, qwen3.8-omni-flash, qwen3.7-plus, qwen3.6-plus, qwen3.5-plus, qwen3-vl-plus, qwen3-vl-flash, qwen-vl-max, qwen-vl-plus |
| Google Gemma 4 (local) | 'gemma4' · Gemma4Inference |
— | google/gemma-4-31B-it, google/gemma-4-26B-A4B-it, google/gemma-4-12B-it, google/gemma-4-E4B-it, google/gemma-4-E2B-it |
| Meta Llama (local) | 'llama' · LlamaVisionInference |
— (gated download) | meta-llama/Llama-4-Scout-17B-16E-Instruct, meta-llama/Llama-4-Maverick-17B-128E-Instruct, meta-llama/Llama-3.2-11B-Vision-Instruct, meta-llama/Llama-3.2-90B-Vision-Instruct |
| Meta Muse Glimmer (local) | 'muse_glimmer' · MuseGlimmerInference |
— | meta-models/Muse-Glimmer-30B (4-bit fits a 24 GB GPU; needs transformers>=5.15) |
| Alibaba Qwen (local) | 'qwen_vl' · QwenVisionInference |
— | Qwen/Qwen3.8-27B, Qwen/Qwen3.6-27B, Qwen/Qwen3.6-35B-A3B, Qwen/Qwen3.5-{397B-A17B, 122B-A10B, 35B-A3B, 27B, 9B, 4B, 2B, 0.8B}, Qwen/Qwen3-VL-{235B-A22B, 32B, 30B-A3B, 8B, 4B, 2B}-Instruct, Qwen/Qwen2.5-VL-{72B, 32B, 7B, 3B}-Instruct, Qwen/Qwen2-VL-{7B, 2B}-Instruct |
| Any Hugging Face VLM (local) | 'hf' · HFVisionInference |
— | Curated list (OPEN_VLM_CATALOG) plus any repo with a chat template; default Qwen/Qwen3.5-4B |
| Meta SAM 3 (local segmentation) | 'sam3' · SAM3Inference (used by SAM3ImageSegmenter, SAM3OrthoFeatureExtractor) |
— | facebook/sam3 |
import rapidtools as rt
cloud = rt.AssetAnalyzer('muse_spark', prompt='Return JSON with a damage_level key.') # key from MODEL_API_KEY
local = rt.AssetAnalyzer('qwen_vl', prompt='Rate the fire damage 0-5.', model_id='Qwen/Qwen3.5-9B', load_in_4bit=True)
model = rt.load('claude') # the wrapper itself, for single images: model.run_inference('roof.jpg', '...')
Contributing, Security and Accessibility
Bug reports, documentation fixes and code are welcome; see CONTRIBUTING.md for the development setup and the checks a pull request must pass, and the wiki for how the pieces fit together. Participation is governed by the Code of Conduct. Our Accessibility Statement describes what we know about using the package, documentation and GUI with assistive technology and how to report barriers.
Feedback without a GitHub account
Email is all you need: uwrapid@uwrapid.org. Send feedback, a question, a bug or a feature idea; say what you were doing, what you expected and what happened, with the rapidtools version and your operating system when it is a bug. A maintainer will answer and, with your agreement, turn the message into a GitHub issue so others can follow it. Leave API keys and access tokens out of the message.
Feedback with a GitHub account
The three forms below open an issue on this repository, where other users can see it, add to it and follow the fix; each asks only for what we need to act on it. They need a GitHub account: clicking a link asks you to sign in first, and GitHub offers to create a free account on that page. If you would rather not, use the email route above.
| I want to... | Open |
|---|---|
| Ask for a capability that is missing | Feature request |
| Report something that fails or gives a wrong result | Bug report |
| Ask a question, or say what worked and what did not | Feedback or question |
Please report security problems privately as described in the Security Policy, not in a public issue: through a GitHub security advisory, or by email with "security" in the subject.
Citing rAPIdtools
If rAPIdtools contributes to your research, please cite it. GitHub's
Cite this repository button (from CITATION.cff) gives APA and BibTeX
entries; each release is also archived on Zenodo with a DOI.
@software{rapidtools,
author = {Cetiner, Barbaros},
title = {rAPIdtools: A high-performance toolkit for performing large-scale AI inference and localization on post-disaster geospatial datasets},
year = {2026},
version = {0.3.0},
doi = {10.5281/zenodo.24542491},
url = {https://github.com/RAPID-Facility/rAPIdtools}
}
rAPIdtools is developed at the NSF NHERI RAPID Facility, University of Washington, supported by the U.S. National Science Foundation.
License
This project is licensed under the BSD-3-Clause License. See the LICENSE file for details.
Metadata
Release files for rapidtools 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rapidtools-0.3.0.tar.gz | 1.1 MB | Without provenance | Details for rapidtools-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rapidtools-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for rapidtools-0.3.0-py3-none-any.whl |
Total release size: 2.0 MB
Release files / rapidtools-0.3.0.tar.gz
| Download URL | rapidtools-0.3.0.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e97182121d19c745222abdfbf7ea6c756d4aba8f568efd5b477c8011c787a41
|
|
BLAKE2b-256 checksum How to use checksums |
46ed0873acaa81f95d09d49034e69897f67d2d3da575d6bb3e4384ba1232a671
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / rapidtools-0.3.0-py3-none-any.whl
| Download URL | rapidtools-0.3.0-py3-none-any.whl |
|---|---|
| Size | 930.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42cfc6fd7c3a0aac26be359a29693552e6af79715c5dcaf30235bac80025785e
|
|
BLAKE2b-256 checksum How to use checksums |
ecf4d1b5daf0855223328240a02098b33d92e8c134da2e19f86e57a780d6ab43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for rapidtools 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.