TL;DR: Logo Detection System for Sports Video

  • The challenge: Measure sponsor exposure in noisy broadcast video while supporting new brand onboarding without constant model retraining.
  • The architecture: A two-stage pipeline: YOLOv7x for 1-class logo localization and ResNet50 + Qdrant for vector-based brand classification.
  • Detection result: The YOLOv7x detector reached around 93% mAP50, with inference measured at around 5 ms in the experimental setup, while avoiding the commercial licensing requirements of YOLOv8+.
  • Classification result: Brand classification accuracy improved from 61.98% in the minimal baseline to 90.28% after expanding the dataset, fine-tuning ResNet50, and using neighborhood-based vector search.
  • The outcome: A maintainable GCP microservices architecture with separate evaluation, monitoring, feedback, and update workflows.

Project context: Measuring sponsor exposure in real sports footage

Our project started with a practical business goal: automatically measuring sponsor exposure in sports channel broadcasts. Traditionally, measuring brand visibility in sports is a manual, time-consuming process. Analysts sit through hours of video material to identify where sponsor logos appear and estimate how much exposure each brand received.

Before the ML pipeline can run, the video needs to be converted into image frames. This should be done with a consistent sampling strategy, for example taking frames at a fixed rate depending on how accurate the exposure timing needs to be. Higher sampling gives more precise exposure measurement but increases processing cost, while lower sampling is cheaper and usually sufficient for reporting trends across long broadcasts. Each extracted frame should keep its original timestamp, because the final sponsor report needs to translate model predictions back into real video time.

To automate this, the system had to process broadcast frames, locate sponsor logos, and classify each detected crop into a known brand. The output wasn't just a generic "a logo was found" event: it had to provide bounding box coordinates tied to clear brand identities for exposure-time reporting.

On paper, this sounds like a standard computer vision task: detect an object, crop it, classify it, and aggregate results. In practice, live broadcast video breaks almost every clean assumption that machine learning models rely on:

  • Unconstrained placement: Logos appear on creased shirts, moving players, pitch-side LED boards, walls, banners, overlays, and background elements.
  • Severe visual noise: Crops are frequently small, distorted by camera perspective, motion-blurred, or partially occluded by referees or players.
  • Data inconsistencies: Some visible logos in the frames were completely unannotated in the ground truth. Furthermore, class distributions were heavily imbalanced – top sponsors had thousands of examples, while long-tail brands had fewer than ten.

The final production metric was a Sponsor Exposure Score. Instead of reporting only whether a logo was detected, the system aggregated detections over video time and calculated exposure per brand. Consecutive detections of the same sponsor were grouped into visibility intervals, then weighted by how prominent the logo was on screen and by model confidence. This gave the business team two practical outputs: total exposure time and a weighted exposure score that better reflected real sponsor visibility during the broadcast.

That reality dictated our core challenge: we needed a system architecture that could be continuously evaluated, updated, monitored, and scaled as sponsor sets and visual data changed over time.

Why a single end-to-end model fails in production

When designing a logo exposure system, the initial temptation is to train a single, monolithic model that localizes and classifies every target brand in one pass. For a fixed set of brands in a closed experiment, that approach looks cleaner.

However, in a live business domain, localization and classification evolve at completely different speeds:

  • Localization is relatively stable: The features that make a bounding box "look like a logo" in a sports broadcast remain similar regardless of whether the sponsor is ORLEN, BMW, PGE, or an unknown local brand.
  • Brand identity is highly dynamic: New sponsors get onboarded mid-season, existing brands refresh their visual identity, and human reviewers frequently need to correct mislabeled predictions.

If localization and identification live inside a single neural network, every single brand update or rebranding event forces a full model retraining cycle. That makes maintenance expensive and operationally fragile.

To solve this, we decoupled the task into two independent stages:

  1. Logo Detector: A 1-class detector responsible only for localization. It answers: "Does this region look like a logo?"

  2. Logo Classifier: A vector-based classifier responsible for brand identity. It answers: "Which known brand does this crop match, or is it UNCLASSIFIED?"

1. The detector: Finding logo locations & licensing traps

The detection stage used a one-class object detector trained on 6,924 sports video frames. The model was trained purely to output bounding boxes for any candidate logo region.

