﻿{"id":61,"date":"2025-06-12T10:37:21","date_gmt":"2025-06-12T05:07:21","guid":{"rendered":"https:\/\/blogs.infosys.com\/topaz\/?p=61"},"modified":"2025-06-12T10:37:37","modified_gmt":"2025-06-12T05:07:37","slug":"enhancing-retail-store-analytics-with-video-ai-agent-real-time-video-analytics-part-3-3","status":"publish","type":"post","link":"https:\/\/blogs.infosys.com\/topaz\/nvidia\/enhancing-retail-store-analytics-with-video-ai-agent-real-time-video-analytics-part-3-3.html","title":{"rendered":"Enhancing Retail Store Analytics with Video AI Agent: Real-Time Video Analytics (Part 3\/3)"},"content":{"rendered":"<h2>Inventory Management &amp; Shelf Replenishment<\/h2>\n<p>Smart Inventory Monitoring, which involves detecting empty shelves and low stock conditions, poses unique challenges that need <strong>fine-tuning.<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-75 size-full\" src=\"https:\/\/blogs.infosys.com\/topaz\/wp-content\/uploads\/2025\/06\/collage.png\" alt=\"\" width=\"484\" height=\"488\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>Why Fine-Tuning Was Necessary<\/h3>\n<ul>\n<li><strong>Complex Retail Environments:<\/strong><br \/>\nRetail shelves are inherently dynamic. Variations in product arrangement, lighting, and camera angles can significantly impact detection accuracy.<\/li>\n<li><strong>Subtle Visual Differences:<\/strong><br \/>\nThe pre-trained model struggled to differentiate between intentional display gaps and genuine low-stock scenarios. This required the model to develop a more nuanced sensitivity.<\/li>\n<li><strong>Data Specificity:<\/strong><br \/>\nOur retail data contains specific visual characteristics that weren&#8217;t fully captured in the general pre-training dataset, making domain-specific fine-tuning essential.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<h3>Fine-Tuning Methods for VILA<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-67 size-full\" src=\"https:\/\/blogs.infosys.com\/topaz\/wp-content\/uploads\/2025\/06\/Picture15.png\" alt=\"\" width=\"975\" height=\"481\" \/><\/h3>\n<hr \/>\n<h3>Architecture &amp; Components<\/h3>\n<p>VILA employs an auto-regressive architecture that integrates visual and textual inputs seamlessly. Its design comprises three main components:<\/p>\n<p>\u25cf\u00a0\u00a0<strong>\u00a0\u00a0\u00a0\u00a0 Vision Encoder (ViT):<\/strong> Converts images into feature-rich embeddings.<\/p>\n<p>\u25cf\u00a0\u00a0<strong>\u00a0\u00a0\u00a0\u00a0 Projector:<\/strong> Bridges the visual encoder and the LLM by translating image embeddings into a tokenized format that the LLM can understand.<\/p>\n<p>\u25cf\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <strong>Large Language Model (LLM)<\/strong>: Processes both visual tokens and text, generating coherent, context-aware responses. This setup treats visual inputs like a &#8220;foreign language,&#8221; enabling the model to reason over multiple images and maintain strong text-only capabilities.<\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<h3>Fine-Tuning Methods and Observations<\/h3>\n<p>The table below summarizes the approaches, highlighting \u00a0strengths and weaknesses:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-68 size-full\" src=\"https:\/\/blogs.infosys.com\/topaz\/wp-content\/uploads\/2025\/06\/table-1.png\" alt=\"\" width=\"827\" height=\"501\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-69 size-full\" src=\"https:\/\/blogs.infosys.com\/topaz\/wp-content\/uploads\/2025\/06\/Picture16.png\" alt=\"\" width=\"650\" height=\"196\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>Fine-Tuning Setup Using PEFT (ViT[1]\u00a0[2]\u00a0[3]\u00a0[4]\u00a0: FFT &amp; LLM: LORA)<\/h3>\n<p>To enhance <strong>Smart Inventory Monitoring<\/strong>, we fine-tuned the <strong>VILA<\/strong> model using Parameter-Efficient Fine-Tuning<strong> (PEFT)<\/strong> method and applied full fine-tuning <strong>(FFT)<\/strong> on the vision encoder and LORA for the LLM . The pre-trained model initially misidentified empty spaces and low-stock areas, necessitating domain-specific adaptation.<\/p>\n<h4><strong>Dataset\u00a0<\/strong><\/h4>\n<pre><span style=\"color: #339966\">Videos Collected: 10 (8 for fine-tuning, 2 for testing)<\/span>\r\n\r\n<span style=\"color: #339966\">Camera Setup: Multiple sources focusing on a single shelf<\/span>\r\n\r\n<span style=\"color: #339966\">Preprocessing: ffmpeg re-encoding for compatibility<\/span>\r\n\r\n<span style=\"color: #339966\">Annotation Format: JSON (Segmented by events)<\/span>\r\n\r\n<span style=\"color: #339966\">Resolution: 2560x1440     <\/span>\r\n\r\n<\/pre>\n<h4><strong>Example Annotation:<\/strong><\/h4>\n<pre><span style=\"color: #339966\">{<\/span>\r\n\r\n<span style=\"color: #339966\">\"video_131_1\": {<\/span>\r\n\r\n<span style=\"color: #339966\">\"duration\": 35,<\/span>\r\n\r\n<span style=\"color: #339966\">\"subset\": \"training\",<\/span>\r\n\r\n<span style=\"color: #339966\">\"recipe_type\": \"131\",<\/span>\r\n\r\n<span style=\"color: #339966\">\"annotations\": [<\/span>\r\n\r\n<span style=\"color: #339966\">{<\/span>\r\n\r\n<span style=\"color: #339966\">\"segment\": [0, 5],<\/span>\r\n\r\n<span style=\"color: #339966\">\"id\": \"1\",<\/span>\r\n\r\n<span style=\"color: #339966\">\"sentence\": \"Top rack: 4 Pepsi bottles, 2 orange bottles (low stock), etc.\"<\/span>\r\n\r\n<span style=\"color: #339966\">},<\/span>\r\n\r\n<span style=\"color: #339966\">{<\/span>\r\n\r\n<span style=\"color: #339966\">\"segment\": [5, 8],<\/span>\r\n\r\n<span style=\"color: #339966\">\"id\": \"2\",<\/span>\r\n\r\n<span style=\"color: #339966\">\"sentence\": \"Customer approaches the shelf.\"<\/span>\r\n\r\n<span style=\"color: #339966\">}<\/span>\r\n\r\n<span style=\"color: #339966\">]<\/span>\r\n\r\n<span style=\"color: #339966\">}<\/span>\r\n\r\n<span style=\"color: #339966\">}<\/span><\/pre>\n<h4>Training Setup<\/h4>\n<pre><span style=\"color: #339966\">Model Fine-Tuned: VILA-1.5-34B<\/span>\r\n\r\n<span style=\"color: #339966\">GPUs: 8 x NVIDIA H100 (80GB)<\/span>\r\n\r\n<span style=\"color: #339966\">Batch Size: 8<\/span><\/pre>\n<h4>Fine-Tuning Time<\/h4>\n<pre><span style=\"color: #339966\">Total Training Time: ~2 hr 15mins<\/span>\r\n\r\n<span style=\"color: #339966\">Epochs Completed: 50<\/span><\/pre>\n<h2>Prompt &amp; Chunking Configuration<\/h2>\n<ul>\n<li><strong>VLM Dense Captioning Prompt:<\/strong><\/li>\n<\/ul>\n<p style=\"padding-left: 40px\"><em><span style=\"color: #339966\">Continuously analyze the video to create detailed captions that monitor the inventory levels across 5 racks on a retail shelf over time. For each rack, count the visible products and clearly distinguish between intentional design gaps and actual shortages. If any rack shows 2 or fewer products (ignoring the designated gaps), immediately mark it with a &#8216;Low Stock Alert&#8217;; if a rack has zero visible products, mark it with an &#8216;Empty Rack Alert&#8217; also add a short description of the scene. Alerts generated should contains only brief details about the scene. Ensure that every detection event is accompanied by an accurate timestamp and that the status is updated dynamically as the video plays. Finally, compile these frame-by-frame insights dense caption that provides a comprehensive overview of the shelf&#8217;s status changes over time, highlighting the specific racks and moments when alerts were triggered. Format the final output for storage in a vector database for efficient retrieval and analysis<\/span><\/em><\/p>\n<ul>\n<li><strong>Caption Summarization (LLM) Prompt:<\/strong><\/li>\n<\/ul>\n<p style=\"padding-left: 40px\"><em><span style=\"color: #339966\">Review the dense captions generated for the retail shelf, ensuring each event is tagged with precise timestamps. Extract and condense the key insights by focusing on the number of visible products per rack, the occurrence of &#8216;Low Stock Alert&#8217; or &#8216;Out of Stock Alert&#8217; events, and brief scene descriptions. Generate a succinct summary that highlights the critical inventory status, pinpointing the exact time and rack where stock issues were detected, to inform potential restocking actions efficiently<\/span><\/em><\/p>\n<ul>\n<li><strong>Summary Aggregation (LLM) Prompt:<\/strong><\/li>\n<\/ul>\n<p style=\"padding-left: 40px\"><span style=\"color: #339966\"><em>Combine multiple caption summaries, each with their associated timestamps, into a comprehensive overview that reflects the overall stock status across the retail shelves. Aggregate the individual insights to identify trends, such as recurring low stock or empty shelf events, over time. Provide an aggregated summary that highlights key products at risk, overall inventory health, and includes relevant timestamps for tracking changes and triggering timely interventions. Ensure the summary is actionable and clearly outlines areas requiring immediate attention.<\/em><\/span><\/p>\n<ul>\n<li><strong>Video Chunking Strategy:<\/strong><\/li>\n<\/ul>\n<p style=\"padding-left: 40px\"><em><span style=\"color: #339966\">Chunk Size= 30secs<\/span><\/em><\/p>\n<h2>Results &amp; Observations<\/h2>\n<p>We evaluated our approach on our dataset using two configurations: a <strong>Zero-Shot<\/strong> configuration, where the pre-trained VILA model is used without any fine-tuning, and a <strong>PEFT (ViT: FFT &amp; LLM: LORA)<\/strong> configuration, where full fine-tuning is applied to the vision encoder component and the LLM is fine-tuned using Low-Rank Adaptation (LoRA).<\/p>\n<p>Before fine-tuning, the zero-shot pre-trained VILA model frequently misidentified empty spaces as low-stock areas, \u00a0resulting in inventory monitoring inaccuracies. However, after applying PEFT on VILA,[5]\u00a0 we observed significant improvements in product detection accuracy and \u00a0fewer false alarms.<\/p>\n<h3><strong>Performance Improvement<\/strong><\/h3>\n<h3>Zero-Shot Evaluation<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-70 size-full\" src=\"https:\/\/blogs.infosys.com\/topaz\/wp-content\/uploads\/2025\/06\/table-2.png\" alt=\"\" width=\"551\" height=\"403\" \/><\/p>\n<h3>PEFT (ViT: FFT &amp; LLM: LORA)<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-71 size-full\" src=\"https:\/\/blogs.infosys.com\/topaz\/wp-content\/uploads\/2025\/06\/table-3.png\" alt=\"\" width=\"546\" height=\"404\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>Key Observations<\/h2>\n<ul>\n<li><strong>Performance Boost:<\/strong> Fine-tuning more than doubled BLEU scores and significantly improved CIDEr, METEOR, and ROUGE_L, reflecting a notable enhancement in caption quality and alignment with ground truth.<\/li>\n<li><strong>Efficiency with Limited Data:<\/strong> These improvements were achieved using a relatively small dataset and without full-scale fine-tuning, showcasing the effectiveness of our PEFT approach.<\/li>\n<li><strong>Overall Impact:<\/strong> Our streamlined fine-tuning process significantly enhanced model accuracy and reliability in detecting low-stock conditions on retail shelves.<\/li>\n<\/ul>\n<p><strong>Sample Alert Triggered<\/strong><br \/>\nBelow is an alert generated when low stock or an empty shelf is detected:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-72 aligncenter\" src=\"https:\/\/blogs.infosys.com\/topaz\/wp-content\/uploads\/2025\/06\/Picture17.png\" alt=\"\" width=\"624\" height=\"631\" \/><\/p>\n<h2>Future Possibilities with Infosys Video AI Agent<\/h2>\n<h3>Advanced Inventory Management<\/h3>\n<ul>\n<li><strong>Smart Reordering:<\/strong> Integrate with inventory systems to trigger automatic product reordering.<\/li>\n<li><strong>Dynamic Shelf Management:<\/strong> Use real-time data to adjust shelf layouts dynamically.<\/li>\n<\/ul>\n<h3>Enhanced Customer Engagement<\/h3>\n<ul>\n<li><strong>Personalized Marketing:<\/strong> Leverage customer behavior analytics to deliver targeted offers.<\/li>\n<li><strong>Augmented Reality (AR):<\/strong> Deploy AR interfaces for in-store staff, overlaying real-time VSS insights onto live feeds.<\/li>\n<\/ul>\n<h3>Continuous Learning &amp; Adaptability<\/h3>\n<ul>\n<li><strong>Real-Time Fine-Tuning:<\/strong> Implement continuous fine-tuning to adapt to evolving retail scenarios.<\/li>\n<li><strong>Customization:<\/strong> Tailor VSS for diverse retail settings, from small shops to large hypermarkets.<\/li>\n<\/ul>\n<hr \/>\n<h2>Conclusion<\/h2>\n<p>By combining advanced video analysis with intelligent summarization and real-time alerting, Infosys Video AI Agent redefines retail store monitoring. The integration of a Video AI Agent with fine-tuning techniques (like LoRA) has resulted in a system that not only improves security and safety but also optimizes inventory management and enhances customer satisfaction. As we continue refining our models and exploring new integrations, Infosys Video AI Agent is poised to set a new standard in AI-driven retail solutions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Inventory Management &amp; Shelf Replenishment Smart Inventory Monitoring, which involves detecting empty shelves and [&hellip;]<\/p>\n","protected":false},"author":865,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[12],"tags":[],"coauthors":[14],"class_list":["post-61","post","type-post","status-publish","format-standard","hentry","category-nvidia"],"acf":[],"_links":{"self":[{"href":"https:\/\/blogs.infosys.com\/topaz\/wp-json\/wp\/v2\/posts\/61","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.infosys.com\/topaz\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.infosys.com\/topaz\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.infosys.com\/topaz\/wp-json\/wp\/v2\/users\/865"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.infosys.com\/topaz\/wp-json\/wp\/v2\/comments?post=61"}],"version-history":[{"count":3,"href":"https:\/\/blogs.infosys.com\/topaz\/wp-json\/wp\/v2\/posts\/61\/revisions"}],"predecessor-version":[{"id":76,"href":"https:\/\/blogs.infosys.com\/topaz\/wp-json\/wp\/v2\/posts\/61\/revisions\/76"}],"wp:attachment":[{"href":"https:\/\/blogs.infosys.com\/topaz\/wp-json\/wp\/v2\/media?parent=61"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.infosys.com\/topaz\/wp-json\/wp\/v2\/categories?post=61"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.infosys.com\/topaz\/wp-json\/wp\/v2\/tags?post=61"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blogs.infosys.com\/topaz\/wp-json\/wp\/v2\/coauthors?post=61"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}