Manga109 - Large-scale manga dataset with speech bubble annotations
🚀 Quick Start
Installation
pip install ultralytics>=8.0.0
Inference
python
1from ultralytics import YOLO
23# Load the model4model = YOLO("best.pt")56# Run inference on an image7results = model("manga_page.jpg")89# Process results10for result in results:11# Get bounding boxes12 boxes = result.boxes
1314# Get segmentation masks15 masks = result.masks
1617# Visualize results18 result.show()1920# Save results21 result.save("output.jpg")
Batch Processing
python
1from ultralytics import YOLO
2from pathlib import Path
34model = YOLO("best.pt")56# Process multiple images7image_folder = Path("manga_pages/")8results = model(list(image_folder.glob("*.jpg")), stream=True)910for i, result inenumerate(results):11 result.save(f"output_{i}.jpg")
Extract Bubble Regions
python
1import cv2
2import numpy as np
3from ultralytics import YOLO
45model = YOLO("best.pt")6image = cv2.imread("manga_page.jpg")7results = model(image)[0]89# Extract each bubble as a separate image10for i, mask inenumerate(results.masks.data):11 mask_np = mask.cpu().numpy()12 mask_resized = cv2.resize(mask_np,(image.shape[1], image.shape[0]))1314# Apply mask15 bubble = image.copy()16 bubble[mask_resized <0.5]=01718# Get bounding box and crop19 coords = np.where(mask_resized >=0.5)20iflen(coords[0])>0:21 y_min, y_max = coords[0].min(), coords[0].max()22 x_min, x_max = coords[1].min(), coords[1].max()23 cropped = bubble[y_min:y_max, x_min:x_max]24 cv2.imwrite(f"bubble_{i}.png", cropped)
📁 Model Files
weights/
├── best.pt # Best checkpoint (recommended)
└── last.pt # Last training checkpoint
🎯 Use Cases
Manga Translation: Automatically detect speech bubbles for text extraction and translation
Manga Analysis: Study panel layouts and dialogue distribution
Content Moderation: Identify and process text regions in comics
Accessibility: Enable text-to-speech for manga readers
Dataset Creation: Generate annotations for manga datasets