Example of how to classify an image into one of the 26 classes using onnx runtime:
import onnxruntime
import numpy as np
import torchvision.transforms as transforms
from PIL import Image
import requests
LABELS = [
"logo",
"photograph",
"icon",
"engineering_drawing",
"line_chart",
"bar_chart",
"other",
"table",
"flow_chart",
"screenshot_from_computer",
"signature",
"screenshot_from_manual",
"geographical_map",
"pie_chart",
"page_thumbnail",
"stamp",
"music",
"calendar",
"qr_code",
"bar_code",
"full_page_image",
"scatter_plot",
"chemistry_structure",
"topographical_map",
"crossword_puzzle",
"box_plot"
]
urls = [
'http://images.cocodataset.org/val2017/000000039769.jpg',
'http://images.cocodataset.org/test-stuff2017/000000001750.jpg',
'http://images.cocodataset.org/test-stuff2017/000000000001.jpg'
]
images = []
for url in urls:
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
images.append(image)
image_processor = transforms.Compose(
[
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.47853944, 0.4732864, 0.47434163],
),
]
)
processed_images_onnx = [image_processor(image).unsqueeze(0) for image in images]
# onnx needs numpy as input
onnx_inputs = [item.numpy(force=True) for item in processed_images_onnx]
# pack into a batch
onnx_inputs = np.concatenate(onnx_inputs, axis=0)
ort_session = onnxruntime.InferenceSession(
"./DocumentFigureClassifier-v2_0-onnx/model.onnx",
providers=["CUDAExecutionProvider", "CPUExecutionProvider"]
)
for item in ort_session.run(None, {'input': onnx_inputs}):
for x initer(item):
pred = x.argmax()
print(LABELS[pred])
Citation
If you use this model in your work, please cite the following papers:
@article{Tan2019EfficientNetRM,
title={EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks},
author={Mingxing Tan and Quoc V. Le},
journal={ArXiv},
year={2019},
volume={abs/1905.11946}
}
@techreport{Docling,
author = {Deep Search Team},
month = {8},
title = {{Docling Technical Report}},
url={https://arxiv.org/abs/2408.09869},
eprint={2408.09869},
doi = "10.48550/arXiv.2408.09869",
version = {1.0.0},
year = {2024}
}
Runs of docling-project DocumentFigureClassifier-v2.0 on huggingface.co
4.6K
Total runs
0
24-hour runs
148
3-day runs
249
7-day runs
249
30-day runs
More Information About DocumentFigureClassifier-v2.0 huggingface.co Model
More DocumentFigureClassifier-v2.0 license Visit here:
DocumentFigureClassifier-v2.0 huggingface.co is an AI model on huggingface.co that provides DocumentFigureClassifier-v2.0's model effect (), which can be used instantly with this docling-project DocumentFigureClassifier-v2.0 model. huggingface.co supports a free trial of the DocumentFigureClassifier-v2.0 model, and also provides paid use of the DocumentFigureClassifier-v2.0. Support call DocumentFigureClassifier-v2.0 model through api, including Node.js, Python, http.
DocumentFigureClassifier-v2.0 huggingface.co is an online trial and call api platform, which integrates DocumentFigureClassifier-v2.0's modeling effects, including api services, and provides a free online trial of DocumentFigureClassifier-v2.0, you can try DocumentFigureClassifier-v2.0 online for free by clicking the link below.
docling-project DocumentFigureClassifier-v2.0 online free url in huggingface.co:
DocumentFigureClassifier-v2.0 is an open source model from GitHub that offers a free installation service, and any user can find DocumentFigureClassifier-v2.0 on GitHub to install. At the same time, huggingface.co provides the effect of DocumentFigureClassifier-v2.0 install, users can directly use DocumentFigureClassifier-v2.0 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
DocumentFigureClassifier-v2.0 install url in huggingface.co: