Views
No views yet
| Model | Recognition Avg Accuracy(%) | Model Storage Size (M) | Introduction |
|---|---|---|---|
| PP-LCNet_x1_0_textline_ori | 98.85 | 0.96 | Text line classification model based on PP-LCNet_x0_25, with two classes: 0 degrees and 180 degrees |
1import requests
2from PIL import Image
3from transformers import AutoImageProcessor, AutoModelForImageClassification
4
5model_path = "PaddlePaddle/PP-LCNet_x1_0_textline_ori_safetensors"
6model = AutoModelForImageClassification.from_pretrained(model_path, device_map="auto")
7image_processor = AutoImageProcessor.from_pretrained(model_path)
8
9image = Image.open(requests.get("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/textline_rot180_demo.jpg", stream=True).raw)
10inputs = image_processor(images=image, return_tensors="pt").to(model.device)
11outputs = model(**inputs)
12predicted_label = outputs.logits.argmax(-1).item()
13print(model.config.id2label[predicted_label])