AI Planogram Compliance Checker with Python and OpenAI

Walk down any supermarket aisle and you will find the same quiet problem. A bestseller sits on the wrong shelf. A promotional item that was supposed to be at eye level is nowhere to be seen. An empty gap sits where a product should be. Nobody planned it that way, but that is what happens once real customers, real staff, and real deliveries get involved.
Retailers fight this with a planogram, a plan that says exactly which product belongs in which position on which shelf. The plan is only useful if the shelf actually matches it, and today, checking that means a person walking the aisle with a clipboard, comparing each shelf by eye.
What if a single photo of the shelf could do that check for you?
That is exactly what the AI Planogram Compliance Checker does. In this post, we walk through what it is, how it works, and what each step of the process looks like.
The Requirement
Imagine a retail client reaches out with a very specific need:
"We have a planogram for every shelf in our stores. We want to automate checking whether the products are on the right shelf, in the right place. Store staff should be able to upload a photo and immediately see what is wrong."
Breaking that down the way we would in a client meeting, the application needs to:
Accept the planogram in a simple, familiar format, so the store team does not need special tools. A CSV file works well.
Show the plan clearly, both as a table with exact row and column coordinates and as a visual shelf layout.
Know the products. Every item on the shelf needs a name, an identifier such as an ISBN, whether it is veg or non-veg, an expiry detail, and an image. This information should live in one central product listing rather than being repeated in every planogram file.
Accept a shelf photo showing what the shelf really looks like right now.
Detect the products in that photo and compare them, slot by slot, against the plan.
Report exactly what is wrong. Not a vague score, but a specific list of what is misplaced, what is missing, and what is out of stock, with the row and column for each issue.
Tell staff what to do about it, for example which product to place at which row and column.
If you have a list of products and you want to automate checking whether each one is on the right shelf in the right place, this is for you.
Tech Stack
The application runs on three things:
Python for the backend logic, the product matching, and the comparison rules.
OpenAI Vision to detect every product in the shelf photo, slot by slot.
HTML, CSS, and JavaScript for the interface, the tabs, the tables, and the shelf views.
POC Overview
The AI Planogram Compliance Checker takes two inputs: the shelf plan, and a photo of the shelf as it actually looks.
It reads the plan from a simple CSV file, detects every product in the photo using computer vision, and compares the two automatically. The output is one clear result: a list of exactly what needs fixing and where.
In simple words, a shelf photo goes in, and a clear, actionable list of what is misplaced, missing, and out of stock comes out.
Features
The whole process takes only a few steps.
Step 1: Open the App and Upload the Planogram
Open the application and go to the Planogram tab. Upload the planogram CSV for the shelf you want to check.
The Planogram tab with the CSV upload control

A CSV file selected and ready to upload

Step 2: Review the Plan as a Table and as a Shelf Layout
Once the CSV is loaded, the plan appears in two forms:
A table listing each product with its exact row and column coordinates.
A visual shelf layout showing every product in its planned position, with its image.
This makes it easy to confirm the plan was read correctly before running any check.
The table view with row and column coordinates

The visual shelf layout with product images

Step 3: The Product Listing
Every product image and detail on the shelf comes from one central Product listing: name, ISBN, veg or non-veg, expiry, and image. The planogram only needs to reference the product, and the listing supplies the rest.
If a product has no image on file, the application shows a clear placeholder instead of guessing.
The Product listing tab showing product details and images

Step 4: Upload the Shelf Photo and Run the Comparison
Now upload a photo of the shelf as it looks in the store, then run the comparison. The vision model detects every product in the photo, and the Python backend compares that, cell by cell, against the plan.
The shelf photo empty

The shelf photo uploaded and ready to compare

Step 5: Read the Audit Result
The result marks every problem directly on the shelf photo, each in its own color:
Misplaced: a product is on the shelf, but not where the plan says it should be.
Missing: a planned product is not on the shelf at all.
Out of stock: the position exists, but the product has run out.
Every issue comes with the exact action to take, down to the row and the column, for example placing a specific product at a specific row and column. The results are also kept per shelf, so you can move between shelves without losing any of them.
Audit result with misplaced, missing, and out-of-stock counts and markers on the shelf and the list of issues with the row and column action for each


Upload the oral care plan and switch the shelf to breakfast.

Audit result of oral care

Switch the shelf to breakfast using the dropdown at the top right.

