update readme with more detailed information
Browse files
README.md
CHANGED
|
@@ -1,115 +1,166 @@
|
|
| 1 |
---
|
| 2 |
title: Free Background Remover
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
-
short_description:
|
| 12 |
-
tags: ['computer
|
| 13 |
---
|
| 14 |
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
| 23 |
-
- **Model Selection**: Choose from a variety of pre-trained models for different use cases, including general use, human segmentation, and anime character segmentation.
|
| 24 |
-
- **Custom Background Color**: Replace the removed background with a custom color.
|
| 25 |
-
- **Alpha Matting**: Improve the quality of the background removal with alpha matting.
|
| 26 |
-
- **Post-Processing**: Option to post-process the mask for better results.
|
| 27 |
-
- **Only Mask**: Option to return only the mask of the image without any background.
|
| 28 |
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
- **u2net_human_seg**: A pre-trained model for human segmentation.
|
| 36 |
-
- **u2net_cloth_seg**: A pre-trained model for cloth parsing from human portraits.
|
| 37 |
-
- **silueta**: Same as u2net but with a reduced size.
|
| 38 |
-
- **isnet-general-use**: A new pre-trained model for general use cases.
|
| 39 |
-
- **isnet-anime**: High-accuracy segmentation for anime characters.
|
| 40 |
-
- **sam**: A pre-trained model for any use cases.
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
1. Clone this repository:
|
| 45 |
|
|
|
|
| 46 |
```bash
|
| 47 |
git clone https://github.com/your-username/background-remover.git
|
| 48 |
cd background-remover
|
| 49 |
```
|
| 50 |
|
| 51 |
-
2. Install
|
| 52 |
-
|
| 53 |
```bash
|
| 54 |
pip install -r requirements.txt
|
| 55 |
```
|
| 56 |
|
| 57 |
-
3. Run the application
|
| 58 |
-
|
| 59 |
```bash
|
| 60 |
python app.py
|
| 61 |
```
|
| 62 |
-
On some systems you may have to run using this command to avoid some issues with pydantic and opencv
|
| 63 |
-
```bash
|
| 64 |
-
python app.py --user
|
| 65 |
-
```
|
| 66 |
|
| 67 |
-
##
|
| 68 |
|
| 69 |
-
1. Upload
|
| 70 |
-
2.
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
|
| 77 |
-
##
|
| 78 |
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
-
|
| 82 |
-
- **Alpha Matting**: Modify the parameters for alpha matting.
|
| 83 |
-
- **Post-Processing**: Enable or disable post-processing of the mask.
|
| 84 |
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
-
|
| 88 |
|
| 89 |
```python
|
| 90 |
from PIL import Image
|
| 91 |
-
from rembg import remove
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
-
|
| 94 |
-
output_image = remove(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
output_image.save('output.png')
|
| 96 |
```
|
| 97 |
|
| 98 |
-
##
|
| 99 |
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
-
##
|
| 103 |
|
| 104 |
-
|
| 105 |
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
-
|
| 109 |
-
- [Gradio](https://www.gradio.app/) - The framework used to create the user interface.
|
| 110 |
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
---
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: Free Background Remover
|
| 3 |
+
emoji: πΌοΈ
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.44.1
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
+
short_description: Professional background removal tool with multiple AI models - no login required!
|
| 12 |
+
tags: ['computer-vision', 'image-processing', 'rembg', 'background-removal', 'u2net', 'isnet', 'ai-tools']
|
| 13 |
---
|
| 14 |
|
| 15 |
+
# π¨ Advanced Background Remover v2.8
|
| 16 |
|
| 17 |
+
A powerful, free web-based tool for professional background removal from images. No login required, no watermarks, no paywalls - just upload and download!
|
| 18 |
|
| 19 |
+
## β¨ Features
|
| 20 |
|
| 21 |
+
π― **Smart Background Removal** - Advanced AI models for precise edge detection
|
| 22 |
+
π¨ **Custom Backgrounds** - Replace with solid colors or keep transparent
|
| 23 |
+
π€ **Multiple AI Models** - Choose the best model for your specific use case
|
| 24 |
+
βοΈ **Alpha Matting** - Enhanced edge quality for professional results
|
| 25 |
+
π **Specialized Models** - Dedicated models for humans, anime, and clothing
|
| 26 |
+
π± **Easy to Use** - Simple drag-and-drop interface
|
| 27 |
+
πΎ **Instant Download** - Get your processed image immediately
|
| 28 |
|
| 29 |
+
## π€ Available AI Models
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
| Model | Best For | Size | Quality |
|
| 32 |
+
|-------|----------|------|---------|
|
| 33 |
+
| **u2net** | General use cases (recommended) | Standard | High |
|
| 34 |
+
| **isnet-general-use** | New general model with improved accuracy | Standard | Very High |
|
| 35 |
+
| **isnet-anime** | Anime characters and illustrations | Standard | Excellent |
|
| 36 |
+
| **u2net_human_seg** | Human portraits and people | Standard | Excellent |
|
| 37 |
+
| **u2net_cloth_seg** | Clothing and fashion items | Standard | High |
|
| 38 |
+
| **silueta** | Fast processing (reduced size) | 43MB | Good |
|
| 39 |
+
| **u2netp** | Lightweight, faster processing | Small | Good |
|
| 40 |
+
| **unet** | Basic background removal | Small | Standard |
|
| 41 |
|
| 42 |
+
## π Quick Start
|
| 43 |
|
| 44 |
+
### Online Usage (Recommended)
|
| 45 |
+
Visit the [Hugging Face Space](https://huggingface.co/spaces/your-username/free-background-remover) and start removing backgrounds instantly!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
### Local Installation
|
|
|
|
|
|
|
| 48 |
|
| 49 |
+
1. **Clone the repository**
|
| 50 |
```bash
|
| 51 |
git clone https://github.com/your-username/background-remover.git
|
| 52 |
cd background-remover
|
| 53 |
```
|
| 54 |
|
| 55 |
+
2. **Install dependencies**
|
|
|
|
| 56 |
```bash
|
| 57 |
pip install -r requirements.txt
|
| 58 |
```
|
| 59 |
|
| 60 |
+
3. **Run the application**
|
|
|
|
| 61 |
```bash
|
| 62 |
python app.py
|
| 63 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
+
## π‘ How to Use
|
| 66 |
|
| 67 |
+
1. **Upload Image** - Drag and drop or click to select your image
|
| 68 |
+
2. **Choose Options**:
|
| 69 |
+
- π¨ Select background color (or keep transparent)
|
| 70 |
+
- π€ Pick the best AI model for your image type
|
| 71 |
+
- βοΈ Enable advanced options if needed
|
| 72 |
+
3. **Process** - Click "Submit" and wait a few seconds
|
| 73 |
+
4. **Download** - Right-click the result to save your image
|
| 74 |
|
| 75 |
+
## βοΈ Advanced Options
|
| 76 |
|
| 77 |
+
- **π― Alpha Matting**: Improves edge quality for hair and fine details
|
| 78 |
+
- **π§ Post-Process Mask**: Additional refinement of the cutout
|
| 79 |
+
- **ποΈ Mask Only**: Export just the selection mask
|
| 80 |
+
- **π¨ Custom Colors**: Any hex color for background replacement
|
| 81 |
|
| 82 |
+
## π― Use Cases
|
|
|
|
|
|
|
| 83 |
|
| 84 |
+
- **E-commerce**: Product photos with clean backgrounds
|
| 85 |
+
- **Social Media**: Profile pictures and content creation
|
| 86 |
+
- **Design Work**: Graphics and marketing materials
|
| 87 |
+
- **Photography**: Portrait enhancement and compositing
|
| 88 |
+
- **Art & Animation**: Character extraction and manipulation
|
| 89 |
|
| 90 |
+
## π§ API Usage Example
|
| 91 |
|
| 92 |
```python
|
| 93 |
from PIL import Image
|
| 94 |
+
from rembg import remove, new_session
|
| 95 |
+
|
| 96 |
+
# Basic usage
|
| 97 |
+
input_image = Image.open('input.jpg')
|
| 98 |
+
output_image = remove(input_image)
|
| 99 |
+
output_image.save('output.png')
|
| 100 |
+
|
| 101 |
+
# Advanced usage with specific model
|
| 102 |
+
session = new_session('u2net_human_seg')
|
| 103 |
+
output_image = remove(input_image, session=session)
|
| 104 |
+
output_image.save('output.png')
|
| 105 |
|
| 106 |
+
# With alpha matting for better quality
|
| 107 |
+
output_image = remove(
|
| 108 |
+
input_image,
|
| 109 |
+
alpha_matting=True,
|
| 110 |
+
alpha_matting_foreground_threshold=270,
|
| 111 |
+
alpha_matting_background_threshold=20,
|
| 112 |
+
alpha_matting_erode_size=11
|
| 113 |
+
)
|
| 114 |
output_image.save('output.png')
|
| 115 |
```
|
| 116 |
|
| 117 |
+
## π Model Performance
|
| 118 |
|
| 119 |
+
| Model | Speed | Quality | Best For |
|
| 120 |
+
|-------|-------|---------|----------|
|
| 121 |
+
| silueta | β‘β‘β‘ | βββ | Quick processing |
|
| 122 |
+
| u2netp | β‘β‘ | ββββ | Balanced |
|
| 123 |
+
| u2net | β‘ | βββββ | High quality |
|
| 124 |
+
| isnet-general-use | β‘ | βββββ | Best overall |
|
| 125 |
+
| isnet-anime | β‘ | βββββ | Anime/illustrations |
|
| 126 |
|
| 127 |
+
## π€ Contributing
|
| 128 |
|
| 129 |
+
Contributions are welcome! Here's how you can help:
|
| 130 |
|
| 131 |
+
- π Report bugs and issues
|
| 132 |
+
- π‘ Suggest new features
|
| 133 |
+
- π§ Submit pull requests
|
| 134 |
+
- π Improve documentation
|
| 135 |
+
- β Star the repository if you find it useful!
|
| 136 |
|
| 137 |
+
## π Requirements
|
|
|
|
| 138 |
|
| 139 |
+
```
|
| 140 |
+
gradio>=4.44.1
|
| 141 |
+
rembg>=2.0.50
|
| 142 |
+
Pillow>=10.0.0
|
| 143 |
+
numpy>=1.24.0
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
## π Alternative Tools
|
| 147 |
+
|
| 148 |
+
If you need more features, consider these alternatives:
|
| 149 |
+
- [Adobe Express Background Remover](https://www.adobe.com/express/feature/image/remove-background/transparent) (requires Adobe account)
|
| 150 |
+
- [Remove.bg](https://www.remove.bg/) (limited free usage)
|
| 151 |
+
|
| 152 |
+
## π License
|
| 153 |
+
|
| 154 |
+
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
|
| 155 |
+
|
| 156 |
+
## π Acknowledgments
|
| 157 |
+
|
| 158 |
+
- **[rembg](https://github.com/danielgatis/rembg)** - The powerful Python library powering the background removal
|
| 159 |
+
- **[Gradio](https://www.gradio.app/)** - The framework making this tool accessible to everyone
|
| 160 |
+
- **[Hugging Face](https://huggingface.co/)** - For hosting this free tool
|
| 161 |
|
| 162 |
---
|
| 163 |
|
| 164 |
+
β **Star this repository if you find it useful!** β
|
| 165 |
+
|
| 166 |
+
Made with β€οΈ for the open-source community
|