🚀 MangaLineExtraction-hf
這是與Hugging Face transformers
庫兼容的 MangaLineExtraction_PyTorch 版本。它能實現圖像到圖像的轉換,尤其適用於漫畫線條提取。
🚀 快速開始
代碼示例
你可以使用以下代碼進行漫畫線條提取:
from PIL import Image
import torch
from transformers import AutoModel, AutoImageProcessor
REPO_NAME = "p1atdev/MangaLineExtraction-hf"
model = AutoModel.from_pretrained(REPO_NAME, trust_remote_code=True)
processor = AutoImageProcessor.from_pretrained(REPO_NAME, trust_remote_code=True)
image = Image.open("./sample.jpg")
inputs = processor(image, return_tensors="pt")
with torch.no_grad():
outputs = model(inputs.pixel_values)
line_image = Image.fromarray(outputs.pixel_values[0].numpy().astype("uint8"), mode="L")
line_image.save("./line_image.png")
或者,你也可以使用 pipeline
方式:
from transformers import pipeline
pipe = pipeline("image-to-image", model="p1atdev/MangaLineExtraction-hf", trust_remote_code=True)
pipe("sample.jpg")
示例結果展示
sample.jpg |
生成的線條圖像 |
 |
 |
📚 詳細文檔
模型詳情
- 開發者:Chengze Li, Xueting Liu, Tien-Tsin Wong
- 轉換者:Plat
- 許可證:MIT
模型來源
- 倉庫:https://github.com/ljsabc/MangaLineExtraction_PyTorch
- 論文:https://ttwong12.github.io/papers/linelearn/linelearn.pdf
- 項目頁面:https://www.cse.cuhk.edu.hk/~ttwong/papers/linelearn/linelearn.html
📄 許可證
本項目採用 MIT 許可證。
📚 引用
如果你使用了該模型,請按照以下格式引用:
@article{li-2017-deep,
author = {Chengze Li and Xueting Liu and Tien-Tsin Wong},
title = {Deep Extraction of Manga Structural Lines},
journal = {ACM Transactions on Graphics (SIGGRAPH 2017 issue)},
month = {July},
year = {2017},
volume = {36},
number = {4},
pages = {117:1--117:12},
}