During training, we encountered a classic production issue: incomplete ground truth. Secondary logos (such as channel watermarks) appeared in frames but were omitted from the label files. When our detector correctly localized these logos, standard evaluation metrics penalized them as False Positives. This distinction is crucial for a production pipeline: a model can be visually correct while its offline evaluation metrics are artificially suppressed by incomplete annotations.

When selecting our detector backbone, experimental metrics collided directly with commercial constraints. We tested several YOLO-based configurations, including additional experiments around training setup and hyperparameter selection. The useful finding was that hyperparameter tuning did not improve detection performance: most modifications caused the metrics to drop, suggesting that the default YOLO training configuration was already a strong fit for this dataset:

Model architecture mAP50 F1-Score Inference time Production verdict
YOLO11x 0.9135 0.8714 ~9.2 ms model inference in the measured setup Strong performance, but AGPL/commercial licensing constraints restricted closed-source deployment.
YOLOv7x 0.9320 0.8819 ~5 ms model inference in the measured setup Selected. GPL-compliant, excellent mAP50/F1 balance, and lower operational overhead.
Cloud Vision API Poor Poor N/A Failed on shirt creases and angled boards; lacked custom fine-tuning capabilities.

Data augmentation was also used during detector training by pasting 3-10 small logos (50-100 px) into sparse image regions. 

In the YOLOv7x experiments, controlled augmentation produced a small but consistent lift. The non-augmented YOLOv7x run reached mAP50 0.925, precision 0.894, recall 0.877, and F1 0.885. After adding controlled logo pasting, the augmented run reached mAP50 0.928, precision 0.901, recall 0.876, and F1 0.888.

The improvement was not dramatic, but it was useful. It showed that augmentation can help when synthetic logos preserve realistic placement, scale, and density. Later experiments also suggested that adding more synthetic data is not automatically better, so augmentation had to be treated as a controlled experiment rather than a guaranteed performance boost.

Building a Logo Detection System: Lessons Learned

Engineering Lesson #1: Detector selection & evaluation

  • Licensing over metrics: The newest model isn't automatically your best production candidate. License constraints and deployment simplicity often outweigh a 1% mAP gain.
  • Evaluate for the pipeline: Optimize for mAP50 rather than extreme bounding-box tightness (mAP95). As long as the crop contains the logo, the downstream classifier can handle the candidate.

2. The classifier: Vector search over closed softmax

Once candidate logo regions were cropped, they were passed to the classification layer. Because these crops were noisy, varied in size, and frequently contained unknown logos, a traditional closed softmax classifier was insufficient.

Instead, we used a fine-tuned ResNet50 model to convert each logo crop into a 1024-dimensional visual embedding, storing these vectors in a Qdrant database. During inference, new crops were embedded and matched against known brand clusters.

We evaluated three retrieval strategies across a dataset scaled to 18,333 embedded examples:

  • Nearest Neighbor (k=1): Highly vulnerable to visual noise, partial crops, and background clutter (achieved 61.98% baseline accuracy).
  • Class Centroid: Smoothes out intra-class variance too aggressively. It failed because a brand logo printed on a wrinkled shirt looks visually distinct from the same logo on a flat LED wall.
  • Neighborhood Consensus (k=4): Evaluates distance consensus among the 4 (tested also on 3 and 5) nearest vectors. This made classification less sensitive to outliers and mislabeled embeddings than single nearest-neighbor matching, making it the most resilient strategy in our experiments and improving accuracy to 90.28%.

We tested more classification variants than shown below, including different embedded datasets, thresholds, and retrieval strategies. The table summarizes only the key milestones that best explain how the classification stage improved from the initial baseline to the strongest tested setup.

