Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions plugins/Corgiac/dance-anonymizer/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Dance Anonymizer Skill contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
50 changes: 50 additions & 0 deletions plugins/Corgiac/dance-anonymizer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Dance Anonymizer Plugin

Use MiniMax Code to operate, troubleshoot, and extend an existing local [DanceAnon](https://github.com/Corgiac/dance-anonymizer) project. The Plugin bridges the setup and operational knowledge gap between a general coding agent and DanceAnon's YOLO, SAM2, CUTIE, FastAPI, video, model, and device-specific workflow.

## Included capability

- `dance-anonymizer`: Locates the project, checks its runtime prerequisites, launches the Web interface, runs command-line video processing, diagnoses common errors, and guides focused code changes.

## Requirements

- A local copy of the DanceAnon project.
- Python 3.10 or newer.
- Project dependencies from `requirements.txt`.
- The model files required by the DanceAnon README.
- `ffmpeg` when audio preservation or muxing is needed.
- Sufficient local disk, memory, and compute resources for computer-vision model inference.

The Skill checks `DANCE_ANON_HOME`, the current workspace, an explicitly supplied path, and nearby local clones named `dance-anonymizer` when resolving the project root. If no local copy exists, it guides the user to clone `https://github.com/Corgiac/dance-anonymizer`.

## Example

```text
Use the dance-anonymizer skill to check whether my DanceAnon project can start. Do not install or download anything yet.
```

```text
Use the dance-anonymizer skill to process /absolute/path/input.mp4 into /absolute/path/output.mp4. Check the environment and model files before executing.
```

## Expected result

MiniMax Code locates a local DanceAnon checkout, checks Python and project prerequisites before taking action, selects the Web or CLI workflow, uses the repository's own launch and processing entry points, and reports the exact output path or startup address. Missing dependencies and models are reported without silently installing or downloading them.

## Supported platforms

- macOS, including Apple Silicon with MPS where supported by the installed PyTorch build.
- Windows, using the repository's bundled batch scripts.
- Linux, using the Python CLI or direct Uvicorn startup.

## Network access

The Plugin itself performs no network requests and requires no account, API key, or paid service. The underlying project setup may access GitHub, Python package indexes, and model download hosts documented by DanceAnon only when the user explicitly requests cloning, installation, or downloading.

## Data use

The Plugin contains instructions only. Source paths, environment diagnostics, model status, and video paths may be read locally to complete a requested task. Video files are processed by the local DanceAnon project. The Plugin does not add telemetry, upload code, or send videos to an external service.

## Safety

The Skill instructs the agent to request confirmation before installing packages, downloading large models, terminating processes, or overwriting output videos.
21 changes: 21 additions & 0 deletions plugins/Corgiac/dance-anonymizer/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"name": "dance-anonymizer",
"version": "1.0.0",
"description": "Operate, troubleshoot, and extend a local DanceAnon video anonymization project from MiniMax Code.",
"author": {
"name": "Corgiac",
"url": "https://github.com/Corgiac"
},
"homepage": "https://github.com/Corgiac/dance-anonymizer",
"repository": "https://github.com/MiniMax-AI/MiniMax-Code-Plugins",
"license": "MIT",
"keywords": [
"video",
"anonymization",
"computer-vision",
"yolo",
"sam2",
"fastapi"
]
}
132 changes: 132 additions & 0 deletions plugins/Corgiac/dance-anonymizer/skills/dance-anonymizer/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
---
name: dance-anonymizer
description: Operate, configure, troubleshoot, and extend the local DanceAnon dance-video anonymization project. Use when the user asks to install or launch DanceAnon, anonymize people in a video, run its CLI or FastAPI web interface, configure YOLO/SAM2/CUTIE tracking, adjust visual effects, diagnose model or ffmpeg problems, or modify the dance-anonymizer codebase.
---

# Dance Anonymizer

Use the local DanceAnon project to detect, track, anonymize, and apply effects to people in dance videos.

## Resolve the project root

Resolve the project root before running commands. Use the first valid location:

