CoolFace
Modelpublic

RoyRud1902/yolo11n-text

sourceHugging Faceapache-2.0updated 9mo agoView on Hugging Face
7likes8.1kdownloads
Model Card

YOLO11n Text

A fine-tuned YOLO11n model for detecting text regions in images. This model is optimized for detecting text bounding boxes in documents, screenshots, UI interfaces, and natural scene images.

Model Description

This model is based on Ultralytics YOLO11n (nano variant) and has been fine-tuned specifically for text detection tasks. It detects text regions as bounding boxes, which can be used as input for OCR pipelines or UI automation tasks.

Model Architecture

  • Base Model: YOLO11n (nano)
  • Parameters: 2,590,035
  • Layers: 181
  • Input Size: 640x640
  • Classes: 1 (text)

Training Details

Dataset

Training Configuration

ParameterValue
Epochs50
Batch Size16
Image Size640
OptimizerSGD (auto)
Learning Rate0.01 → 0.0003
Momentum0.937
Weight Decay0.0005
Warmup Epochs3.0
AMPEnabled
Workers8

Augmentation

AugmentationValue
HSV Hue0.015
HSV Saturation0.7
HSV Value0.4
Translation0.1
Scale0.5
Horizontal Flip0.5
Mosaic1.0
Erasing0.4
Auto Augmentrandaugment

Hardware

  • GPU: NVIDIA GeForce RTX 5070 Ti (16GB VRAM)
  • Training Time: ~1.75 hours (6,267 seconds)
  • Framework: Ultralytics 8.3.240, PyTorch 2.9.1+cu128

Performance Metrics

Final Results (Epoch 50)

MetricValue
Precision95.7%
Recall93.6%
mAP@5097.6%
mAP@50-9581.8%
Box Loss0.619
Class Loss0.376
DFL Loss0.828

Training Progress

EpochmAP@50mAP@50-95PrecisionRecall
189.1%64.3%86.0%82.7%
1095.9%76.8%93.5%90.7%
2096.9%79.5%94.8%92.0%
3097.3%80.8%95.1%93.1%
4097.6%81.5%95.6%93.5%
5097.6%81.8%95.7%93.6%

Usage

Installation

bash
pip install ultralytics

Inference

python
from ultralytics import YOLO

# Load the model
model = YOLO("best.pt")

# Run inference
results = model.predict(
    source="image.jpg",
    conf=0.25,
    iou=0.7,
    imgsz=640
)

# Process results
for result in results:
    boxes = result.boxes
    for box in boxes:
        # Get bounding box coordinates (x1, y1, x2, y2)
        xyxy = box.xyxy[0].tolist()
        confidence = box.conf[0].item()
        print(f"Text box: {xyxy}, confidence: {confidence:.2f}")

Batch Processing

python
from ultralytics import YOLO
from pathlib import Path

model = YOLO("best.pt")

# Process folder of images
results = model.predict(
    source="path/to/images/",
    conf=0.25,
    save=True,  # Save annotated images
    save_txt=True  # Save YOLO format labels
)

Export to Other Formats

python
from ultralytics import YOLO

model = YOLO("best.pt")

# Export to ONNX
model.export(format="onnx", imgsz=640, simplify=True)

# Export to TensorRT (for NVIDIA GPUs)
model.export(format="engine", imgsz=640, half=True)

# Export to CoreML (for Apple devices)
model.export(format="coreml", imgsz=640)

Model Files

FileDescription
best.ptBest checkpoint (highest mAP@50)
args.yamlTraining configuration
results.csvTraining metrics per epoch
results.pngTraining curves visualization
confusion_matrix.pngConfusion matrix
BoxPR_curve.pngPrecision-Recall curve

Recommended Inference Parameters

ParameterRecommendedDescription
conf0.25Confidence threshold
iou0.7NMS IoU threshold
imgsz640-1024Input image size
max_det300Maximum detections per image

Use Cases

  • OCR Preprocessing: Detect text regions before applying OCR
  • Document Analysis: Locate text areas in scanned documents
  • UI Automation: Find text elements in application screenshots
  • Scene Text Detection: Detect text in natural images
  • PDF Processing: Extract text region locations

Limitations

  • Optimized for horizontal text; may have reduced accuracy on rotated text
  • Trained primarily on document and UI images
  • Single class (text) - does not distinguish between text types
  • Best performance at 640px input size

Citation

bibtex
@software{yolo11n_text,
  author = {Ultralytics},
  title = {YOLO11n Text},
  year = {2024},
  publisher = {HuggingFace},
  url = {https://huggingface.co/datasets/DonkeySmall/Yolo-Text-Detection}
}

@software{ultralytics_yolo,
  author = {Jocher, Glenn and Chaurasia, Ayush and Qiu, Jing},
  title = {Ultralytics YOLO},
  year = {2023},
  publisher = {GitHub},
  url = {https://github.com/ultralytics/ultralytics}
}

License

This model is released under the Apache 2.0 License.

Acknowledgments

  • Ultralytics for the YOLO11 architecture
  • DonkeySmall for the training dataset
  • HuggingFace for model hosting