The problem
Designers checking a new logo for conflicts, brand teams hunting copycats and marketplaces screening uploads all need the same thing: given a logo, find the visually similar ones in a large database. Pixel comparison fails because the same logo can appear at different sizes, crops and backgrounds, and a plain classifier only recognizes brands it was trained on. The Siamese network solves this by learning an embedding space: a CNN maps every logo to a compact vector, trained with triplet loss so same-brand logos land close together and different brands land far apart. Once every database logo is embedded and indexed, a query becomes a nearest-neighbor lookup — fast, scalable, robust to the variations that break template matching, and able to compare brands never seen in training. This build trains that network on FlickrLogos-32 / Logo-2K+ brand imagery, in the lineage of Bromley et al. (1993) and Schroff et al.'s FaceNet triplet loss. A Flask demo returns top-K similar logos with distance scores, and a notebook computes Recall@K on a held-out query set during the build.
How it works
Dataset & model:
Dataset names: FlickrLogos-32 (Romberg et al., ICMR 2011 — 32 brands, 70 images per brand) and Logo-2K+ (Su et al. — large-scale web brand-logo collection). Source: the official public releases. Task: visual similarity search / metric learning (retrieval, not classification). Classes: brand labels (32 in FlickrLogos-32; many more in Logo-2K+) — used to form anchor/positive/negative triplets, not as classifier targets.
Model: Siamese CNN embedding network, trained with triplet loss (lineage: Bromley et al., NIPS 1993; Schroff et al., FaceNet, arXiv:1502.00873, CVPR 2015) plus contrastive loss, with hard-negative mining.
Input: a query logo image. Prediction: an L2-normalized embedding vector. Output: the top-K nearest database logos with brand names and Euclidean distance scores.
Evaluation metrics: Recall@K on a held-out query set, computed by the evaluation notebook during the build. Design target: Recall@10 ~85%+ — a target for the training run, explicitly not a pre-measured claim.
Working:
- Dataset: logo images from the FlickrLogos-32 / Logo-2K+ collection are loaded with brand labels; a query split is held out for evaluation.
- Preprocessing: logos are resized and normalized; triplets are formed — an anchor logo, a positive (same brand) and a negative (different brand) — with hard-negative mining selecting the informative negatives.
- Training phase: the Siamese CNN embeds each logo; triplet (and contrastive) loss pulls same-brand embeddings together and pushes different-brand embeddings apart by a margin; training progress is tracked with t-SNE visualizations of the embedding space.
- Indexing: after training, every database logo is embedded once and stored in a nearest-neighbor index.
- Evaluation phase (offline): the evaluation notebook embeds the held-out query set and computes Recall@K during the build, against the design target of Recall@10 ~85%+ — a target for the training run, not a pre-claimed score.
- Inference phase (demo): a query logo uploaded to the Flask app is embedded with the same network at request time; the index returns the K nearest database embeddings with distances, and the app displays ranked logos with brand names and distance scores.
Specifications:
Model | Siamese CNN embedding network with triplet/contrastive loss
Loss lineage | Contrastive loss (Bromley et al., 1993); triplet loss (Schroff et al., arXiv:1502.00873)
Dataset | FlickrLogos-32 (32 brands) / Logo-2K+ brand-logo imagery
Search | Database embeddings indexed once for nearest-neighbor retrieval
Embeddings | L2-normalized vectors; retrieval by Euclidean distance in embedding space
Metric | Recall@K on a held-out query set, computed during the build; design target Recall@10 ~85%+
Input | Query logo image (JPEG, PNG)
Output | Top-K ranked logos with brand names and distance scores
Demo app | Flask with logo upload, adjustable K, brand filter, ranked results
Project features
Logo Upload with Top-K Results [implemented] — Upload a logo and receive the top-K visually similar logos, ranked by embedding distance with brand names and scores.
Distance Scores on Every Result [implemented] — Euclidean distances on L2-normalized embeddings are shown next to each result, so ranking evidence is visible.
Siamese CNN with Triplet and Contrastive Loss [implemented] — The embedding network trains with triplet loss plus contrastive loss, with hard-negative mining for informative triplets.
Nearest-Neighbor Index [implemented] — All database logos are embedded once and indexed, so queries resolve as fast nearest-neighbor lookups.
Adjustable K and Brand Filter [configurable] — Choose how many results to return and narrow the search space by brand name in the demo UI.
t-SNE Embedding Visualization [implemented] — The training notebook plots the learned embedding space so cluster quality can be inspected visually.
Recall@K Evaluation Notebook [implemented] — Computes Recall@K on a held-out query set during the build, against the stated design target.
New Logos Without Retraining [implemented] — A new logo is embedded once and appended to the index; no retraining is required.
What is included
Complete source code: Siamese network, triplet mining, indexing pipeline, Flask demo app
Trained embedding weights
Training notebook with t-SNE embedding visualization, and evaluation notebook (Recall@K)
Project report PDF: similarity-search background, metric-learning derivation, Recall@K procedure, error analysis
PPT presentation for final review
Viva Q&A preparation document: Siamese networks, triplet vs contrastive loss, embeddings, Recall@K, indexing
Setup guide: environment, dependencies, dataset download steps
Limitations & prerequisites
Retrieval is visual-similarity only: a different brand with a similar-looking mark can legitimately rank high, which the report discusses as a property of the task, not a bug.
Very small, blurry or heavily distorted query logos embed poorly and retrieve weakly.
The database covers the dataset's brand set; logos outside it have no exact match to find — the system retrieves the nearest-looking entries instead.
The Recall@10 ~85%+ figure is a design target for the training run, not a pre-measured claim.
This is an educational prototype, not a trademark-infringement or legal-clearance tool.
Frequently Asked Questions
Why a Siamese network instead of a plain classifier?
A classifier only recognizes brands it was trained on. A Siamese network learns a similarity space, so it can compare any two logos — including brands never seen in training — by distance in that space.
What is triplet loss, intuitively?
Each training step shows the network three logos: an anchor, a same-brand positive and a different-brand negative. The loss pulls the anchor toward the positive and pushes it away from the negative by at least a margin — repeated over many triplets, this sculpts the embedding space.
What does Recall@K mean here?
For each held-out query logo, we check whether at least one same-brand logo appears in the top-K retrieved results. Recall@K is the fraction of queries where that happens — the standard retrieval metric, computed by the notebook during the build against a design target of Recall@10 ~85%+.
What do the distance scores mean?
The Euclidean distance between the query's embedding and each database embedding, on L2-normalized vectors. Smaller distance means more visually similar; the demo shows the score next to every result.
Is this project suitable for a final-year project?
Yes — for B.E./B.Tech Computer Science, AI/ML and Data Science students. It covers metric learning, Siamese architectures, triplet vs contrastive loss, hard-negative mining, embedding visualization, and retrieval evaluation with a live ranked-results demo.
Components & software requirements
Python 3.10
PyTorch (Siamese CNN, triplet and contrastive loss)
torchvision, NumPy, scikit-learn (data loading, metrics)
Matplotlib (t-SNE embedding-space visualization)
Flask (demo web application)
Nearest-neighbor embedding index over the logo database (built during the build)
FlickrLogos-32 and Logo-2K+ brand-logo datasets (download guidance included)
Trained embedding weights shipped with the build; a GPU is recommended for training
Delivery information
Built-to-order. The Siamese training run with triplet mining (the pacing item), the embedding-index build, the Recall@K evaluation run, and the full documentation kit (report, PPT, viva Q&A, setup guide) are prepared fresh for the buyer. The exact build schedule is confirmed at quotation.
Support terms
- Setup guidance: environment, dependencies, dataset download steps, GPU guidance for training
- Viva preparation: Siamese architectures, triplet vs contrastive loss, hard-negative mining, reading t-SNE plots, interpreting Recall@K
- Customization discussion: new brands in the index, UI changes, alternative backbones (feasibility confirmed before quoting)