Agent skill

Automatic Mask Generation

by VectorSpaceLab in VectorSpaceLab/AREX-Skill

Generate masks for all objects in images or folders with Segment Anything's SamAutomaticMaskGenerator and the bundled AMG CLI.

Apache-2.0Auto-check passedDocuments & Office

Install Automatic Mask Generation

skills CLI
$ npx skills add VectorSpaceLab/AREX-Skill --skill automatic-mask-generation -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install VectorSpaceLab/AREX-Skill automatic-mask-generation --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/VectorSpaceLab/AREX-Skill.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/repositories/repo-skills/segment-anything/sub-skills/automatic-mask-generation .claude/skills/automatic-mask-generation && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
automatic-mask-generation
GitHub stars
330
Token cost
~650 tokens
SKILL.md length
201 words
Files
6 (incl. scripts, references)
Skills in repo
159
Repo updated
First seen
Licence
Apache-2.0

At a glance

Generate masks for all objects in images or folders with Segment Anything's SamAutomaticMaskGenerator and the bundled AMG CLI.

  • Batch automatic masks
  • SKILL.md covers Quick Start, Routing and Key Defaults
  • Runs Python scripts from its folder; calls python
  • PNG/CSV outputs

What it does

Automatic Mask Generation is an agent skill from VectorSpaceLab/AREX-Skill. Generate masks for all objects in images or folders with Segment Anything's SamAutomaticMaskGenerator and the bundled AMG CLI. Use for batch automatic masks, PNG/CSV outputs, COCO RLE JSON, threshold tuning, crop settings, and memory-aware AMG runs.

Its SKILL.md is about 650 tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including scripts and reference files (for example `references/api-reference.md`, `references/cli-reference.md` and `references/troubleshooting.md`).

It sits in Documents & Office, covering CSV and tabular files. The repository describes itself as: A Skill Library for Automated Machine Learning. The licence is Apache-2.0.

When your agent uses it

  • Batch automatic masks
  • PNG/CSV outputs
  • Threshold tuning
  • Memory-aware AMG runs

Example prompts

  • “/automatic-mask-generation”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit ac3fe1a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Automatic Mask Generation loads about 650 tokens when it runs, and up to ~4.2k if it reads all its reference files. Until then it costs about 69 tokens; SKILL.md has 201 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~69
When it runs · the whole SKILL.md, loaded when a task matches
~650
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from VectorSpaceLab/AREX-Skill at commit ac3fe1a, republished under its Apache-2.0 licence (© VectorSpaceLab). 201 words, ~650 tokens.

Download SKILL.mdSave it as .claude/skills/automatic-mask-generation/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
automatic-mask-generation
description
Generate masks for all objects in images or folders with Segment Anything's SamAutomaticMaskGenerator and the bundled AMG CLI. Use for batch automatic masks, PNG/CSV outputs, COCO RLE JSON, threshold tuning, crop settings, and memory-aware AMG runs.
disable-model-invocation
true
metadata.disco-role
operating
license
Apache 2.0

Automatic Mask Generation

Use this sub-skill when the user wants SAM to segment all visible objects in an image or folder without point or box prompts. It covers SamAutomaticMaskGenerator, the bundled scripts/amg_cli.py, binary mask PNG folders, metadata.csv, COCO RLE JSON, threshold tuning, crop expansion, batching, and memory tradeoffs.

Do not use this sub-skill for prompted point/box/mask refinement; route those requests to ../prompted-segmentation/. Do not use it for ONNX export, browser inference, or the web demo; route those requests to ../onnx-and-browser/.

Quick Start

bash
python sub-skills/automatic-mask-generation/scripts/amg_cli.py \
  --checkpoint sam_vit_b_01ec64.pth \
  --model-type vit_b \
  --input images/ \
  --output masks/ \
  --device cpu

For COCO-style RLE JSON instead of per-mask PNG folders:

bash
python sub-skills/automatic-mask-generation/scripts/amg_cli.py \
  --checkpoint sam_vit_h_4b8939.pth \
  --model-type vit_h \
  --input image.jpg \
  --output masks-rle/ \
  --convert-to-rle \
  --device cuda