Classifier strategy & dataset milestone Dataset size (samples) Retrieval / matching strategy Classification accuracy Key engineering lesson
Minimal baseline 380 images (38 brands × 10 images) Nearest Neighbor (k=1) 61.98% Extremely vulnerable to crop noise, aspect ratio shifts, and background clutter.
Centroid baseline 380 images Closest Class Centroid 56.26% A single average vector smooths out critical visual variations, such as shirt vs. LED board.
Expanded project data 3,267 images Nearest Neighbor (k=1) 68.78% Increasing real domain samples provided a ~7 percentage point accuracy boost.
ResNet50 fine-tuning 3,267 images Nearest Neighbor (k=1) 78.67% Adapting backbone weights to broadcast video crops delivered another ~10 percentage point jump.
Production architecture 18,333 client + UNCLASSIFIED embeddings; encoder fine-tuned on client data + LogoDet-3K (~200k logo objects) Neighborhood Consensus(k=4) 90.28% Best setup. Local neighborhood consensus (k=4) robustly shielded against noisy single vectors. Fine-tuning on a larger open-source logo dataset improved generalization.
Building a Logo Detection System: Lessons Learned

Engineering Lesson #2: Classification & Vector DB Hygiene

  • Test multiple matching strategies: In this project, neighborhood-based classification worked better than centroid or single-neighbor matching, but this is not a universal rule. Even with the same embeddings, different retrieval strategies can perform better or worse depending on class variance, crop quality, and dataset distribution.
  • Vector databases need hygiene: A mislabeled embedding can affect future predictions, so vector search systems need tools for inspecting nearest neighbors, correcting labels, and removing bad entries.
  • The "UNCLASSIFIED" class trade-off: Training an explicit UNCLASSIFIED cluster improved test set accuracy, but introduced a subtle trade-off: unseen onboarded logos could be incorrectly pulled toward UNCLASSIFIED instead of registering as new brand candidates.

3. Overcoming data imbalance & visual concept drift

Data imbalance was one of our primary performance bottlenecks in the classification stage. The training data included a large number of logo examples, but the distribution was highly uneven: some logo classes had only a few examples, often between 3 and 10 images, while others had several hundred or even thousands of crops.

This imbalance directly affected classification quality. Underrepresented classes initially plateaued at around 50–60% accuracy, compared to 80–98% for well-represented brands.

To mitigate this, we implemented three key adjustments:

  1. Circle loss: Employed during ResNet50 fine-tuning to optimize distance margins specifically for imbalanced vector spaces.
  2. Targeted augmentation: Applied rotation, blur, zoom, and color shifts strictly to classes with under 400 samples.
  3. Downsampling and oversampling: We also tested resampling strategies to reduce the impact of class imbalance between dominant sponsor classes and long-tail brands with only a few examples.
  4. K-means train/test splitting: K-means was used as a visual stratification strategy for the fixed classifier dataset prepared for the client. The goal was to split each brand into train and test sets while preserving similar proportions of visual variants inside the class. For example, if one logo appeared in different colors, layouts, or placements, clustering helped ensure that both train and test contained representative examples instead of accidentally testing only on a narrow visual subset.

Concept drift also manifested in concrete visual forms. Because brand identity evolved, monitoring drift via per-class recall became a mandatory operational requirement.

Real-world data challenge Production symptom & metric impact Engineering solution applied
Incomplete ground truth / label noise Visible logos or watermarks were sometimes missing from annotations. If the detector found them correctly, metrics still counted them as False Positives because no matching ground-truth box existed. Treated this as label noise. Controlled logo-pasting augmentation slightly improved detection metrics; in production, recurring watermarks should either be annotated or explicitly excluded from evaluation if they are outside sponsor exposure scope.
Severe class imbalance Long-tail sponsors with under 10 examples dropped to ~50–60% classification accuracy. Fine-tuned the embedding space using Circle Loss, weighted errors for underrepresented classes, and targeted augmentation on classes with <400 samples.
Visual concept drift Rebrandings and regional logo variations caused misclassifications. Added recent examples of changed logo variants to Qdrant instead of retraining the whole classifier. Because the system used learned visual embeddings, new crops could be matched against updated logo examples in vector space and classified correctly through neighborhood-based retrieval.
Poisoned vector memory (anomalies) A single mislabeled entry, such as ORLEN tagged as UNCLASSIFIED, pulled similar crops into the wrong cluster. Built a dedicated REST feedback endpoint and admin UI to inspect top-10 nearest vectors and purge bad entries by name.
Building a logo detection system: Lessons learned

Engineering Lesson #3: Monitoring & Data Engineering

  • Beware average accuracy: An overall 90% accuracy score can mask a 50% failure rate on a high-value commercial sponsor. Always monitor per-class recall, per-class F1, weighted F1, and aggregate accuracy.
  • Identity-preserving augmentation: Augmentation must preserve core brand identity. Over-cropping text or altering distinct colors can visually transform one brand into another, teaching the model false associations.