Advantages
Faster audits. A photo replaces a walk down the aisle with a clipboard.
Consistent results. The same rules are applied to every shelf, every time, instead of depending on who is checking.
Actionable output. Staff get a prioritized list of exactly what to fix and where, not a general impression.
Simple inputs. The plan is a CSV and the check is a photo, so there is no special hardware to set up.
One source of product truth. Product details live in a single listing, so they stay consistent across every planogram.
Limitations
This is a proof of concept, and it is important to be clear about its current scope:
One shelf photo is compared against one plan at a time, rather than a continuous camera feed.
This is not a permanent limit, and it can be addressed in a custom build.
Future Scope of Improvements
The current version is a foundation. Natural next steps include:
Continuous monitoring from store cameras, CCTV, or drone footage, feeding the same detection pipeline.
Alerts and task assignment, so a detected issue goes straight to the right person to fix.
Automatic restocking triggers. When a product is detected as out of stock, a replenishment request can be raised without anyone having to notice it first.
Batch and multi-shelf uploads. Upload photos for a whole aisle or store at once, instead of one shelf at a time.
Compliance history and trends. Track how compliance changes over days and weeks, and find the shelves, products, or times of day where drift happens most often.
Expiry and freshness checks, using the expiry details already stored per product to flag items that are close to their date or already past it.
Planogram creation and editing inside the app, so a plan can be built or adjusted visually without preparing a CSV by hand.
Reports and exports, such as a PDF or spreadsheet audit report per shelf, per store, or per visit, for head office and franchise reviews.
Use Cases: Where This Finds Use
Retail chains can catch shelf drift across many stores, without sending a person down every aisle.
Category teams can check whether a new planogram was actually implemented the way it was designed.
Store operations teams get a clear, prioritized list of what to fix, instead of a walk-through and a clipboard.
Retailers already running CCTV or drone footage can feed that footage into the same detection pipeline.
Merchandising teams can verify that new product launches and promotional displays are set up exactly as planned.
Franchise operations can check that every location follows the same approved planogram.
Warehouses and supermarkets can use the same idea anywhere products must sit in defined positions.
Who This Is For
Retail and supermarket operators who manage many shelves across many stores
Category, merchandising, and store operations teams responsible for planogram execution
Franchise businesses that need every location to look the same
Warehouse and inventory teams that need products in defined positions
Any business with a plan for where things go and a need to check that reality matches it
Frequently Asked Questions
What is planogram compliance?
Planogram compliance measures how closely the real shelf matches the planogram. A compliant shelf has every product in its planned position and nothing missing.
What do I need to use the AI Planogram Compliance Checker?
Two things: the planogram as a CSV file, and a photo of the shelf. The products should be present in the product listing so their details and images can be shown.
What kinds of problems does it find?
It finds products that are misplaced, products that are missing, and products that are out of stock, each marked in its own color on the shelf photo, with the row and column of each issue.
Does it tell me how to fix the problems?
Yes. Every issue comes with the exact action to take, down to the row and the column.
Can it work with live camera feeds?
The current version compares one photo to one plan at a time. Continuous camera, CCTV, and drone feeds can be addressed in a custom build.
Who builds this, and how do I get in touch?
This application is built by Codersarts, which delivers custom compliance and computer vision applications for businesses. Reach out at contact@codersarts.com or visit www.codersarts.com.
Build a Custom Shelf Monitoring Solution for Your Business
If you want this built for your business, Codersarts builds and delivers this application for enterprises, including:
End-to-end development, the vision pipeline, the comparison rules, and the product database, all built for your stores
Architecture consulting for scale, supporting many stores and many shelves at once
Integration with your existing product data
It is simple to start. No long onboarding, just a discovery call to talk through your stores and your shelves.
Book a discovery call to get started.Reach out at contact@codersarts.com or visit www.codersarts.com.
Exploring AI Resources
If you found this blog helpful, explore AI resources from CodersArts AI to see how organizations are applying these systems to real world applications.
OpenAI for Agentic AI: What You Need to Know Before Building AI Agents https://www.ai.codersarts.com/post/openai-for-agentic-ai-the-essential-guide
Build a Multi-Agent AI Banking Document Processing Platform with n8n https://www.ai.codersarts.com/post/build-a-multi-agent-ai-banking-document-processing-platform-with-n8n
Production Observability for AI Agents on AWS: Traces, Latency, Tokens, and Failures https://www.ai.codersarts.com/post/production-observability-for-ai-agents-on-aws-traces-latency-tokens-and-failures
Microsoft Agent Framework for Agentic AI: Everything You Need to Know https://www.ai.codersarts.com/post/microsoft-agent-framework-for-agentic-ai-everything-you-need-to-know




Comments