Routing

  • Use references/api-reference.md for direct Python use of SamAutomaticMaskGenerator and returned annotation records.
  • Use references/cli-reference.md for exact bundled CLI flags, output layout, and optional dependency checks.
  • Use references/workflows.md for folder runs, COCO RLE conversion, threshold tuning, and avoiding GPU out-of-memory failures.
  • Use references/troubleshooting.md for missing cv2, missing pycocotools, checkpoint/model mismatch, CPU fallback, unreadable images, empty output, and memory blowups.

Key Defaults

  • Registry keys are default, vit_h, vit_l, and vit_b; default is equivalent to the ViT-H builder.
  • SamAutomaticMaskGenerator(model) defaults to points_per_side=32, points_per_batch=64, pred_iou_thresh=0.88, stability_score_thresh=0.95, crop_n_layers=0, min_mask_region_area=0, and output_mode="binary_mask".
  • output_mode="coco_rle" requires pycocotools; min_mask_region_area > 0 requires OpenCV.
  • Large images, high points_per_side, large points_per_batch, crop layers, and binary mask output all increase memory use.

© VectorSpaceLab, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (scripts, references) in skills/repositories/repo-skills/segment-anything/sub-skills/automatic-mask-generation of VectorSpaceLab/AREX-Skill.

  • SKILL.md
  • references/api-reference.md
  • references/cli-reference.md
  • references/troubleshooting.md
  • references/workflows.md
  • scripts/amg_cli.py

Open the folder on GitHubat commit ac3fe1a

Compare with similar skills

Automatic Mask Generation next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Automatic Mask Generation compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Automatic Mask Generation this skillVectorSpaceLab/AREX-Skill330—~650Automated safety check: PassApache-2.0
Data Table Managern8n-io/n8n207k—~2.3kAutomated safety check: PassCustom licence
Instrument Data To Allotropeaws-samples/amazon-bedrock-agents-healthcare-lifesciences2742 repos~2.7kAutomated safety check: PassApache-2.0
Abuse Hunternexu-io/harness-engineering-guide664—~1.9kAutomated safety check: PassMIT
Markitshift-labs-ai/markit1.3k—~299Automated safety check: PassMIT
Sector Analysttradermonty/claude-trading-skills3k1 repos~2.3kAutomated safety check: PassMIT

Similar skills

  • Official

    Load before calling data-tables or parse-file. An agent skill from n8n-io/n8n.

    207k GitHub stars~2.3k tokensUpdated today
    Documents & OfficeAuto-check passed
  • Instrument Data To Allotrope

    aws-samples/amazon-bedrock-agents-healthcare-lifesciences

    Official

    Convert laboratory instrument output files (PDF, CSV, Excel, TXT) to Allotrope Simple Model (ASM) JSON format or flattened 2D CSV.

    274 GitHub starsUsed in 2 repos~2.7k tokens
    Documents & OfficeAuto-check passed
  • Abuse Hunter

    nexu-io/harness-engineering-guide

    Detect and investigate bulk registration abuse on SaaS platforms.

    664 GitHub stars~1.9k tokensUpdated 5 mo ago
    Documents & OfficeAuto-check passed
  • Markit

    shift-labs-ai/markit

    Convert files and URLs to Markdown. An agent skill from shift-labs-ai/markit.

    1.3k GitHub stars~299 tokensUpdated 1 mo ago
    Documents & OfficeAuto-check passed
  • Sector Analyst

    tradermonty/claude-trading-skills

    This skill should be used when analyzing sector rotation patterns and market cycle positioning.

    3k GitHub starsUsed in 1 repo~2.3k tokens
    Documents & OfficeAuto-check passed
  • Uap Release Analyzer

    ckpxgfnksd-max/uap-release-analyzer

    Inventory, extract, and analyze tranches of declassified UAP/UFO files — including war.gov/UFO/ "PURSUE" releases, FBI Vault, NARA boxes, and AARO publications.

    155 GitHub stars~2.6k tokensUpdated 5 mo ago
    Documents & OfficeAuto-check passed

More from VectorSpaceLab/AREX-Skill

