cedarrapidsboy commited on
Commit
7ba0bfa
Β·
verified Β·
1 Parent(s): 0546c38

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +256 -1
README.md CHANGED
@@ -1,3 +1,258 @@
1
  ---
2
- license: agpl-3.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: other
3
+ tags:
4
+ - object-detection
5
+ - yolov8
6
+ - yolo
7
+ - ultralytics
8
+ - gradient-boosting
9
+ - scikit-learn
10
+ - comics
11
+ - computer-vision
12
+ - panel-detection
13
+ - reading-order
14
+ library_name: ultralytics
15
+ pipeline_tag: object-detection
16
+ base_model:
17
+ - Ultralytics/YOLOv8
18
  ---
19
+
20
+ # Inkwell Panel Models
21
+
22
+ Two models for automated comic panel processing, trained on the same
23
+ hand-annotated comic page corpus:
24
+
25
+ 1. **[Panel Detector](#1-panel-detector-yolov8-n)** β€” locates panel bounding
26
+ boxes on a comic page (object detection, YOLOv8-n).
27
+ 2. **[Panel Reading Order](#2-panel-reading-order-gradient-boosting-classifier)** β€”
28
+ given a page's detected panels, predicts the order a reader should view
29
+ them in (pairwise gradient-boosted classifier).
30
+
31
+ They're meant to be used together: run the detector on a page to get panel
32
+ boxes, then run the ordering model on those boxes to get a reading sequence.
33
+ Each model has its **own license** β€” see [License](#license) below, they are
34
+ not the same.
35
+
36
+ ---
37
+
38
+ ## 1. Panel Detector (YOLOv8-n)
39
+
40
+ A YOLOv8-nano object detection model that locates **comic panels** on scanned
41
+ or digital comic book pages.
42
+
43
+ ### Model description
44
+
45
+ - **Task:** single-class object detection
46
+ - **Class:** `panel` (`class_id 0`) β€” the rectangular (or near-rectangular)
47
+ bounded region of a single comic panel on a page. The model does not
48
+ distinguish panel shape, gutter, speech balloons, or reading order β€” it
49
+ only predicts the bounding box of each panel.
50
+ - **Architecture:** [YOLOv8-n](https://github.com/ultralytics/ultralytics)
51
+ (nano), fine-tuned from the pretrained `yolov8n.pt` COCO checkpoint.
52
+ - **Input size:** 640Γ—640
53
+ - **What it's for:** automatically detecting panel boundaries on a comic page
54
+ so downstream tools can crop, reorder, or reflow panels β€” e.g. guided
55
+ panel-by-panel reading, panel extraction for translation/OCR pipelines, or
56
+ building reading-order datasets. This is the "edge" tier model:
57
+ small and fast enough for on-device / mobile inference.
58
+
59
+ ### Training data
60
+
61
+ - **~3,800 annotated comic book pages** (3,380 train / 423 validation, plus a
62
+ held-out test split) drawn from a range of **genres and art styles**
63
+ (e.g. superhero, manga-influenced, indie/alternative, all-ages), so the
64
+ model isn't overfit to one visual style or layout convention.
65
+ - Every panel bounding box was **hand-tuned** β€” each page's annotation was
66
+ manually created or corrected before being ingested into the training set.
67
+ - Pages with **no panels** (e.g. full-page splash art, covers) were included
68
+ with empty label files as negative examples, so the model also learns to
69
+ correctly predict *zero* panels on non-paneled pages.
70
+ - Labels use standard YOLO format: `<class_id> <cx> <cy> <w> <h>`, normalized
71
+ to 0–1, single class (`panel`).
72
+
73
+ ### Training procedure
74
+
75
+ Trained from the `yolov8n.pt` pretrained checkpoint using
76
+ [Ultralytics YOLOv8](https://github.com/ultralytics/ultralytics).
77
+
78
+ | Parameter | Value |
79
+ |---|---|
80
+ | Base weights | `yolov8n.pt` |
81
+ | Image size | 640 |
82
+ | Epochs | 300 (early-stopping patience 30) |
83
+ | Batch size | 16 |
84
+ | Mosaic augmentation | 1.0 |
85
+ | Mixup augmentation | 0.0 |
86
+ | Train / Val pages | 3,380 / 423 |
87
+
88
+ ### Results
89
+
90
+ | Model | Type | Epochs | Batch | imgsz | Train pages | Val pages | Precision | Recall | mAP@50 | mAP@50-95 |
91
+ |---|---|---|---|---|---|---|---|---|---|---|
92
+ | comic-panels-v1 | nano | 300 | 16 | 640 | 3,380 | 423 | 0.9681 | 0.9331 | 0.9769 | 0.9249 |
93
+
94
+ ### Limitations
95
+
96
+ - Trained on comic *pages* β€” performance on non-comic images, storyboard art,
97
+ or extremely non-standard/artistic panel layouts (irregular borders,
98
+ panel-less "flow" layouts) is not guaranteed.
99
+ - Detects panel bounding boxes only; it does not infer reading order, panel
100
+ type, or contents (speech bubbles, characters, etc.). That's handled by the
101
+ second model in this repo.
102
+ - Single-class model β€” all detections are labeled `panel` regardless of
103
+ panel shape or size.
104
+
105
+ ---
106
+
107
+ ## 2. Panel Reading Order (Gradient Boosting Classifier)
108
+
109
+ A pairwise reading-order model. Given the panel boxes on a comic page (e.g.
110
+ from the detector above, or any other source), it predicts the order a
111
+ reader should view them in β€” handling non-obvious layouts like Z-paths,
112
+ tall panels that span both a left and right column, splash panels, and
113
+ nested/overlapping panels, without hardcoded row/column rules.
114
+
115
+ ### Model description
116
+
117
+ - **Task:** pairwise ranking / reading-order prediction over a variable
118
+ number of panels on a page.
119
+ - **Architecture:** `sklearn.ensemble.GradientBoostingClassifier`
120
+ (100 estimators, max depth 4, learning rate 0.1). For every ordered pair of
121
+ panels `(a, b)` on a page, 14 geometric features are computed (relative
122
+ position, vertical/horizontal overlap, aspect-ratio, tallness, page-column
123
+ side, panel-count normalization, etc. β€” see `FEATURE_NAMES` in the
124
+ training script) and the classifier predicts `P(a is read before b)`.
125
+ Each panel's final rank comes from summing its "beats" probability against
126
+ every other panel on the page and sorting descending.
127
+ - **Not a neural network** β€” pure gradient-boosted trees over geometry
128
+ features, so inference is microseconds per page.
129
+ - **Shipped format:** `panel-order-model.onnx`, exported from the trained
130
+ scikit-learn classifier via `skl2onnx`. GradientBoostingClassifier (rather
131
+ than the faster HistGradientBoostingClassifier used by an internal v2
132
+ candidate) is used specifically because it converts to ONNX reliably,
133
+ letting this model run in-browser via onnxruntime-web.
134
+
135
+ ### Training data
136
+
137
+ Same underlying corpus as the panel detector: comic pages with hand-tuned
138
+ panel boxes **and** a hand-verified reading-order index per panel, pulled
139
+ from `panels.json` annotations across the same range of genres and art
140
+ styles. Only pages with β‰₯2 panels and an `approved` annotation flag are used
141
+ (single-panel and unapproved pages are skipped, since there's no ordering
142
+ signal to learn from a single panel).
143
+
144
+ ### Training procedure
145
+
146
+ - Trained with leave-one-file-out cross-validation: for each comic file, the
147
+ model is trained on every *other* file and evaluated on the held-out one,
148
+ so reported accuracy reflects generalization to unseen books, not just
149
+ unseen pages of a book already seen in training.
150
+ - Every panel pair on a page contributes two training examples (`a before b`
151
+ and `b before a`), so the effective training set is much larger than the
152
+ page count alone suggests.
153
+
154
+ ### Results
155
+
156
+ Leave-one-file-out cross-validation, page-level exact-match accuracy (the
157
+ predicted order must match the human-annotated order for every panel on the
158
+ page to count as correct):
159
+
160
+ | Metric | Value |
161
+ |---|---|
162
+ | Pages evaluated | 3,610 |
163
+ | Pages perfectly ordered | 3,493 |
164
+ | **Page-level accuracy** | **96.76%** |
165
+
166
+ Accuracy by layout pattern (a page can match more than one pattern):
167
+
168
+ | Pattern | Accuracy | Pages |
169
+ |---|---|---|
170
+ | Simple grid | 98.58% | 494 |
171
+ | 2–3 panels | 99.52% | 419 |
172
+ | 4–6 panels | 97.99% | 2,585 |
173
+ | Unequal columns | 96.76% | 1,451 |
174
+ | Has overlapping panels | 95.97% | 2,233 |
175
+ | Has splash panel | 95.48% | 1,770 |
176
+ | 7–10 panels | 91.06% | 559 |
177
+ | Has nested panels | 91.91% | 544 |
178
+ | 11+ panels | 72.34% | 47 |
179
+
180
+ Accuracy degrades on the densest, least common layouts (11+ panels on a
181
+ single page), which is also the smallest evaluation bucket.
182
+
183
+ ### Limitations
184
+
185
+ - Accuracy drops on pages with very high panel counts (11+) β€” these are rare
186
+ in the training corpus, so the model has seen fewer examples of that
187
+ layout complexity.
188
+ - Predicts order from **geometry only** β€” it doesn't read panel content, so
189
+ narratively-driven reading orders that contradict geometric layout (rare,
190
+ but they exist in some comics) won't be captured.
191
+ - Expects panel boxes as input (from the detector above or another source);
192
+ it does not detect panels itself.
193
+
194
+ ---
195
+
196
+ ## License
197
+
198
+ **The two models in this repo are licensed differently β€” check which one
199
+ you're using.**
200
+
201
+ ### Panel Detector β€” AGPL-3.0
202
+
203
+ The panel detector is a **derivative of [Ultralytics YOLOv8](https://github.com/ultralytics/ultralytics)**,
204
+ which Ultralytics distributes under the
205
+ [GNU Affero General Public License v3.0 (AGPL-3.0)](https://www.gnu.org/licenses/agpl-3.0.en.html).
206
+ Because these weights were produced by fine-tuning Ultralytics' pretrained
207
+ `yolov8n.pt` checkpoint, the detector weights are likewise distributed under
208
+ **AGPL-3.0**.
209
+
210
+ In practice, this means:
211
+
212
+ - You are free to use, modify, and redistribute this model, **provided any
213
+ distribution (including source code) also uses/discloses source under
214
+ AGPL-3.0**.
215
+ - If you run this model (or a modified version of it) as part of a network
216
+ service (e.g. a hosted API or web app), AGPL-3.0's network-use clause
217
+ requires you to make the complete corresponding source code of that
218
+ service available to its users.
219
+ - If you need to use this model in a closed-source or proprietary product
220
+ without these obligations, Ultralytics offers a commercial
221
+ [Enterprise License](https://www.ultralytics.com/license) β€” see their site
222
+ for details. That commercial license applies to the underlying YOLOv8
223
+ architecture/code; you would need to confirm licensing terms for these
224
+ specific fine-tuned weights with their author before using them under
225
+ such a license.
226
+
227
+ Full AGPL-3.0 license text: https://www.gnu.org/licenses/agpl-3.0.en.html
228
+
229
+ #### Attribution
230
+
231
+ This model builds on:
232
+
233
+ ```
234
+ Ultralytics YOLOv8
235
+ https://github.com/ultralytics/ultralytics
236
+ Copyright (C) Ultralytics
237
+ Licensed under AGPL-3.0
238
+ ```
239
+
240
+ If you use the detector, please also cite Ultralytics YOLOv8:
241
+
242
+ ```bibtex
243
+ @software{yolov8_ultralytics,
244
+ author = {Glenn Jocher and Ayush Chaurasia and Jing Qiu},
245
+ title = {YOLO by Ultralytics},
246
+ version = {8.0.0},
247
+ year = {2023},
248
+ url = {https://github.com/ultralytics/ultralytics},
249
+ license = {AGPL-3.0}
250
+ }
251
+ ```
252
+
253
+ ### Panel Reading Order β€” MIT
254
+
255
+ The reading-order model is trained from scratch on top of
256
+ `scikit-learn` (BSD-3-Clause) and does not derive from or embed any AGPL
257
+ code or weights, so it does not carry the detector's AGPL-3.0 obligations.
258
+ It's released under the **MIT License**.