4. Production infrastructure, human feedback, and evaluation

Productionizing the system required around 14 weeks of ML engineering effort. The most challenging part was building a reliable logo-recognition workflow: training and evaluating the detector, fine-tuning the embedding model, designing the vector database layer, validating retrieval strategies, and creating feedback loops for correcting bad embeddings. REST APIs, batch processing, and dashboards were necessary production components which were built on top of it.

Three-tier evaluation pipeline

To deploy new model versions safely, we established three automated evaluation pipelines triggered on every release:

  1. Logo localization pipeline: Measures predicted-vs-ground-truth IoU and evaluates detection quality using mAP50, precision, recall, and F1 score.
  2. Logo classification pipeline: Measures classification accuracy, per-class metrics, UNCLASSIFIED accuracy, and weighted F1.
  3. End-to-end pipeline: Validates full system performance from raw video frame input to final brand assignment.

Human-in-the-loop & database maintenance

When human reviewers flag incorrect predictions in the UI, a dedicated endpoint captures the feedback. Because classification relies on Qdrant, mislabeled vectors act as "poisoned memory". We built admin tools allowing operators to look up suspicious test crops, inspect the top-10 nearest vectors, and purge mislabeled entries directly by name – resolving errors without needing a full model retraining run.

Infrastructure choices

We evaluated on-premise hardware against cloud microservices:

  • On-premise (RTX 4080 GPU, ~2,500 $ total, + monthly electricity and internet costs): Suffered from VRAM constraints (batch size crashes above size 8 at 640px resolution) and operational bottlenecks when training and batch inference queued for the same GPU.
  • AWS microservices (~$593.58/month): Estimated with g4dn.2xlarge for periodic GPU training, a CPU-based c5.2xlarge for the sampled-frame inference API, OpenSearch as the managed vector/search layer, and S3 for model and data storage. This was a viable cloud alternative, but slightly more expensive and less aligned with the Qdrant-based architecture selected for the project.
  • GCP microservices (~$573.11/month): Configured with g2-standard-4 for training, CPU-based n1-standard-8 for inference, Qdrant deployed separately on GKE, and Google Cloud Storage. This architecture separated training, inference, vector search, and storage, allowing the inference layer to scale independently during peak broadcast workloads.
Building a Logo Detection System: Lessons Learned

Engineering Lesson #4: Operations & Maintenance

  • Vector DBs need admin tooling: Vector databases make systems easier to update, but they require dedicated UI tools to inspect, audit, and clean stored embeddings.
  • Evidence-based retraining: Fix vector database entries first. Retraining should only be triggered when detector localization drops or drift spans broadly across multiple brand classes.

Conclusion: Lessons learned from building production computer vision

This project started with a practical business goal: automatically measure sponsor exposure in sports broadcasts. But the broader lesson is that production computer vision is rarely solved by one model or one metric.

The system had to deal with incomplete labels, noisy broadcast frames, class imbalance, changing brand identities, similar logos, human corrections, vector database quality, model versioning, retraining decisions, and infrastructure constraints. Each of these problems shaped the architecture as much as the model choice itself.

The key lessons were:

  1. Separate what changes slowly from what changes often.
    Logo localization was relatively stable, so it could be handled by a one-class YOLOv7x detector. Brand identity changed more often, so it needed a more updateable classification layer based on ResNet50 embeddings and Qdrant.
  2. Choose models for production constraints, not only benchmark performance.
    YOLO11x performed well, but licensing and deployment constraints made YOLOv7x the better production candidate. The right model was the one that balanced accuracy, speed, maintainability, and commercial usability.
  3. Treat data quality as part of the system.
    Missing labels, underrepresented sponsors, visual concept drift, and poisoned vector entries all affected model behavior. This is why per-class metrics, identity-preserving augmentation, K-means splitting, and vector database hygiene became essential.
  4. Evaluate and operate the full pipeline.
    A reliable logo exposure system needed separate evaluation for localization, brand classification, and end-to-end output, plus human feedback loops and monitoring channels to decide whether a new model release should be deployed or blocked.