Views
No views yet
transformers compatible version of MangaLineExtraction_PyTorch.1from PIL import Image
2import torch
3
4from transformers import AutoModel, AutoImageProcessor
5
6REPO_NAME = "p1atdev/MangaLineExtraction-hf"
7
8model = AutoModel.from_pretrained(REPO_NAME, trust_remote_code=True)
9processor = AutoImageProcessor.from_pretrained(REPO_NAME, trust_remote_code=True)
10
11image = Image.open("./sample.jpg")
12
13inputs = processor(image, return_tensors="pt")
14
15with torch.no_grad():
16 outputs = model(inputs.pixel_values)
17
18line_image = Image.fromarray(outputs.pixel_values[0].numpy().astype("uint8"), mode="L")
19line_image.save("./line_image.png")1from transformers import pipeline
2
3pipe = pipeline("image-to-image", model="p1atdev/MangaLineExtraction-hf", trust_remote_code=True)
4pipe("sample.jpg")sample.jpg | Generated line image |
|---|---|
![]() | ![]() |
1@article{li-2017-deep,
2 author = {Chengze Li and Xueting Liu and Tien-Tsin Wong},
3 title = {Deep Extraction of Manga Structural Lines},
4 journal = {ACM Transactions on Graphics (SIGGRAPH 2017 issue)},
5 month = {July},
6 year = {2017},
7 volume = {36},
8 number = {4},
9 pages = {117:1--117:12},
10}