1. The `DANCE_ANON_HOME` environment variable.
2. The current workspace when it contains `main.py`, `api.py`, `config.yaml`, and `src/`.
3. A path explicitly supplied by the user.
4. A local clone named `dance-anonymizer` under the current workspace or its parent.
5. If no valid local copy exists, guide the user to clone `https://github.com/Corgiac/dance-anonymizer` and ask them to confirm the destination before cloning.

Store the chosen path conceptually as `<PROJECT_ROOT>` and run project commands from it. Do not assume that the Skill directory contains the application source or model weights.

## Choose the workflow

- Use the Web workflow when the user wants interactive person selection, preview, stickers, beauty effects, leg stretching, camera following, cropping, or browser-based export.
- Use the CLI workflow when the user provides an input video and output path and wants batch processing or automation.
- Use the Development workflow when the user asks to inspect, fix, or extend the project.

## Prepare the environment

1. Confirm Python 3.10 or newer.
2. Confirm `<PROJECT_ROOT>/yolo11s-seg.pt` exists.
3. Confirm `<PROJECT_ROOT>/sam2_hiera_tiny.pt` exists before SAM2 processing. If it is absent, explain that the user must obtain the model referenced by the project README; do not silently substitute another checkpoint.
4. Confirm CUTIE weights exist under `<PROJECT_ROOT>/vendor/Cutie/weights/` when the selected tracking engine requires them.
5. Prefer the project's `.venv` Python when `.venv` exists.
6. Check for `ffmpeg` when audio preservation or final video muxing matters.
7. Ask before installing packages, downloading large models, killing processes, or overwriting an existing output video.

## Web workflow

On macOS or Linux, prefer the bundled launcher:

```bash
cd <PROJECT_ROOT>
bash scripts/mac/run.sh
```

If the environment is already installed, the equivalent direct command is:

```bash
cd <PROJECT_ROOT>
.venv/bin/python -m uvicorn api:app --host 0.0.0.0 --port 8002
```

On Windows, use `scripts\windows\run.bat` from the project root.

Tell the user to open `http://localhost:8002`. Do not claim the service is ready until the process reports that Uvicorn is running. If port 8002 is occupied, identify the process first and request confirmation before terminating it.

## CLI workflow

Use `main.py` for a direct video-processing job:

```bash
cd <PROJECT_ROOT>
.venv/bin/python main.py \
--input "/absolute/path/input.mp4" \
--output "/absolute/path/output.mp4"
```

Supported options include:

- `--target_ids 1,3` to process selected detected person IDs.
- `--thickness 7` to change the effect boundary width.
- `--device mps`, `--device cuda`, or `--device cpu` to select inference hardware.
- `--conf 0.3` to change detection confidence.
- `--temporal_window 3` to tune temporal smoothing.
- `--model /path/to/yolo-model.pt` to override the YOLO model.
- `--config /path/to/config.yaml` to use another configuration.
- `--quiet` to reduce logging.

Use absolute paths for input and output. Create the output directory when necessary. Never overwrite the input file. For an existing output, ask whether to overwrite it or generate a new name.

## Installation workflow

Only install when the user requests it.

On macOS:

```bash
cd <PROJECT_ROOT>
bash scripts/mac/setup.sh
```

On Windows, run `scripts\windows\setup.bat`.

If a bundled setup script fails, inspect the exact failed command before retrying individual steps. Avoid changing package versions until checking `requirements.txt` and the Python/PyTorch platform constraints.

## Development workflow

Read `references/project-guide.md` before modifying the application. Preserve the current architecture unless the user requests a refactor.

When editing:

1. Trace the relevant request from `index.html` or `main.py` into `api.py`, `src/pipeline.py`, `src/tracker.py`, `src/engine.py`, and `src/effects.py`.
2. Keep Web API task lifecycle, cancellation, cleanup, and progress reporting intact.
3. Keep CPU, Apple MPS, and NVIDIA CUDA paths working when practical.
4. Avoid committing model checkpoints, generated videos, uploads, virtual environments, or caches.
5. Run the narrowest relevant check first, then a broader import or startup check.

## Troubleshooting priorities

Diagnose in this order:

