{"id":48948314,"url":"https://github.com/felimet/label-anything-sam","last_synced_at":"2026-04-24T05:04:35.510Z","repository":{"id":349630612,"uuid":"1202049259","full_name":"felimet/label-anything-sam","owner":"felimet","description":"Label Studio + MinIO + SAM3/2.1 ML Backend — Docker Compose stack with Cloudflare Tunnel","archived":false,"fork":false,"pushed_at":"2026-04-17T16:33:17.000Z","size":1900,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-17T18:40:44.868Z","etag":null,"topics":["cloudflare-tunnel","docker-compose","label-studio","machine-learning","minio","sam3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/felimet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-05T14:28:34.000Z","updated_at":"2026-04-17T16:33:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/felimet/label-anything-sam","commit_stats":null,"previous_names":["felimet/label-studio-compose","felimet/label-anything-sam"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/felimet/label-anything-sam","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felimet%2Flabel-anything-sam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felimet%2Flabel-anything-sam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felimet%2Flabel-anything-sam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felimet%2Flabel-anything-sam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felimet","download_url":"https://codeload.github.com/felimet/label-anything-sam/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felimet%2Flabel-anything-sam/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32209897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T03:15:14.334Z","status":"ssl_error","status_checked_at":"2026-04-24T03:15:11.608Z","response_time":64,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudflare-tunnel","docker-compose","label-studio","machine-learning","minio","sam3"],"created_at":"2026-04-17T18:04:55.858Z","updated_at":"2026-04-24T05:04:35.505Z","avatar_url":"https://github.com/felimet.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# label-anything-sam\n\n[![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)\n![Docker Compose](https://img.shields.io/badge/Docker-Compose-2496ED?logo=docker\u0026logoColor=white)\n![Supabase Standalone](https://img.shields.io/badge/Supabase-Standalone-3ECF8E?logo=supabase\u0026logoColor=white)\n![Label Studio](https://img.shields.io/badge/Label%20Studio-Production%20Stack-7F52FF)\n![SAM Backends](https://img.shields.io/badge/SAM-SAM3%20%2B%20SAM2.1-FF6B35)\n\nTraditional Chinese version: [README.zh-TW.md](README.zh-TW.md)\n\n## Why this repository exists\n\nAs of 2026-04, the upstream [Label Studio ML backend](https://github.com/HumanSignal/label-studio-ml-backend) does not provide a maintained SAM3 integration path for production deployment. This repository provides a practical, deployment-focused stack:\n\n- Core services: Label Studio + PostgreSQL + Redis + MinIO + Nginx + Cloudflare Tunnel\n- Optional GPU overlays: SAM3 image/video backends and SAM2.1 image/video backends\n- Security-first defaults for S3 access, token usage, and network exposure\n\n\u003e [!NOTE]\n\u003e Version guidance:\n\u003e\n\u003e - `main` and release `v1.1.4` include all SAM3 fixes and enhancements:\n\u003e   native point embeddings (image + video), mask selection modes (`adaptive`/`top1`/`topk`/`threshold`/`all`),\n\u003e   runtime threshold and selection-mode UI overrides, bidirectional video tracking, multi-object track merging,\n\u003e   and dual text-prompt fields (pure vs mixed-use).\n\u003e - **If you prefer native PostgreSQL mode (no Supabase), use release `v1.0.4` (hotfix line based on pre-Supabase baseline).**\n\u003e - You can get each line in any of these ways:\n\u003e   1. Git checkout (recommended for local dev)\n\u003e   2. Download `Source code (zip)` from the corresponding Release\n\u003e   3. Switch Branch/Tag in GitHub UI\n\u003e\n\u003e ```bash\n\u003e git fetch --tags\n\u003e git checkout tags/v1.1.4 -b local-main-v1.1.4\n\u003e # or\n\u003e git checkout tags/v1.0.4 -b local-v1-native-pg\n\u003e ```\n\u003e\n\u003e In `v1.0.4`, Label Studio data is stored in native PostgreSQL (`pg-db`) and does not require `.env.supabase` or `make supabase-up`.\n\n## Quick Start\n\n```bash\ngit clone https://github.com/felimet/label-anything-sam\ncd label-anything-sam\n\n# 1) Core stack\ncp .env.example .env\n# Supabase standalone is required for default Label Studio DB path in this branch\ncp .env.supabase.example .env.supabase\n# Fill all \u003cPLACEHOLDER\u003e values\n# LABEL_STUDIO_USER_TOKEN must be \u003c= 40 chars (use: openssl rand -hex 20)\n# IMPORTANT: keep POSTGRES_PASSWORD in .env and .env.supabase the same\n\nmake supabase-up\nmake up\nmake init-minio\n\n# 2) Optional ML backends (GPU)\ncp .env.ml.example .env.ml\n# Set LABEL_STUDIO_API_KEY (Legacy Token) and HF_TOKEN\n\nmake ml-up\n\n# 3) Optional RedisInsight (Redis GUI)\ncp .env.tools.example .env.tools\nmake tools-up\n\n# 4) Supabase management command aliases\n# (already started in step 1 for default DB route)\n# make supabase-up / make supabase-down / make supabase-logs\n\n# 5) Optional SAM3 Agent (LLM-assisted mask selection for SAM3 backend)\ncp .env.sam3_agent.example .env.sam3_agent\n# Set SAM3_AGENT_ENABLED=true and configure LLM endpoint (URL / KEY / MODEL)\n# All supported providers (vLLM, Ollama, OpenAI, Gemini, Groq, etc.) are documented\n# in .env.sam3_agent.example. The LLM MUST support vision (multimodal) input.\n\nmake up-sam3-agent\n# To apply LLM config changes without rebuilding: make restart-sam3-agent\n```\n\nOverlay minimal example for Label Studio integration (NOT part of this branch runtime flow):\n\n```bash\n# Example pairing only:\n# docker-compose.supabase.sample.yml + .env.supabase.sample.template\ncp .env.supabase.sample.template .env.supabase.sample\nmake supabase-sample-up SUPABASE_SAMPLE_ENV=.env.supabase.sample\n```\n\nOptional Cloudflare Tunnel admin routes are configured in Cloudflare UI (not via env vars), for example:\n\n```text\nsupabase-studio.example.com -\u003e http://supabase-studio:3000\nsupabase-meta.example.com   -\u003e http://supabase-meta:8080\nredisinsight.example.com    -\u003e http://redisinsight:5540\n```\n\nIf `SUPABASE_META_CONTAINER_PORT` is changed, update the `supabase-meta` target port in Cloudflare accordingly.\n\nSee [docs/cloudflare-tunnel.md](docs/cloudflare-tunnel.md) for the complete mapping table and CF Access requirements.\n\nOpen:\n\n- Label Studio: `http://localhost:18090`\n- MinIO Console: `http://localhost:19001`\n- MinIO Full Admin UI: `http://localhost:19002`\n\nVerify stack health:\n\n```bash\nmake health\n```\n\n## Direct Compose (Without Make)\n\nIf you prefer typing `docker compose -f ... up` directly, keep two safeguards enabled:\n\n1. Interpolation safeguard: always provide a fixed project name plus explicit env files.\n2. Runtime safeguard: keep service-level `env_file` (for ML backends) and required vars (`${VAR:?}`) in compose files.\n\nPowerShell session defaults (recommended):\n\n```powershell\n$env:COMPOSE_PROJECT_NAME = \"label-anything-sam\"\n```\n\nStandalone Supabase (default branch runtime):\n\n```bash\ndocker compose --project-name label-anything-sam \\\n\t--env-file .env --env-file .env.supabase \\\n\t-f docker-compose.supabase.yml up -d\n```\n\nSupabase sample mode:\n\n```bash\ndocker compose --project-name label-anything-sam \\\n\t--env-file .env --env-file .env.supabase.sample \\\n\t-f docker-compose.yml -f docker-compose.override.yml -f docker-compose.supabase.sample.yml up -d\n```\n\nML overlays:\n\n```bash\ndocker compose --project-name label-anything-sam \\\n\t--env-file .env \\\n\t-f docker-compose.yml -f docker-compose.override.yml -f docker-compose.ml.yml up -d\n```\n\nOptional one-liner fallback (`--env-file` omitted):\n\n```powershell\n$env:COMPOSE_ENV_FILES = \".env,.env.supabase\"\ndocker compose -f docker-compose.supabase.yml config -q\n```\n\n`COMPOSE_ENV_FILES` is only used when CLI `--env-file` is not provided.\n\n## Critical Notes Before You Continue\n\n- Use **Legacy Token** for ML backends, not Personal Access Token.\n- Use `MINIO_LS_ACCESS_ID` / `MINIO_LS_SECRET_KEY` for Label Studio S3 storage, never root credentials.\n- Rotate MinIO service-account credentials immediately after first deployment.\n- If changing `.env`, recreate containers (`down` + `up`) instead of only `restart`.\n\n## Environment Profiles\n\nTo avoid one oversized env file, variables are split by scope:\n\n- `.env.example` → `.env`: Core runtime stack (required)\n- `.env.ml.example` → `.env.ml`: SAM3/SAM2.1 backends (optional)\n- `.env.tools.example` → `.env.tools`: Local dev tools such as RedisInsight (optional)\n- `.env.supabase.example` → `.env.supabase`: Supabase standalone management stack (required)\n- `.env.supabase.sample.template` → `.env.supabase.sample`: Supabase minimal example mode (documentation/demo only)\n\nSupabase mode boundaries:\n\n- Runtime mode (this branch): `docker-compose.supabase.yml` + `.env.supabase`\n- Example mode only: `docker-compose.supabase.sample.yml` + `.env.supabase.sample`\n\n`.env.example` is the single complete core template.\n\n## Start Here By Role\n\n| Role | Start Here | Cookbook | Deep Dive |\n|------|------------|----------|-----------|\n| End User / Project Admin | [docs/README.md](docs/README.md) | [docs/cookbook/user-cookbook.md](docs/cookbook/user-cookbook.md) | [docs/user-guide.md](docs/user-guide.md) |\n| Developer | [docs/README.md](docs/README.md) | [docs/cookbook/developer-cookbook.md](docs/cookbook/developer-cookbook.md) | [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md) |\n| Operator / SRE | [docs/README.md](docs/README.md) | [docs/cookbook/ops-cookbook.md](docs/cookbook/ops-cookbook.md) | [docs/RUNBOOK.md](docs/RUNBOOK.md) |\n\n## Documentation Map\n\n- [docs/README.md](docs/README.md): Documentation hub and reading paths\n- [docs/user-guide.md](docs/user-guide.md): User workflows and admin operations\n- [docs/configuration.md](docs/configuration.md): Single source of truth for environment variables\n- [docs/architecture.md](docs/architecture.md): Topology, data flow, and security design\n- [docs/cloudflare-tunnel.md](docs/cloudflare-tunnel.md): Public exposure, tunnel, and WAF setup\n- [docs/sam3-backend.md](docs/sam3-backend.md): SAM3 backend behavior and constraints\n- [docs/sam21-backend.md](docs/sam21-backend.md): SAM2.1 backend behavior and constraints\n- [docs/RUNBOOK.md](docs/RUNBOOK.md): Operations, incident response, backup and restore\n- [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md): Development workflow and contribution policy\n\n## Make Targets (Short List)\n\n- `make up / down / restart / logs / ps`: Core stack lifecycle\n- `make ml-up / ml-down`: Core stack with ML overlays\n- `make tools-up / tools-down / tools-logs`: RedisInsight local GUI overlay\n- `make supabase-up / supabase-down / supabase-logs`: Supabase management (standalone stack, default)\n- `make supabase-standalone-up / supabase-standalone-down / supabase-standalone-logs`: Explicit standalone aliases\n- `make supabase-sample-up / supabase-sample-down / supabase-sample-logs`: Supabase minimal example mode (studio + meta)\n- `make build-sam3-image / build-sam3-video / build-sam21-image / build-sam21-video`: Build ML images\n- `make test-sam3-image / test-sam3-video / test-sam21-image / test-sam21-video`: Run ML backend tests\n- `make init-minio`: One-time bucket and service-account initialization\n- `make health`: End-to-end health checks\n\n## Batch Annotation\n\nRun SAM3 or SAM2.1 inference on an entire Label Studio project in one command —\nfrom the CLI or from a browser-based Web UI (no terminal required).\n\n```bash\n# CLI: annotate all tasks in project 1 with SAM3\npython scripts/batch_annotate.py --project-id 1 --backend sam3 \\\n    --text-prompt \"cow, grass, fence\"\n# or\nmake batch-annotate PROJECT_ID=1\n\n# Web UI: open http://\u003cyour-server\u003e:8085 in a browser\nmake batch-server\n```\n\n![batch-annotation-ui](image/batch-annotation-ui.png)\n\nSee [docs/batch-annotation.md](docs/batch-annotation.md) for full CLI reference,\nSAM3 vs SAM2.1 comparison, concurrency settings, and Web UI deployment.\n\n## Label Studio Annotation UI (SAM3-image)\n\n![ann-ui](image/ann-ui.png)\n\n## License\n\nApache-2.0 © 2026 Jia-Ming Zhou\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelimet%2Flabel-anything-sam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelimet%2Flabel-anything-sam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelimet%2Flabel-anything-sam/lists"}