🔍 Brand Eye - YOLO Brand Detection Model
A powerful YOLO-based object detection model specifically trained for brand and logo recognition tasks.
🌟 Overview
Brand Eye is a state-of-the-art computer vision model that can detect and classify various brands and logos in images. Built on the YOLO (You Only Look Once) architecture, it provides fast and accurate real-time brand detection capabilities.
📊 Model Performance
- Training Epochs: 50
- Best [email protected]: 0.825+ (See training results)
- Best [email protected]:0.95: 0.494+ (See training results)
- Architecture: YOLOv5/YOLOv8 Custom
- Input Size: 640x640
- Model Size: ~14MB (optimized)
📈 Training Metrics
🎯 Model Accuracy
📋 Validation Examples
| Ground Truth Labels | Model Predictions |
|---|---|
![]() |
![]() |
| Ground truth annotations | Model predictions with confidence scores |
🎬 Demo Results
See the model in action! The images above show:
- Training Metrics: Comprehensive performance charts showing loss curves, precision, recall, and mAP scores over 50 epochs
- Confusion Matrix: Normalized confusion matrix displaying model accuracy across different brand classes
- Validation Examples: Side-by-side comparison of ground truth labels vs. model predictions on validation data
The model demonstrates excellent performance with:
- ✅ High precision in brand detection
- ✅ Strong recall across different brand categories
- ✅ Accurate bounding box predictions
- ✅ Reliable confidence scoring
🚀 Quick Start
Installation
pip install ultralytics huggingface_hub torch torchvision opencv-python pillow
Download Model from Hugging Face
from huggingface_hub import hf_hub_download
from ultralytics import YOLO
# Download the trained model
model_path = hf_hub_download(
repo_id="haydarkadioglu/brand-eye",
filename="brandeye.pt"
)
# Load the model
model = YOLO(model_path)
Basic Usage
Single Image Detection
import cv2
from PIL import Image
def detect_brands(image_path, conf_threshold=0.25):
"""
Detect brands in a single image
Args:
image_path (str): Path to the image file
conf_threshold (float): Confidence threshold (0.0-1.0)
Returns:
results: Detection results with bounding boxes and labels
"""
results = model(image_path, conf=conf_threshold)
# Display results
results[0].show()
# Get detection details
boxes = results[0].boxes
if boxes is not None:
print(f"Found {len(boxes)} brand detections:")
for box in boxes:
conf = box.conf[0].item()
cls = int(box.cls[0].item())
class_name = model.names[cls]
print(f" - {class_name}: {conf:.3f} confidence")
return results
# Example usage
results = detect_brands("path/to/your/image.jpg")
Batch Processing
import os
from pathlib import Path
def process_folder(input_folder, output_folder="results", conf=0.25):
"""
Process all images in a folder
Args:
input_folder (str): Path to folder containing images
output_folder (str): Path to save results
conf (float): Confidence threshold
"""
input_path = Path(input_folder)
output_path = Path(output_folder)
output_path.mkdir(exist_ok=True)
# Supported image formats
image_extensions = ['.jpg', '.jpeg', '.png', '.bmp', '.tiff', '.webp']
for img_file in input_path.iterdir():
if img_file.suffix.lower() in image_extensions:
print(f"Processing {img_file.name}...")
# Run detection
results = model(str(img_file), conf=conf)
# Save annotated image
save_path = output_path / f"detected_{img_file.name}"
results[0].save(str(save_path))
# Print summary
boxes = results[0].boxes
if boxes is not None:
print(f" ✅ Found {len(boxes)} brands")
else:
print(f" ❌ No brands detected")
# Example usage
process_folder("input_images/", "detection_results/")
Real-time Detection (Webcam)
import cv2
def real_time_detection():
"""
Real-time brand detection using webcam
"""
cap = cv2.VideoCapture(0) # Use 0 for default camera
while True:
ret, frame = cap.read()
if not ret:
break
# Run detection
results = model(frame, conf=0.3)
# Draw results on frame
annotated_frame = results[0].plot()
# Display frame
cv2.imshow('Brand Detection', annotated_frame)
# Exit on 'q' press
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
# Run real-time detection
# real_time_detection()
📁 Project Structure
brand-eye/
├── README.md # This file
├── visualize.ipynb # Training results visualization
├── brandeye.pt # Trained model weights
├── model/
│ ├── train/
│ │ ├── results.csv # Training metrics
│ │ ├── weights/
│ │ │ └── last.pt # Final model checkpoint
│ │ └── *.png # Training plots
│ └── val/
│ ├── predictions.json # Validation predictions
│ └── *.png # Validation visualizations
├── confusion_matrix_normalized.png # Model confusion matrix
└── val_batch*_*.jpg # Validation batch examples
🎯 Use Cases
- Brand Monitoring: Track brand presence in social media images
- Market Research: Analyze brand visibility in retail environments
- Advertising Analysis: Measure brand exposure in marketing materials
- Quality Control: Verify proper brand logo placement
- Content Moderation: Detect unauthorized brand usage
🔧 Advanced Usage
Custom Confidence Thresholds
# High precision (fewer false positives)
results_high_conf = model("image.jpg", conf=0.7)
# High recall (catch more brands, may include false positives)
results_low_conf = model("image.jpg", conf=0.1)
Export to Different Formats
# Export detections to JSON
import json
def export_detections(image_path, output_json):
results = model(image_path)
detections = []
boxes = results[0].boxes
if boxes is not None:
for box in boxes:
detection = {
"class": model.names[int(box.cls[0])],
"confidence": float(box.conf[0]),
"bbox": box.xyxy[0].tolist() # [x1, y1, x2, y2]
}
detections.append(detection)
with open(output_json, 'w') as f:
json.dump(detections, f, indent=2)
export_detections("image.jpg", "detections.json")
🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
📞 Contact
- Project: GitHub Repository
- Model: Hugging Face Model
- Issues: GitHub Issues
Made with ❤️ for brand detection
- Downloads last month
- 12
Model tree for haydarkadioglu/brand-eye
Base model
Ultralytics/YOLOv8