1. Wrong working directory or missing virtual environment.
2. Python version or missing dependency.
3. Missing model checkpoint or CUTIE weights.
4. Unsupported `mps`/`cuda` device; retry with `cpu` only after explaining the speed impact.
5. Port 8002 already in use.
6. Missing `ffmpeg`, especially when the result has no audio.
7. Input codec, corrupt video, or unsupported path characters.
8. Person absent from the first frame, excessive crowd size, or low detection confidence.

Report the exact failing command and the most relevant error lines. Do not present a speculative fix as verified.

## Output expectations

At completion, report:

- The project root used.
- The workflow used: Web, CLI, installation, or development.
- The command executed or recommended.
- The output video path or local Web address.
- Any missing model, dependency, device fallback, or unverified step.
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# DanceAnon Project Guide

## Purpose

DanceAnon is a local Python video-processing application for detecting and tracking people in dance videos and applying anonymization or visual effects. It provides both a browser UI and a command-line interface.

## Important files

- `README.md`: Installation, startup, user workflow, requirements, and model information.
- `main.py`: CLI entry point for direct input-to-output processing.
- `api.py`: FastAPI application, task lifecycle, uploads, analysis, rendering, status, cancellation, and cleanup.
- `index.html`: Browser client and interactive controls.
- `config.yaml`: Model, detection, tracking, and effect defaults.
- `src/pipeline.py`: End-to-end video processing orchestration.
- `src/tracker.py`: Initial person detection and tracker configuration.
- `src/engine.py`: Video mask propagation engines, including SAM2/CUTIE integration.
- `src/effects.py`: Mask rendering and visual effects.
- `src/utils.py`: Shared video and image utilities.
- `scripts/mac/setup.sh`: macOS environment setup.
- `scripts/mac/run.sh`: macOS Web server launcher.
- `scripts/windows/setup.bat`: Windows environment setup.
- `scripts/windows/run.bat`: Windows Web server launcher.
- `vendor/Cutie/`: Vendored CUTIE tracking implementation.
- `vendor/sam2/`: Vendored SAM2 implementation.

## Runtime requirements

- Python 3.10 or newer.
- Python packages listed in `requirements.txt`.
- `yolo11s-seg.pt` in the project root for person detection.
- `sam2_hiera_tiny.pt` in the project root for SAM2 mask refinement/tracking.
- CUTIE weights under `vendor/Cutie/weights/` when CUTIE is selected.
- `ffmpeg` for reliable audio preservation and muxing.

## CLI behavior

`main.py` loads `config.yaml`, creates `TrackerConfig`, builds the tracking engine configuration, parses optional target IDs, creates the output directory, and calls `DanceAnonymizerPipeline.process()`.

The device values accepted by the CLI are `mps`, `cuda`, and `cpu`.

## Web behavior

`api.py` exposes a FastAPI service normally launched on port 8002. The browser UI supports uploading and analyzing a clip, choosing people, configuring effects, rendering, polling status, canceling tasks, and cleaning temporary task data.

Treat API changes as coupled with `index.html`. Search both files for an endpoint name or response field before changing it.

## Configuration guidance

Prefer user-supplied CLI options for one-off jobs. Change `config.yaml` only when the user wants persistent defaults. Back up or clearly describe any persistent configuration changes.

For performance problems:

- Prefer `mps` on supported Apple Silicon.
- Prefer `cuda` on a compatible NVIDIA environment.
- Use `cpu` as a compatibility fallback, with substantially slower processing expected.
- Lowering input duration or resolution is safer than making undocumented model substitutions.

## Safe validation

Use the narrowest applicable validation:

```bash
cd <PROJECT_ROOT>
.venv/bin/python -m py_compile main.py api.py src/*.py
```

For CLI argument validation:

```bash
cd <PROJECT_ROOT>
.venv/bin/python main.py --help
```

For Web startup validation:

```bash
cd <PROJECT_ROOT>
.venv/bin/python -m uvicorn api:app --host 127.0.0.1 --port 8002
```

Do not run a full model inference unless a real input video, all required weights, sufficient disk space, and user approval are available.