Library / Case Studies
Deep Learning for Frame Detection in Product Images at Allegro
At Allegro we are faced with a technical challenge: how to recognize whether a given image (a product thumbnail) shows just a product itself. One of the things that we would like to detect is when the product is surrounded by a frame. In this post we would like to present our approach for detecting a frame in the…
By Allegro engineers · Allegro · Added 2026-10-12
All content belongs to Allegro engineers / Allegro. We only link to it and give credit. Report a problem
Learn this case study
About 37 min left. Your work is saved as you go.
What you are about to study
Allegro explains a real system. You should know the basics: caching, queues and replication.
Ideas you will meet
- Distributed Systems
- Consensus, time, failure and the fundamentals of scale-out.
- Machine Learning Systems
- Recommendations, ranking, feature stores and serving models at scale.
What we already know about this
Our own lessons on these ideas. Read them here before you start, so it makes sense.
Low-Level Design Practice · 10 minHow to approach a low-level design problemA repeatable six-step method: clarify, find the nouns, give each a responsibility, relate them, pick patterns and then code the core.Read here
Low-level design is about structure
A high-level design decides servers, databases and queues. A low-level design (LLD) decides classes, methods and relationships inside one program. The questions are: what objects exist, who owns which rule, and how will this change next month?
Interviewers use LLD problems (a parking lot, an elevator, a chess game) because a small problem shows how you think: do you clarify, do you model sensibly, do you keep rules in one place, do you notice concurrency?
The six steps
100%Figure SDA-LLD-01-1 · The six-step method for low-level design · © forcsguy.com
- Clarify requirements. Who uses it? What are the three to five main flows? What is the scale? What is deliberately out of scope?
- Find the nouns and verbs. Nouns become candidate classes; verbs become methods. Drop nouns that are only values (a price can be a number or a small value type).
- Assign responsibilities. Each class owns its data and the rules about that data. If a rule needs data from two classes, ask which one should own it or whether a third coordinating class is justified.
- Draw relationships. Has-a (composition), is-a (inheritance, used sparingly), uses (dependency). Prefer composition and interfaces to deep inheritance.
- Apply patterns where they earn their keep. A lifecycle with many states suggests the State pattern; swappable rules (pricing, matching) suggest Strategy; things that react to events suggest Observer; complex creation suggests Factory.
- Code the core flow, then stress it. Write the happy path, then ask: what if two users act at once? What if the input is invalid? What if a step fails halfway?
Habits that earn trust
- Names carry meaning.
ParkingSpot,Ticket,calculateFeebeatManagerandprocess. - Single responsibility. A class that "does everything" is the usual red flag.
- Depend on interfaces at the points that will change (payment method, pricing rule), not everywhere.
- Make illegal states hard to represent. Use enums or state objects instead of loose strings and booleans.
- Say your trade-offs aloud. "I used a simple map here; if we needed millions of spots I would index by level."
A tiny example of the method
Requirement: "a vending machine that sells snacks for coins". Nouns: machine, product, slot, coin. Verbs: select, insert, dispense, refund. Responsibilities:
Inventoryknows what is in each slot;VendingMachinecoordinates the flow; a state (idle, has money, dispensing) decides which actions are allowed. Only the state and the stock rules need real design; the rest is plain code.The following lessons apply this method to well-known problems. Each ends with the extensions an interviewer is likely to ask for.
Real-world reading
Related reading
- Apple Machine Learning BlogApple engineers · AppleBlogs
- AWS Machine Learning BlogAmazon Web Services engineers · Amazon Web ServicesBlogs
- Machine Learning for Indexing Text from Billions of Images at DropboxDropbox engineers · DropboxCase Studies
- Optimizing Payments with Machine Learning at DropboxDropbox engineers · DropboxCase Studies
Show 6 moreShow fewer
- 8 Things You Need to Know Before a System Design InterviewGainlo engineers · GainloBlogs
- CAP Twelve Years Later: How the Rules Have ChangedEric Brewer · InfoQBlogs
- Deep Learning for Frame Detection in Product Images at AllegroAllegro engineers · AllegroCase Studies
- Explaining Low-Level Systems (OS, Network/Protocol, Database, Storage)Wustl engineers · WustlBlogs
- System Design Interview (checkcheckzz)checkcheckzz · GitHubGitHub
- Top 10 System Design Interview QuestionsHackernoon engineers · HackernoonBlogs
Go deeper on this
A path through videos, articles, other case studies and code on the same ideas as Deep Learning for Frame Detection in Product Images at Allegro.
Warm upGet the vocabulary first.
Books · Free from the author
Concurrent and Distributed Systems (Cambridge lecture notes)
Eight lectures on time, broadcast, replication, consensus and transactions, with notes, slides and video. Free from the author under CC BY-SA.
University of CambridgeIntermediate
Books · Free from the author
Computer Networks: A Systems Approach
How networks are built and why: protocols, routing, congestion control and the internet's architecture. The authors publish it free online under CC BY 4.0.
Systems ApproachIntermediate
WatchHow others solve the same problem, on video.
Videos belong to their creators and play from YouTube. More on YouTube (opens in a new tab)
ReadEngineers explain it in their own words.
Blogs
Amazon Science
Technical deep-dives and perspectives from our scientists who are pushing boundaries across multiple scientific disciplines while solving real-world challenges. Explore how our teams combine research excellence, world...
AmazonIntermediate
Papers
Atom Smashing using Machine Learning at CERN
A real-world engineering write-up from CERN on distributed Machine Learning.
CERNIntermediate
See it in another companyThe same ideas, a different system.
Case Studies · Read here
Aroma: Using ML for Code Recommendation at Facebook
Thousands of engineers write the code to create our apps, which serve billions of people worldwide. This is no trivial task—our services have grown so diverse and complex that the codebase contains…
FacebookIntermediate
Case Studies · Read here
Concourse: Generating Personalized Content Notifications in Near-Real-Time at LinkedIn
Social media are computer-mediated platforms that facilitate creation and sharing of information, ideas, career interests, and other forms of expression via virtual communities and networks. In the last few years, not...
LinkedInIntermediate
Read the codeSee how it looks when it is real.
GitHub
Engineering Blogs
A huge directory of company engineering blogs to learn from real production systems.
kilimchoiIntermediate
GitHub
Awesome Scalability
Curated reading list of articles on the architecture of scalable, reliable systems.
binhnguyennusIntermediate
Keep learning
Loading community…