fantos commited on
Commit
765173a
·
verified ·
1 Parent(s): 4c800d2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +159 -2
README.md CHANGED
@@ -4,8 +4,165 @@ emoji: ✂️
4
  colorFrom: indigo
5
  colorTo: indigo
6
  sdk: gradio
7
- sdk_version: 5.33.1
8
  app_file: app.py
9
  pinned: false
10
  license: mit
11
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  colorFrom: indigo
5
  colorTo: indigo
6
  sdk: gradio
7
+ sdk_version: 5.35.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
11
+ ---
12
+ I'll create comprehensive documentation for this object segmentation and background removal application in both English and Korean.
13
+
14
+ ## English Documentation
15
+
16
+ ### Advanced Object Cutout Tool - AI-Powered Background Removal
17
+
18
+ This application is a sophisticated object segmentation tool that combines Grounding DINO for object detection and a specialized Box Segmenter for precise background removal, offering two intuitive methods for isolating objects from images.
19
+
20
+ #### Key Features
21
+
22
+ 1. **Dual Input Methods**
23
+ - **Text Prompt Mode**: Simply describe the object you want to extract (e.g., "chair", "potted plant")
24
+ - **Bounding Box Mode**: Manually draw a box around the object for precise selection
25
+ - Both methods provide high-quality cutouts with transparent backgrounds
26
+
27
+ 2. **Advanced AI Models**
28
+ - **Grounding DINO**: State-of-the-art object detection model that understands natural language descriptions
29
+ - **Box Segmenter**: Refined segmentation model for pixel-perfect object extraction
30
+ - **PyMatting Integration**: Advanced alpha matting for clean edges without halos
31
+
32
+ 3. **Professional Edge Processing**
33
+ - **Color Decontamination**: Removes color bleeding from edges using ML-based foreground estimation
34
+ - **Alpha Matting**: Preserves fine details like hair, fur, and transparent objects
35
+ - **Automatic Cropping**: Intelligently crops the result to the object boundaries
36
+
37
+ 4. **User-Friendly Interface**
38
+ - **Image Slider**: Before/after comparison view for immediate visual feedback
39
+ - **Download Options**: Easy one-click download of processed images
40
+ - **Example Gallery**: Pre-loaded examples demonstrating various use cases
41
+ - **Responsive Design**: Works seamlessly on desktop and mobile devices
42
+
43
+ #### Technical Implementation
44
+
45
+ The application leverages several cutting-edge technologies:
46
+ - **Grounding DINO**: For natural language-based object detection
47
+ - **Refiners Library**: Custom segmentation model with SOTA performance
48
+ - **PyMatting**: Advanced matting algorithms for edge refinement
49
+ - **Gradio**: Modern web interface with GPU acceleration via ZeroGPU
50
+ - **Pillow HEIF**: Support for modern image formats including HEIC and AVIF
51
+
52
+ Processing Pipeline:
53
+ 1. **Object Detection** (Text mode only):
54
+ - Processes natural language prompt with Grounding DINO
55
+ - Identifies object location with bounding box coordinates
56
+ - Handles multiple detections by computing union of boxes
57
+
58
+ 2. **Segmentation**:
59
+ - Applies Box Segmenter model to extract precise object mask
60
+ - Runs on GPU for real-time performance
61
+ - Generates high-resolution binary mask
62
+
63
+ 3. **Edge Refinement**:
64
+ - Applies color decontamination to remove edge artifacts
65
+ - Uses ML-based foreground estimation for natural edges
66
+ - Preserves transparency and semi-transparent regions
67
+
68
+ 4. **Post-Processing**:
69
+ - Composites object onto transparent background
70
+ - Auto-crops to remove excess transparent areas
71
+ - Saves as PNG with full alpha channel support
72
+
73
+ #### Performance Optimizations
74
+
75
+ - **GPU Acceleration**: Automatic CUDA optimization with @spaces.GPU decorator
76
+ - **Image Size Management**: Automatic resizing for images over 2048px
77
+ - **Efficient Memory Usage**: Model offloading and careful tensor management
78
+ - **Batch Processing**: Optimized for single-image processing with minimal latency
79
+ - **Format Support**: Native support for HEIC, AVIF, JPEG, PNG, and more
80
+
81
+ #### Use Cases
82
+
83
+ Perfect for:
84
+ - **E-commerce**: Product photography with clean backgrounds
85
+ - **Graphic Design**: Extracting elements for compositions
86
+ - **Social Media**: Creating stickers and transparent overlays
87
+ - **Photography**: Isolating subjects for editing
88
+ - **Education**: Teaching object detection and segmentation concepts
89
+ - **Marketing**: Creating promotional materials with isolated products
90
+
91
+ ---
92
+
93
+ ## 한글 설명서
94
+
95
+ ### 고급 객체 추출 도구 - AI 기반 배경 제거
96
+
97
+ 이 애플리케이션은 객체 감지를 위한 Grounding DINO와 정밀한 배경 제거를 위한 전문 Box Segmenter를 결합한 정교한 객체 분할 도구로, 이미지에서 객체를 분리하는 두 가지 직관적인 방법을 제공합니다.
98
+
99
+ #### 주요 기능
100
+
101
+ 1. **이중 입력 방식**
102
+ - **텍스트 프롬프트 모드**: 추출하려는 객체를 간단히 설명 (예: "의자", "화분")
103
+ - **경계 상자 모드**: 정밀한 선택을 위해 객체 주위에 수동으로 상자 그리기
104
+ - 두 방법 모두 투명 배경의 고품질 추출 결과 제공
105
+
106
+ 2. **고급 AI 모델**
107
+ - **Grounding DINO**: 자연어 설명을 이해하는 최첨단 객체 감지 모델
108
+ - **Box Segmenter**: 픽셀 단위의 완벽한 객체 추출을 위한 정제된 분할 모델
109
+ - **PyMatting 통합**: 헤일로 없는 깨끗한 가장자리를 위한 고급 알파 매팅
110
+
111
+ 3. **전문적인 가장자리 처리**
112
+ - **색상 오염 제거**: ML 기반 전경 추정을 사용하여 가장자리의 색상 번짐 제거
113
+ - **알파 매팅**: 머리카락, 털, 투명 객체와 같은 세밀한 디테일 보존
114
+ - **자동 크롭**: 객체 경계에 맞춰 지능적으로 결과물 크롭
115
+
116
+ 4. **사용자 친화적 인터페이스**
117
+ - **이미지 슬라이더**: 즉각적인 시각적 피드백을 위한 전후 비교 뷰
118
+ - **다운로드 옵션**: 처리된 이미지의 간편한 원클릭 다운로드
119
+ - **예제 갤러리**: 다양한 사용 사례를 보여주는 사전 로드된 예제
120
+ - **반응형 디자인**: 데스크톱과 모바일 기기에서 원활하게 작동
121
+
122
+ #### 기술적 구현
123
+
124
+ 애플리케이션은 여러 최첨단 기술을 활용합니다:
125
+ - **Grounding DINO**: 자연어 기반 객체 감지
126
+ - **Refiners 라이브러리**: SOTA 성능의 커스텀 분할 모델
127
+ - **PyMatting**: 가장자리 정제를 위한 고급 매팅 알고리즘
128
+ - **Gradio**: ZeroGPU를 통한 GPU 가속이 포함된 현대적 웹 인터페이스
129
+ - **Pillow HEIF**: HEIC 및 AVIF를 포함한 최신 이미지 형식 지원
130
+
131
+ 처리 파이프라인:
132
+ 1. **객체 감지** (텍스트 모드 전용):
133
+ - Grounding DINO로 자연어 프롬프트 처리
134
+ - 경계 상자 좌표로 객체 위치 식별
135
+ - 상자들의 합집합을 계산하여 다중 감지 처리
136
+
137
+ 2. **분할**:
138
+ - Box Segmenter 모델을 적용하여 정밀한 객체 마스크 추출
139
+ - 실시간 성능을 위해 GPU에서 실행
140
+ - 고해상도 이진 마스크 생성
141
+
142
+ 3. **가장자리 정제**:
143
+ - 가장자리 아티팩트 제거를 위한 색상 오염 제거 적용
144
+ - 자연스러운 가장자리를 위한 ML 기반 전경 추정 사용
145
+ - 투명도 및 반투명 영역 보존
146
+
147
+ 4. **후처리**:
148
+ - 투명 배경에 객체 합성
149
+ - 과도한 투명 영역 제거를 위한 자동 크롭
150
+ - 전체 알파 채널 지원으로 PNG 저장
151
+
152
+ #### 성능 최적화
153
+
154
+ - **GPU 가속**: @spaces.GPU 데코레이터로 자동 CUDA 최적화
155
+ - **이미지 크기 관리**: 2048px 이상 이미지에 대한 자동 크기 조정
156
+ - **효율적인 메모리 사용**: 모델 오프로딩 및 신중한 텐서 관리
157
+ - **배치 처리**: 최소 지연 시간으로 단일 이미지 처리에 최적화
158
+ - **형식 지원**: HEIC, AVIF, JPEG, PNG 등 네이티브 지원
159
+
160
+ #### 사용 사례
161
+
162
+ 다음과 같은 용도에 적합합니다:
163
+ - **전자상거래**: 깨끗한 배경의 제품 사진
164
+ - **그래픽 디자인**: 구성을 위한 요소 추출
165
+ - **소셜 미디어**: 스티커 및 투명 오버레이 생성
166
+ - **사진**: 편집을 위한 피사체 분리
167
+ - **교육**: 객체 감지 및 분할 개념 교육
168
+ - **마케팅**: 분리된 제품으로 홍보 자료 제작