Inference and postprocessing

From VectorSpaceLab/AREX-Skill · View interactive version

Inference and postprocessing is an AI agent skill from the GitHub repository VectorSpaceLab/AREX-Skill. Route BiRefNet image/video inference, mask saving, foreground refinement, and output validation.

How to use this skill

Skill file

inference-and-postprocessing

Use this sub-skill for BiRefNet inference tasks that need:

Stay in scope

Use the bundled references and scripts when the task is about:

Route elsewhere

Runtime entry points

Operating notes

  1. Start with --help or --dry-run.
  2. Pass --repo-root explicitly so imports stay anchored to the intended checkout.
  3. Choose --model-source local for a checkpoint file or --model-source hf for hub weights.
  4. Use --device auto, cpu, or cuda based on the available backend.
  5. Keep --foreground-refine and --save-comparison enabled when you need matting-style outputs.
  6. Local checkpoints should be cleaned with check_state_dict before loading; the helper does this for you.

Recommended operating flow

  1. Confirm whether the task is single image, directory, video, or repo-style dataset inference.
  2. Run scripts/birefnet_refine_smoke.py --device cpu if the user only needs postprocessing/backend sanity before loading model weights.
  3. Run scripts/birefnet_image_infer.py --dry-run with the intended image directory, output directory, model source, device, and resolution before a real inference run.
  4. For local checkpoints, route persistent key or tensor-size mismatches to ../model-architecture/SKILL.md.
  5. For outputs that will be evaluated with BiRefNet metrics, preserve dataset/model directory names that ../training-and-evaluation/SKILL.md expects.

Done criteria

Output conventions

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.