jebin2 commited on
Commit
30436f6
Β·
1 Parent(s): 859b8f0

upda readme docker issue fix

Browse files
Files changed (2) hide show
  1. Dockerfile +0 -1
  2. README.md +116 -5
Dockerfile CHANGED
@@ -3,7 +3,6 @@ FROM python:3.10-slim
3
 
4
  # Install system dependencies
5
  RUN apt-get update && apt-get install -y \
6
- libgl1-mesa-glx \
7
  libglib2.0-0 \
8
  && rm -rf /var/lib/apt/lists/*
9
 
 
3
 
4
  # Install system dependencies
5
  RUN apt-get update && apt-get install -y \
 
6
  libglib2.0-0 \
7
  && rm -rf /var/lib/apt/lists/*
8
 
README.md CHANGED
@@ -7,10 +7,121 @@ sdk: docker
7
  pinned: false
8
  ---
9
 
10
- # Comic Panel Extractor
11
 
12
- This is a FastAPI app that extracts comic panels from uploaded images.
13
 
14
- βœ… Upload a comic page
15
- βœ… Detect and extract panels
16
- βœ… Download individual panels
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  pinned: false
8
  ---
9
 
10
+ https://jebin2-comic-panel-extractor.hf.space/
11
 
12
+ # πŸ“š Comic Panel Extractor
13
 
14
+ Automatically extract panels from comic pages using YOLO segmentation and image processing.
15
+ Meanwhile currently using - "https://huggingface.co/mosesb/best-comic-panel-detection/resolve/main/best.pt"
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ git clone https://github.com/jebin2/comic-panel-extractor.git
21
+ cd comic-panel-extractor
22
+ pip install -e .
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ### Extract Panels
28
+
29
+ **Web Interface:**
30
+ ```bash
31
+ serve-comic-panel-extractor
32
+ # Visit http://localhost:7860
33
+ ```
34
+
35
+ **CLI:**
36
+ ```bash
37
+ comic-panel-extractor path/to/comic.jpg
38
+ ```
39
+
40
+ **Python:**
41
+ ```python
42
+ from comic_panel_extractor.main import ComicPanelExtractor
43
+ from comic_panel_extractor.config import Config
44
+
45
+ config = Config()
46
+ config.input_path = "comic.jpg"
47
+ extractor = ComicPanelExtractor(config)
48
+ panels, data, paths = extractor.extract_panels_from_comic()
49
+ ```
50
+
51
+ ### Annotate Data
52
+
53
+ Visit `http://localhost:7860/annotate`
54
+
55
+ **Shortcuts:**
56
+ - Click/drag for boxes
57
+ - `S` = Save
58
+ - `D` = Auto-detect
59
+ - `Delete` = Remove
60
+
61
+ ### Train Model
62
+
63
+ **1. Setup Dataset:**
64
+ ```bash
65
+ # Add to .env
66
+ SOURCE_PATH=/path/to/images
67
+
68
+ # Create dataset (80/10/10 split)
69
+ python -m comic_panel_extractor.create_dataset
70
+ ```
71
+
72
+ **2. Configure Training (.env):**
73
+ ```env
74
+ EPOCH=200
75
+ YOLO_BASE_MODEL_NAME=yolo11s-seg
76
+ YOLO_MODEL_NAME=comic_panel
77
+ ```
78
+
79
+ **3. Train:**
80
+ ```bash
81
+ python -m comic_panel_extractor.train
82
+ ```
83
+
84
+ ### Run Inference
85
+
86
+ ```bash
87
+ python -m comic_panel_extractor.inference
88
+ ```
89
+
90
+ ```python
91
+ from comic_panel_extractor.yolo_manager import YOLOManager
92
+
93
+ with YOLOManager() as yolo:
94
+ yolo.load_model('weights.pt')
95
+ yolo.annotate_images(['image.jpg'], 'output')
96
+ ```
97
+
98
+ ## Configuration
99
+
100
+ ```python
101
+ config = Config()
102
+ config.min_width_ratio = 0.15 # Min panel width (% of image)
103
+ config.min_height_ratio = 0.15 # Min panel height (% of image)
104
+ config.min_area_ratio = 0.05 # Min panel area (% of image)
105
+ ```
106
+
107
+ ## Docker
108
+
109
+ ```bash
110
+ docker build -t comic-panel-extractor .
111
+ docker run -p 7860:7860 comic-panel-extractor
112
+ ```
113
+
114
+ ## API Endpoints
115
+
116
+ **Extract:**
117
+ - `POST /api/extract/convert` - Upload & extract panels
118
+
119
+ **Annotate:**
120
+ - `GET /api/annotate/images` - List images
121
+ - `GET /api/annotate/annotations/{image}` - Get annotations
122
+ - `GET /api/annotate/detect_annotations/{image}` - Auto-detect
123
+ - `POST /api/annotate/annotations` - Save annotations
124
+
125
+ ## Author
126
+
127
+ Jebin Einstein E - jebineinstein@gmail.com