All 159 skills in this repo
  • Agent Lightning

    VectorSpaceLab/AREX-Skill

    Use this repo skill for Agent Lightning package tasks: authoring trainable agents, tracing rewards and spans, running LightningStore/Trainer loops, using agl CLI services, choosing examples, and…

    330 GitHub stars~1.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Agent Tools

    VectorSpaceLab/AREX-Skill

    A skill your agent uses when configuring LiteLLM for MCP tools, A2A agents, Claude Code/Cursor agent gateway traffic, MCP auth/OAuth, tool permissions, semantic filtering, or agent-specific proxy…

    330 GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed
  • Agents And Awel

    VectorSpaceLab/AREX-Skill

    Build and debug DB-GPT agents, tools, skills, teams, and AWEL workflows, including deterministic local DAG runs and HTTP-trigger topology without assuming an LLM, credential, or external service.

    330 GitHub stars~2.3k tokensUpdated 1 mo ago
    Auto-check passed
  • Agents And Middleware

    VectorSpaceLab/AREX-Skill

    Work on the actively maintained LangChain v1 agent package: initchatmodel, createagent, structured output, tools, middleware, embeddings initialization, provider routing, and agent runtime…

    330 GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed
  • Agents Workflows

    VectorSpaceLab/AREX-Skill

    A skill your agent uses for giskard.agents async chat workflows, tools, prompt templates, structured outputs, retries, rate limiting, embeddings, and optional LiteLLM backend.

    330 GitHub stars~500 tokensUpdated 1 mo ago
    Auto-check passed
  • Alphafold3

    VectorSpaceLab/AREX-Skill

    A skill your agent uses for AlphaFold 3 input preparation, prediction command planning, output interpretation, and Python API inspection.

    330 GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed

Questions about Automatic Mask Generation

What does Automatic Mask Generation do?

Generate masks for all objects in images or folders with Segment Anything's SamAutomaticMaskGenerator and the bundled AMG CLI. Automatic Mask Generation is an agent skill from VectorSpaceLab/AREX-Skill. Generate masks for all objects in images or folders with Segment Anything's SamAutomaticMaskGenerator and the bundled AMG CLI.

When should I use Automatic Mask Generation?

Automatic Mask Generation fits situations like: batch automatic masks; PNG/CSV outputs; threshold tuning; memory-aware AMG runs.

How do I install Automatic Mask Generation in Claude Code?

Run `npx skills add VectorSpaceLab/AREX-Skill --skill automatic-mask-generation -a claude-code`. Or copy the skill folder (skills/repositories/repo-skills/segment-anything/sub-skills/automatic-mask-generation in VectorSpaceLab/AREX-Skill) into .claude/skills/automatic-mask-generation in your project. Claude Code loads it when a task matches its description.

How do I install Automatic Mask Generation in Codex?

Run `npx skills add VectorSpaceLab/AREX-Skill --skill automatic-mask-generation -a codex`. Or copy the skill folder (skills/repositories/repo-skills/segment-anything/sub-skills/automatic-mask-generation in VectorSpaceLab/AREX-Skill) into .agents/skills/automatic-mask-generation in your project. Codex loads it when a task matches its description.

Can I use Automatic Mask Generation in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add VectorSpaceLab/AREX-Skill --skill automatic-mask-generation -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/automatic-mask-generation, .gemini/skills/automatic-mask-generation, .github/skills/automatic-mask-generation and .opencode/skills/automatic-mask-generation in your project.

What does Automatic Mask Generation need to run?

Going by SKILL.md and its folder, Automatic Mask Generation needs Python for the scripts in its folder and the command-line tools its instructions call (python). Our summary lists: Python 3.

Does Automatic Mask Generation access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Automatic Mask Generation safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Automatic Mask Generation use?

Automatic Mask Generation is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Automatic Mask Generation use?

About 650 tokens (SKILL.md is roughly 2.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.5k tokens, read only when the agent opens those files.

What are the alternatives to Automatic Mask Generation?

Skills that share tags, products or a category with Automatic Mask Generation: Data Table Manager (n8n-io/n8n, 207k stars), Instrument Data To Allotrope (aws-samples/amazon-bedrock-agents-healthcare-lifesciences, 274 stars), Abuse Hunter (nexu-io/harness-engineering-guide, 664 stars) and Markit (shift-labs-ai/markit, 1.3k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Automatic Mask Generation?

VectorSpaceLab (a GitHub organization) maintains it in VectorSpaceLab/AREX-Skill, which has 330 GitHub stars. The repository holds 159 skills in this directory. The repository was last updated on September 3, 2026.

Source: VectorSpaceLab/AREX-Skill on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.