🎉 | Project released

This commit is contained in:
2026-05-16 00:15:37 +03:00
parent 3a3d368c4d
commit 975801ffca
7 changed files with 819 additions and 0 deletions

91
docs/README.md Normal file
View File

@@ -0,0 +1,91 @@
# 🪄 FOBG — AI Background Remover
Remove backgrounds from **images** and **videos** using AI, powered by [rembg](https://github.com/danielzhanika/rembg).
## Features
- **Image BG Removal** — Upload any image, get a transparent PNG
- **Video BG Removal** — Frame-by-frame processing with alpha channel
- **Multiple AI Models** — u2net, u2netp, u2net_human_seg, isnet-general-use, isnet-anime
- **Gradio UI** — Clean, interactive web interface
- **CLI Mode** — Script-friendly command-line interface
- **Fine-tune Controls** — Alpha matting, thresholds, erosion mask
## Quick Start
### 1. Install Dependencies
```bash
cd /mnt/games/Coding/Python/AI/FOBG
source .venv/bin/activate
pip install -r requirements.txt
```
### 2. Launch the Web UI
```bash
python main.py
```
Opens at [http://localhost:7860](http://localhost:7860)
### 3. CLI Mode
```bash
python main.py --cli input.jpg # Image
python main.py --cli video.mp4 --video # Video
```
## Project Structure
```
FOBG/
├── main.py # Entry point (Gradio + CLI)
├── requirements.txt # Dependencies
├── src/
│ ├── core/
│ │ ├── bg_remove.py # Image BG removal (rembg)
│ │ └── video_bg_remove.py # Video BG removal (OpenCV + rembg)
│ └── ui/
│ └── app.py # Gradio web interface
├── output/ # Processed results saved here
├── tests/ # Unit tests
└── docs/
└── README.md # This file
```
## Available Models
| Model | Description | Speed |
|-------|-------------|-------|
| `u2net` | Default, balanced quality/speed | ⚡ Fast |
| `u2netp` | Lightweight, slightly lower quality | 🚀 Fastest |
| `u2net_human_seg` | Optimized for human segmentation | ⚡ Fast |
| `u2net_3b` | Heavy, higher accuracy | 🐢 Slower |
| `isnet-general-use` | General purpose, high accuracy | 🐢 Slower |
| `isnet-anime` | Optimized for anime illustrations | ⚡ Fast |
## Controls
### Image Tab
- **Upload Image** — PNG, JPEG, or WebP
- **Model** — Choose the AI model
- **Alpha Matting** — Fine-tune edges (slower but cleaner)
- **Foreground Threshold** — How much is considered foreground (1-255)
- **Background Threshold** — How much is considered background (1-255)
- **Erosion Mask Dilation** — Morphological operation on the mask (0-32)
### Video Tab
- **Upload Video** — MP4, AVI, WebM, or MOV
- **Model** — Same models as image tab
- **Alpha Matting** — Fine edge detection per frame
- **Erosion Mask Dilation** — Morphological operation on the mask
## Notes
- Image processing: 15 seconds per image
- Video processing: frame-by-frame, can take minutes for longer clips
- All outputs saved to `output/` directory
- First run downloads the AI model (~170 MB for u2net)