YOLOv8s – Custom PDF Logo Detector
Author: lakshya-rawat
Model family: Ultralytics YOLOv8s
Task: Object detection (logo detection on PDF first‑page images)
This repository contains a YOLOv8s model checkpoint trained on a custom logo detection dataset built from the first pages of PDF documents.
It is intended to be used as a building block for applications that need to:
- Detect company logos on PDF first pages
- Use detections as a signal for grouping / sorting PDFs by company or vendor
The main training checkpoint is stored as:
best.pt– YOLOv8s weights
Note: The surrounding FastAPI application and clustering pipeline are not included here; this repo focuses only on the reusable detection model and a minimal usage script.
Model Details
- Architecture: YOLOv8s (Ultralytics)
- Framework: PyTorch via
ultralyticsPython package - Input: RGB images (e.g. first page of a PDF rendered to
.jpg/.png) - Output: Bounding boxes, class IDs, confidences for detected logos
- Checkpoint file:
best.ptin this repository
Training Plots
Overall training metrics:
Precision / recall curves:
Confusion matrices:
Intended Use
- Use this model to run logo detection on document images (especially PDF first pages).
- Typical downstream use cases:
- Clustering / grouping PDFs by detected logo (company)
- Prioritizing documents with recognized logos
Limitations
- The model was trained on a custom dataset and may not generalize to:
- Logos outside the training distribution
- Very different document layouts / scan qualities
- It is not a general object detection model.
Installation
Install Python dependencies:
pip install ultralytics torch torchvision
If you plan to use this model from the Hugging Face Hub, also install:
pip install huggingface_hub
Quickstart – Local Weights (best.pt)
- Place
best.ptin the same directory as thisREADME.mdandmain.py. - Run inference on an image:
python main.py --weights best.pt --source path/to/first_page_image.jpg
This will:
- Load the YOLOv8s model from
best.pt - Run detection on the provided image
- Display the image with logo bounding boxes overlaid
You can also use the model directly from Python:
from ultralytics import YOLO
model = YOLO("best.pt") # path to local checkpoint
results = model("path/to/first_page_image.jpg")
results[0].show() # display image with boxes
Using from Hugging Face Hub
Once the model is pushed to the Hub under your account (for example):
- Repo ID:
lakshya-rawat/yolov8s-pdf-logo-detector
You can load it directly:
from ultralytics import YOLO
model = YOLO("lakshya-rawat/yolov8s-pdf-logo-detector")
results = model("path/to/first_page_image.jpg")
for r in results:
r.show()
If you prefer to download the weights first:
huggingface-cli download lakshya-rawat/yolov8s-pdf-logo-detector best.pt
python main.py --weights best.pt --source path/to/first_page_image.jpg
Example: Integrating into Your Own App
You can reuse the same pattern as in main.py to plug the model into your own application:
from ultralytics import YOLO
model = YOLO("best.pt") # or "lakshya-rawat/yolov8s-pdf-logo-detector"
def detect_logos(image_path: str):
results = model(image_path)
detections = []
for r in results:
for box in r.boxes:
detections.append({
"xyxy": box.xyxy[0].tolist(),
"confidence": float(box.conf[0]),
"class_id": int(box.cls[0]),
})
return detections
You are free to extend this with OCR, clustering, or PDF‑specific logic in your own codebase.
Files in This Repo
best.pt– YOLOv8s checkpoint trained on a custom PDF logo dataset.main.py– Minimal example script to run inference via CLI.README.md– This model card and usage documentation.
- Downloads last month
- -
Model tree for lakshya-rawat/YOLOV8s-Custom-Logo-detection
Base model
Ultralytics/YOLOv8




