Image Pipeline Playground
chore: Revise README for improved clarity and structure
Mohammad Rajaei Monfared2e5fa21a5f3f
diff --git a/README.md b/README.mdindex 414fc4e..6ac2544 100644--- a/README.md+++ b/README.md@@ -1,521 +1,282 @@-# Image Pipes+<div align="center">-A visual workflow editor for computer vision pipelines powered by **OpenCV** and **Albumentations**.+# π¨ Image Pipes-Instead of writing hundreds of lines of preprocessing code, build your image processing pipeline visually, inspect every intermediate transformation in real time, and export clean, production-ready Python code.+### Stop scripting. Start seeing.------## π Table of Contents--- [Overview](#overview)-- [Demo](#demo)-- [Why Image Pipes?](#why-image-pipes)-- [Key Features](#key-features)-- [How It Works](#how-it-works)-- [Architecture](#architecture)-- [Tech Stack](#tech-stack)-- [Quick Start](#quick-start)- - [Prerequisites](#prerequisites)- - [Backend Setup](#backend-setup)- - [Frontend Setup](#frontend-setup)- - [Docker Setup](#docker-setup)-- [Quality Checks](#quality-checks)-- [Adding a New Node](#adding-a-new-node)-- [Exporting Code](#exporting-code)-- [Roadmap](#roadmap)-- [Contributing](#contributing)-- [FAQ](#faq)-- [License](#license)+**Build computer vision pipelines visually β inspect every pixel transformation in real time, then export clean, production-ready Python the moment you're happy with the result.**----+<p>+ <img src="https://img.shields.io/badge/Python-3.12+-3776AB?logo=python&logoColor=white" />+ <img src="https://img.shields.io/badge/React-19-61DAFB?logo=react&logoColor=black" />+ <img src="https://img.shields.io/badge/FastAPI-009688?logo=fastapi&logoColor=white" />+ <img src="https://img.shields.io/badge/OpenCV-5C3EE8?logo=opencv&logoColor=white" />+ <img src="https://img.shields.io/badge/Albumentations-Data%20Augmentation-FF4B4B" />+ <img src="https://img.shields.io/badge/Electron-47848F?logo=electron&logoColor=white" />+ <img src="https://img.shields.io/badge/License-MIT-success" />+</p>-# Overview+**β‘ Build β’ Preview β’ Experiment β’ Export**-Image Pipes is a visual workflow editor for computer vision powered by **OpenCV** and **Albumentations**.+[Demo](#-demo) β’+[Features](#-features) β’+[Architecture](#-architecture) β’+[Quick Start](#-quick-start) β’+[Roadmap](#-roadmap)-Instead of writing hundreds of lines of boilerplate preprocessing scripts, you compose your workflow visually, inspect intermediate frame transformations in real time, and export deterministic, production-ready Python code.--```text-ββββββββββββββββ ββββββββββββββββ βββββββββββββββββ ββββββββββββββββ-β Load Image β βββΊ β Grayscale β βββΊ β Gaussian Blur β βββΊ β Canny β-ββββββββββββββββ ββββββββββββββββ βββββββββββββββββ ββββββββββββββββ- β- βΌ- ββββββββββββββββ- β Find Contoursβ- ββββββββββββββββ-```+</div>----# Demo--> [!NOTE]-> **Demo Coming Soon**+## π The Problem-A short GIF/video will showcase:+If you've built a computer vision pipeline before, this loop probably feels familiar:-- **Frontend:** React 19, Vite, TypeScript, MUI, React Flow, Zustand, TanStack Query, React Hook Form, Zod, Monaco-- **Backend:** FastAPI, OpenCV, NumPy, Pillow, Albumentations 2.0.8 (MIT), Pydantic v2, WebSockets-- **Desktop:** Electron + PyInstaller backend sidecar (optional installer)-- **Tooling:** `uv`, `npm`, optional Docker-------# Why Image Pipes?--## Desktop app (recommended for end users)--Image Pipes can run as a single **Electron** desktop app. The window starts the Python backend for you and opens the UIβno separate terminals.+```text+tweak a parameter β run the script β save an image β open it β squint β repeat+```-### Build an installer+Each iteration costs you a context switch. Multiply that by every blur kernel, every threshold value, every augmentation you're tuning, and "quick experiment" turns into an afternoon lost to `cv2.imshow()` windows and throwaway debug scripts.-Requires [Node.js](https://nodejs.org/) and [uv](https://docs.astral.sh/uv/):+**Image Pipes breaks the loop.** Assemble your pipeline as a graph, watch every node's output update live, and walk away with production Python β not a black box you're locked into forever.-```bash-npm run install:all-npm run build:desktop+```text+ββββββββββββββββ+β Load Image β+ββββββββ¬ββββββββ+ βΌ+ββββββββββββββββ+β Resize β+ββββββββ¬ββββββββ+ βΌ+ββββββββββββββββ+β Grayscale β+ββββββββ¬ββββββββ+ βΌ+ββββββββββββββββ+β GaussianBlur β+ββββββββ¬ββββββββ+ βΌ+ββββββββββββββββ+β Threshold β+ββββββββ¬ββββββββ+ βΌ+ββββββββββββββββ+β FindContours β+ββββββββ¬ββββββββ+ βΌ+ Production Python π```-Installers are written to `desktop/release/` (NSIS on Windows, DMG on macOS, AppImage on Linux). See [`desktop/README.md`](desktop/README.md).+----CI builds installers on every push/PR to `main` (and on `workflow_dispatch`) via [`.github/workflows/desktop.yml`](.github/workflows/desktop.yml). Push a `v*` tag to publish a GitHub Release with the artifacts.+## β¨ Features-### Run the desktop shell in development+### π¨ A Canvas, Not a Console-```bash-cd frontend && npm run build && cd ..-cd backend && uv sync && cd ..-npm --prefix desktop install-npm run desktop-```+Assemble pipelines by dragging nodes onto an infinite canvas powered by React Flow. Connect them, configure them through rich auto-generated property panels, and let built-in validation catch mistakes before you ever hit "run."-## Local development (browser)+- Drag & drop nodes with smart, type-aware connections+- Infinite canvas with smooth zoom & pan+- Dynamic property panels generated straight from node metadata+- Real-time validation as you build-1. Edit Python script-2. Run the program-3. Save temporary images-4. Compare outputs-5. Tune parameters-6. Repeat dozens of times+### β‘ Real-Time Preview, Every Step-## Traditional Workflow vs Image Pipes+Every node executes independently, so you can inspect a transformation the instant it happens β no more mentally simulating what five chained `cv2` calls did to your image.-| Traditional | Image Pipes |-|------------|-------------|-| Hundreds of lines of boilerplate | Visual node graph |-| `cv2.imshow()` debugging | Live previews |-| Manual parameter tuning | Interactive controls |-| Hidden intermediate states | Inspect every node |-| Script-only workflow | Export clean Python code |+See, live, at every node:----+- Intermediate image outputs+- Bounding boxes, segmentation masks, and keypoints+- Execution time per node+- Runtime logs-# Key Features+### π§ A Smart Execution Engine Under the Hood-## π¨ Visual Workflow Editor+Pipelines aren't run top-to-bottom blindly. Image Pipes compiles your graph into a **Directed Acyclic Graph (DAG)**, topologically sorts it, and executes only what actually needs to run.-- React Flow powered canvas-- Smooth zoom & pan-- Dynamic grid snapping-- Automatic connection validation-- Rich node controls- - sliders- - dropdowns- - switches- - numeric inputs+- Incremental execution & partial recomputation+- Run-to-selected-node for fast, targeted debugging+- In-memory caching so large pipelines stay snappy+- Full DAG validation before execution----+The result: pipelines with dozens of nodes stay responsive, not sluggish.-## ποΈ Real-Time Preview+### π¦ Metadata-Driven Architecture-- Low-latency WebSocket execution-- Live intermediate images-- Bounding box overlays-- Mask visualization-- Keypoint visualization-- Execution timing-- Runtime logs+Adding a new backend node automatically makes it available in the editor β forms, controls, categories, and validation are all generated for free. **Zero frontend work required.** Implement the node, and the UI builds itself around it.----+### π§ͺ A Serious Computer Vision Toolbox-## π§ͺ Rich Processing Library+Powered by industry-standard libraries, not reinvented wheels.-### OpenCV+**OpenCV** gives you the full classical CV toolkit:-- Color conversions-- Blur & filtering-- Thresholding-- Morphological operations-- Histograms-- Edge detection-- Contours-- Geometric transforms-- K-Means clustering+- Color conversions, blur & filtering, edge detection+- Histograms, morphology, geometric transforms+- Contours, thresholding, K-Means, and much more-### Albumentations+**Albumentations powers first-class data augmentation** right inside the visual graph. Chain augmentations like flips, rotations, color jitter, noise, cutout, and elastic transforms alongside your preprocessing nodes β all while correctly propagating:-Supports:--- Image transforms+- Images- Bounding boxes- Segmentation masks- Keypoints-- Multi-target augmentation--Deterministic seeded execution enables reproducible experiments.-------## β‘ Smart Execution Engine--- DAG validation-- Topological sorting-- Partial execution-- Run-to-selected-node-- In-memory caching-- Incremental recomputation------## π¦ Metadata-Driven Design+Every run is deterministic and seedable, so your augmented datasets are fully reproducible across teammates and experiments β critical for anyone training a model on top of this pipeline.-New processing nodes are automatically discovered.+### π Your Pipeline Is Never Trapped-Adding a backend node requires **zero frontend changes**.+Design visually, but never get locked in. Export readable, standalone Python built on OpenCV and Albumentations β no proprietary runtime, no generated framework, nothing that only works inside Image Pipes.-Features include:--- Automatic node discovery-- Dynamic UI generation-- JSON workspace import/export-------# How It Works--```text-Image- β- βΌ-Visual Graph- β- βΌ-Validate DAG- β- βΌ-Execute Nodes- β- βΌ-Preview Every Step- β- βΌ-Export Native Python+```python+gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)+blur = cv2.GaussianBlur(gray, (5, 5), 0)+edges = cv2.Canny(blur, 50, 150)```------# Architecture--```text- βββββββββββββββββββββββββββ- β React Flow Editor β- ββββββββββββββ¬βββββββββββββ- β- WebSocket / REST- β- βΌ- βββββββββββββββββββββββββββ- β DAG Execution Engine β- ββββββββββββββ¬βββββββββββββ- β- βββββββββββββββββββββββ΄ββββββββββββββββββββββ- βΌ βΌ- ββββββββββββββββββββββ ββββββββββββββββββββββ- β OpenCV Nodes β β Albumentations β- ββββββββββββ¬ββββββββββ ββββββββββββ¬ββββββββββ- β β- βββββββββββββββββββββββ¬ββββββββββββββββββββββ- β- βΌ- βββββββββββββββββββββββββββ- β Previews & Export β- ββββββββββββββ¬βββββββββββββ-```+That's it. That's the export. Drop it straight into your training pipeline, your ETL job, or a notebook.----# Tech Stack+## π Use Cases-## Frontend+Image Pipes fits naturally into workflows like:-| Technology | Purpose |-|------------|---------|-| React 19 | UI |-| TypeScript | Type safety |-| Vite | Build tool |-| React Flow | Graph editor |-| Zustand | State management |-| TanStack Query | Server state |-| Material UI | Components |-| Monaco Editor | Code editor |-| React Hook Form | Forms |-| Zod | Validation |+- Dataset preprocessing for ML training+- Building and tuning data augmentation pipelines with Albumentations+- Teaching computer vision concepts visually+- Rapid OpenCV experimentation and prototyping+- Research reproducibility (deterministic, versionable pipelines)+- Debugging annotation pipelines (boxes, masks, keypoints)+- General image analysis and exploration----## Backend--| Technology | Purpose |-|------------|---------|-| FastAPI | API |-| WebSockets | Live execution |-| Pydantic v2 | Data validation |-| OpenCV | Image processing |-| Albumentations | Data augmentation |-| Pillow | Image loading |-| NumPy | Numerical operations |-| Custom DAG Engine | Workflow execution |-------## Tooling--- Python 3.12+-- uv-- Node.js 20+-- npm-- Docker-- Docker Compose-------# Quick Start--## Prerequisites--- Python **3.12+**-- Node.js **20+**-- **uv** (recommended)-------## Backend Setup--```bash-cd backend--uv sync--uv run uvicorn app.main:app \- --reload \- --port 8000-```--Verify backend:+## π Architecture-```-http://127.0.0.1:8000/api/health+```text+ React Flow Editor+ β+ REST + WebSockets+ β+ βΌ+ DAG Execution Engine+ βββββββββββββββ΄ββββββββββββββ+ β β+ βΌ βΌ+ OpenCV Processing Albumentations+ (classical CV) (data augmentation)+ β β+ βββββββββββββββ¬ββββββββββββββ+ β+ βΌ+ Live Preview & Export+ β+ βΌ+ Standalone Python```----## Frontend Setup+## π Tech Stack-```bash-cd frontend+<table>+<tr>+<td valign="top">-npm install+**Frontend**+- React 19 + TypeScript+- Vite+- React Flow+- Zustand+- TanStack Query+- Material UI+- Monaco Editor+- React Hook Form + Zod-npm run dev-```--Open:--```-http://127.0.0.1:5173-```+</td>+<td valign="top">-The Vite development server automatically proxies:+**Backend**+- FastAPI+- OpenCV+- Albumentations+- NumPy+- Pillow+- WebSockets+- Pydantic v2-- `/api`-- `/ws`+</td>+<td valign="top">-to the backend.+**Desktop**+- Electron-Or with Docker (single container serves UI + API on port 8000):+</td>+</tr>+</table>-```bash-docker compose up --build-```--Open [http://127.0.0.1:8000](http://127.0.0.1:8000). Persistent cache/uploads/outputs use named volumes. Image builds are verified in CI by [`.github/workflows/docker.yml`](.github/workflows/docker.yml).--## Usage+----# Quality Checks+## π Quick Start-## Backend+Clone the repository:```bash-cd backend--uv run ruff check--uv run pytest+git clone https://github.com/mrajaeim/image-pipes.git+cd image-pipes```-## Frontend+Install everything:```bash-cd frontend--npm run lint--npm run typecheck-```-------# Adding a New Node--Image Pipes uses a metadata-driven architecture.--Adding a custom node requires **zero frontend modifications**.--## 1. Create a Node--```python-from app.nodes.base import BaseNode-import cv2--class GaussianBlurNode(BaseNode):- category = "Filters"- display_name = "Gaussian Blur"-- def execute(self, inputs: dict, params: dict):- kernel_size = params.get("kernel_size", 5)- k = kernel_size if kernel_size % 2 else kernel_size + 1- output = cv2.GaussianBlur(inputs["image"], (k, k), 0)- return {"image": output}-- def emit_python(self, inputs, params):- k = params.get("kernel_size", 5)- return (- f"blurred = cv2.GaussianBlur("- f"{inputs['image']}, ({k}, {k}), 0)"- )-```-------## 2. Register the Node--Register it in the node catalog.--The frontend automatically:--- discovers the node-- renders its controls-- exposes it in the palette--No frontend code changes required.--> [!TIP]-> See `docs/architecture.md` for the complete node schema.-------# Exporting Code--Image Pipes generates standalone Python without proprietary runtime dependencies.--```python-import cv2--image = cv2.imread("input.jpg")--gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)-blur = cv2.GaussianBlur(gray, (5, 5), 0)-edges = cv2.Canny(blur, 50, 150)--cv2.imwrite("output_edges.png", edges)+npm run install:all```------# Roadmap--- [ ] Video pipeline support-- [ ] Camera streaming-- [ ] ONNX Runtime nodes-- [ ] PyTorch inference nodes-- [ ] Custom Python nodes-- [ ] CUDA acceleration-- [ ] Batch processing-- [ ] Plugin SDK-- [ ] Cloud workspace synchronization-------# Contributing--Contributions are welcome!+Launch the desktop app:```bash-# Fork the repository--# Create a feature branch-git checkout -b feature/amazing-node--# Commit your changes-git commit -m "Add custom threshold node"--# Push-git push origin feature/amazing-node+npm run desktop```-Then open a Pull Request.--For larger changes, please open an issue first to discuss the proposal.+That's it β the Electron app automatically starts the backend and opens the editor. No separate servers to babysit.----# FAQ--### Is Image Pipes only a visual wrapper?--No.+## π― Why Developers Love It-The exported pipeline consists entirely of standard Python and OpenCV code and runs independently without Image Pipes installed.+| | |+|---|---|+| β Visual instead of script-based | β Zero frontend work for custom nodes |+| β Live preview at every step | β Deterministic Albumentations augmentation |+| β Fast, targeted experimentation | β Clean, dependency-free Python export |+| β Metadata-driven architecture | β Open source & self-hosted desktop app |----### Does it support bounding boxes and segmentation masks?+## π£ Roadmap-Yes.--Albumentations dual transforms automatically keep:--- bounding boxes-- segmentation masks-- keypoints--synchronized throughout the pipeline.+- π₯ Video pipelines & camera streaming+- π§© ONNX Runtime and PyTorch inference nodes+- β‘ CUDA acceleration+- π¦ Batch processing+- π Plugin SDK+- βοΈ Cloud workspaces+- π Pipeline templates+- π€ AI-assisted pipeline generation----### Can I use it offline?--Yes.+## π€ Contributing-Everything runs locally on your machine.+Contributions are welcome β bug fixes, performance improvements, new processing nodes, or entirely new features. If you're planning a large change, please open an issue first so we can discuss the design together.----# License+## π License-Distributed under the **MIT License**.+Distributed under the MIT License. See the **LICENSE** file for details.-See the **LICENSE** file for details.+</div>