agentleFS
opengeosopengeos/geoai-skills/skills/detect-objects/SKILL.md

detect-objects

Skill31 starsChanged 8 months agoMITView on GitHub

Run pre-trained AI models on geospatial imagery. Detect buildings, cars, ships, solar panels, agriculture fields, or use text-prompted segmentation with GroundedSAM. Requires GPU for best performance.

  • Installs packages

1 other project uses a version of this, 1 of them edited.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 1

    1. isaaccorley/geospatial-skills★ 7892% same

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository7 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Follow these steps in order.

    line 15
  2. Distinctive:

    If the model name is not recognized, list the available models and ask the user to pick one.

    line 25
  3. Distinctive:

    If no GPU is available, warn the user but continue.

    line 54
  4. Very specific:

    If $1 looks like an absolute path, use it directly.

    line 58
  5. Distinctive:

    If no file specified and state exists, check for recently inspected/downloaded files:

    line 64

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

You are helping the user run AI object detection on geospatial imagery using geoai.

Input: $@

Follow these steps in order.

Step 1 -- Parse arguments

Extract:

  • $0 as the model name: buildings, cars, ships, solar-panels, parking-lots, agriculture, or grounded-sam
  • $1 as the input raster path
  • --text PROMPT for GroundedSAM text-prompted segmentation (required when model is grounded-sam)
  • --output FILE for the output vector file (default: ./<model>_detections.gpkg)

If the model name is not recognized, list the available models and ask the user to pick one.

Model mapping:

ArgumentGeoAI Class
buildingsgeoai.BuildingFootprintExtractor
carsgeoai.CarDetector
shipsgeoai.ShipDetector
solar-panelsgeoai.SolarPanelDetector
parking-lotsgeoai.ParkingSplotDetector
agriculturegeoai.AgricultureFieldDelineator
grounded-samgeoai.GroundedSAM

Step 2 -- Check GPU availability

python3 -c "
import torch
if torch.cuda.is_available():
    print(f'GPU: {torch.cuda.get_device_name(0)}')
    print(f'CUDA: {torch.version.cuda}')
    print(f'Memory: {torch.cuda.get_device_properties(0).total_mem / 1e9:.1f} GB')
else:
    print('GPU: not available (CPU mode)')
    print('Warning: inference will be significantly slower without a GPU')
"

If no GPU is available, warn the user but continue.

Step 3 -- Resolve the input file

If $1 looks like an absolute path, use it directly. Otherwise:

find "$PWD" -name "$1" -not -path '*/.git/*' 2>/dev/null

If no file specified and state exists, check for recently inspected/downloaded files:

STATE_DIR=""
test -f .geoai-skills/state.json && STATE_DIR=".geoai-skills"
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")"
PROJECT_ID="$(echo "$PROJECT_ROOT" | tr '/' '-')"
test -f "$HOME/.geoai-skills/$PROJECT_ID/state.json" && STATE_DIR="$HOME/.geoai-skills/$PROJECT_ID"

Step 4 -- Run the detector

Pre-trained detectors (buildings, cars, ships, solar-panels, parking-lots, agriculture)

python3 -c "
import geoai

detector = geoai.DETECTOR_CLASS()
gdf = detector.predict(
    'INPUT_PATH',
    output_path='OUTPUT_PATH',
)
print(f'Detections: {len(gdf)}')
print(f'Output: OUTPUT_PATH')
print(f'Columns: {list(gdf.columns)}')
if len(gdf) > 0:
    print('---')
    print('Sample (first 5):')
    print(gdf.head().to_string())
"

Replace DETECTOR_CLASS with the appropriate class from the mapping table (e.g. BuildingFootprintExtractor).

GroundedSAM (text-prompted segmentation)

python3 -c "
import geoai

sam = geoai.GroundedSAM()
gdf = sam.predict(
    'INPUT_PATH',
    text_prompt='TEXT_PROMPT',
    output_path='OUTPUT_PATH',
)
print(f'Segments: {len(gdf)}')
print(f'Output: OUTPUT_PATH')
print(f'Columns: {list(gdf.columns)}')
if len(gdf) > 0:
    print('---')
    print('Sample (first 5):')
    print(gdf.head().to_string())
"

Replace TEXT_PROMPT with the user's text prompt.

Replace INPUT_PATH and OUTPUT_PATH with actual values before running.

Step 5 -- Report results

Summarize:

  • Model used
  • Number of detections/segments
  • Output file path
  • Sample of results

Then suggest: "Use /geoai-skills:inspect-geo to examine the detection output."

Error handling

  • import geoai fails -> delegate to /geoai-skills:install-geoai.
  • import torch fails -> suggest installing PyTorch: pip install torch torchvision.
  • CUDA out of memory -> suggest reducing the tile size or processing a smaller area. If the detector accepts a tile_size parameter, recommend a smaller value.
  • Model download fails -> check network connectivity. Models are downloaded from Hugging Face on first use.
  • Input is not a raster -> suggest using a GeoTIFF file. If the user has a vector file, suggest /geoai-skills:process-raster vector-to-raster first.
  • GroundedSAM without --text -> ask the user for a text prompt describing what to detect.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.