Spaces:
Running
Running
metadata
title: Comic Panel Extractor
emoji: π
colorFrom: indigo
colorTo: purple
sdk: docker
pinned: false
https://jebin2-comic-panel-extractor.hf.space/
π Comic Panel Extractor
Automatically extract panels from comic pages using YOLO segmentation and image processing.
Note: Currently using pretrained model from mosesb/best-comic-panel-detection until custom training is complete. The model downloads automatically on first run.
Installation
git clone https://github.com/jebin2/comic-panel-extractor.git
cd comic-panel-extractor
pip install -e .
Usage
Extract Panels
Web Interface:
serve-comic-panel-extractor
# Visit http://localhost:7860
CLI:
comic-panel-extractor path/to/comic.jpg
Python:
from comic_panel_extractor.main import ComicPanelExtractor
from comic_panel_extractor.config import Config, load_config
config = load_config()
config.input_path = "comic.jpg"
extractor = ComicPanelExtractor(config)
panels, data, paths = extractor.extract_panels_from_comic()
Annotate Data
Visit http://localhost:7860/annotate
Shortcuts:
- Click/drag for boxes
S= SaveD= Auto-detectDelete= Remove
Train Model
1. Setup Dataset:
# Add to .env
SOURCE_PATH=/path/to/images
# Create dataset (80/10/10 split)
python -m comic_panel_extractor.create_dataset
2. Configure Training (.env):
EPOCH=200
YOLO_BASE_MODEL_NAME=yolo11s-seg
YOLO_MODEL_NAME=comic_panel
3. Train:
python -m comic_panel_extractor.train
Run Inference
python -m comic_panel_extractor.inference
from comic_panel_extractor.yolo_manager import YOLOManager
with YOLOManager() as yolo:
yolo.load_model('weights.pt')
yolo.annotate_images(['image.jpg'], 'output')
Configuration
config = load_config()
config.min_width_ratio = 0.15 # Min panel width (% of image)
config.min_height_ratio = 0.15 # Min panel height (% of image)
config.min_area_ratio = 0.05 # Min panel area (% of image)
Docker
docker build -t comic-panel-extractor .
docker run -p 7860:7860 comic-panel-extractor
API Endpoints
Extract:
POST /api/extract/convert- Upload & extract panels
Annotate:
GET /api/annotate/images- List imagesGET /api/annotate/annotations/{image}- Get annotationsGET /api/annotate/detect_annotations/{image}- Auto-detectPOST /api/annotate/annotations- Save annotations
Author
Jebin Einstein E - jebineinstein@gmail.com