dchen0 / font-classifier-v4

huggingface.co
Total runs: 87
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: July 24 2025
image-classification

Introduction of font-classifier-v4

Model Details of font-classifier-v4

Font Classifier DINOv2 (Server-Side Preprocessing)

A fine-tuned DINOv2 model for font classification with built-in preprocessing .

🎯 Key Feature: No client-side preprocessing required!

Performance
  • Accuracy : ~86% on test set
  • Preprocessing : Automatic server-side pad-to-square + normalization
Usage
Simple API Usage (Recommended)

Clients can send raw images directly to inference endpoints:

import requests
import base64

# Load your image
with open("test_image.png", "rb") as f:
    image_data = base64.b64encode(f.read()).decode()

# Send to inference endpoint
response = requests.post(
    "https://your-endpoint.com",
    headers={"Authorization": "Bearer YOUR_TOKEN"},
    json={"inputs": image_data}
)

results = response.json()
print(f"Predicted font: {results[0]['label']} ({results[0]['score']:.2%})")
Standard HuggingFace Usage
from transformers import pipeline

# The model automatically handles preprocessing
classifier = pipeline("image-classification", model="dchen0/font-classifier-v4")
results = classifier("your_image.png")
print(f"Predicted font: {results[0]['label']}")
Direct Model Usage
from PIL import Image
import torch
from transformers import AutoImageProcessor
from font_classifier_with_preprocessing import FontClassifierWithPreprocessing

# Load model and processor
model = FontClassifierWithPreprocessing.from_pretrained("dchen0/font-classifier-v4")
processor = AutoImageProcessor.from_pretrained("dchen0/font-classifier-v4")

# Process image (model handles pad_to_square automatically)
image = Image.open("test.png")
inputs = processor(images=image, return_tensors="pt")
outputs = model(**inputs)
Model Architecture
  • Base Model : facebook/dinov2-base-imagenet1k-1-layer
  • Fine-tuning : LoRA on Google Fonts dataset
  • Labels : 394 font families
  • Preprocessing : Built-in pad-to-square + ImageNet normalization
Server-Side Preprocessing

This model automatically applies the following preprocessing in its forward pass:

  1. Pad to square preserving aspect ratio
  2. Resize to 224×224
  3. Normalize with ImageNet statistics

No client-side preprocessing required - just send raw images!

Deployment
HuggingFace Inference Endpoints
  1. Deploy this model to an Inference Endpoint
  2. Send raw images directly - preprocessing happens automatically
  3. Achieve ~86% accuracy out of the box
Custom Deployment

The model includes preprocessing in the forward pass, so any deployment (TorchServe, TensorFlow Serving, etc.) will automatically apply correct preprocessing.

Files
  • font_classifier_with_preprocessing.py : Custom model class with built-in preprocessing
  • Standard HuggingFace model files
Technical Details

The model inherits from Dinov2ForImageClassification but overrides the forward pass to include:

def forward(self, pixel_values=None, labels=None, **kwargs):
    # Automatic preprocessing happens here
    processed_pixel_values = self.preprocess_images(pixel_values)
    return super().forward(pixel_values=processed_pixel_values, labels=labels, **kwargs)

This ensures that whether clients send raw images or pre-processed tensors, the model receives correctly formatted input.

Runs of dchen0 font-classifier-v4 on huggingface.co

87
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About font-classifier-v4 huggingface.co Model

More font-classifier-v4 license Visit here:

https://choosealicense.com/licenses/apache-2.0

font-classifier-v4 huggingface.co

font-classifier-v4 huggingface.co is an AI model on huggingface.co that provides font-classifier-v4's model effect (), which can be used instantly with this dchen0 font-classifier-v4 model. huggingface.co supports a free trial of the font-classifier-v4 model, and also provides paid use of the font-classifier-v4. Support call font-classifier-v4 model through api, including Node.js, Python, http.

font-classifier-v4 huggingface.co Url

https://huggingface.co/dchen0/font-classifier-v4

dchen0 font-classifier-v4 online free

font-classifier-v4 huggingface.co is an online trial and call api platform, which integrates font-classifier-v4's modeling effects, including api services, and provides a free online trial of font-classifier-v4, you can try font-classifier-v4 online for free by clicking the link below.

dchen0 font-classifier-v4 online free url in huggingface.co:

https://huggingface.co/dchen0/font-classifier-v4

font-classifier-v4 install

font-classifier-v4 is an open source model from GitHub that offers a free installation service, and any user can find font-classifier-v4 on GitHub to install. At the same time, huggingface.co provides the effect of font-classifier-v4 install, users can directly use font-classifier-v4 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

font-classifier-v4 install url in huggingface.co:

https://huggingface.co/dchen0/font-classifier-v4

Url of font-classifier-v4

font-classifier-v4 huggingface.co Url

Provider of font-classifier-v4 huggingface.co

dchen0
ORGANIZATIONS

Other API from dchen0

huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:January 10 2023