Maasloop

Building a Real-Time Packaging Recognition System Designed for Edge

Computer Vision Data Engineering Edge AI

A fraud-resistant recognition system built for Maasloop's deposit return machines, from dataset to deployment Challenge Accepted!

Building a Real-Time Packaging Recognition System Designed for Edge

Process & Story

Our client, Maasloop, builds intelligent machines that automate the collection of recyclable bottles and cans, known as Reverse Vending Machines. To ensure the accuracy of returns and prevent fraud, they needed a solution that could verify an object’s shape, material, including distinguishing eligible packages from lookalikes and damaged containers.

We designed a lightweight machine learning system tailored to their hardware and performance constraints. The result? A fast and fraud-resistant packaging recognition system ready for nationwide deployment.

Problem

Maasloops’s machines operate in the context of a deposit return scheme. That means they don’t just need to accept recyclables — they must:

The system operates in a controlled, isolated environment: each machine accepts one object at a time inside an isolated chamber. Two images are captured per session — one of the empty chamber and one with the object inside — under identical, standardized conditions across all machines.

All of this runs in real time on a compact Raspberry Pi 5, within a strict 600ms total budget for all modules combined.

Solution

We designed and delivered a multi-module real-time recognition system to help our client verify recyclables and prevent fraud in deposit return machines. The solution was built in close collaboration with the client across five milestones, combining custom dataset development, lightweight model training, and edge deployment — all optimized to run on Raspberry Pi 5.

Module 1 — Segmentation & Dimension Estimation

We improved the previously delivered segmentation model for detecting masks of bottles and cans, with particular focus on difficult packaging types: black bottles and transparent containers. The primary goal of this module is to estimate object dimensions using the detected mask. Over the course of the project, the module received two updates, each delivering statistically significant improvements in IoU and MAPE-based evaluation metrics for estimated dimensions.

Module 2 — Color Distribution Analysis

We built a module to analyze the color distribution of each scanned object. For each EAN code, the historical database contains images with a known statistical color profile. This module checks whether the color distribution in a given scan falls within the historically observed spectrum for that EAN — flagging outliers that may indicate a mismatch or fraud attempt.

Module 3 — Logo & Visual Feature Detection

We developed a module to detect logos and other characteristic visual features that distinguish one product from another. It works similarly to the color distribution module but operates on the full feature representation of the image rather than color statistics alone, enabling finer-grained visual verification.

Module 4 — Scoring Function

We built a composite scoring function that aggregates data collected by the client’s systems for a given image — alongside the outputs of all the above modules — to predict whether the scanned object matches the EAN code presented at the machine. The model also returns a confidence estimate alongside its prediction, enabling downstream decision-making based on certainty thresholds.

Module 5 — Fraud Detection

We conducted a thorough statistical analysis of historical data to identify anomaly patterns associated with fraudulent returns — specifically cases where the scanned EAN code did not match the object’s visual characteristics. The findings were integrated into refinements of the scoring function, strengthening the system’s ability to flag and block fraudulent submissions.

Outcomes

Custom dataset and labeling pipeline

To build models capable of verifying both object type and physical condition, we developed a tailored dataset from high-resolution images captured directly by the client’s machines. Since existing public datasets lacked the precision, coverage, or licensing required, we established a custom ingestion pipeline to organize raw image archives, eliminate duplicates, and preserve metadata such as object dimensions and material.

We deployed a self-hosted instance of Label Studio and onboarded a dedicated labeling team to efficiently annotate thousands of samples. Clear labeling guidelines and active feedback loops ensured accurate segmentation, including in edge cases such as open bottle caps, pull-tabs, black containers, and transparent packaging. This labeling infrastructure was designed for reusability — allowing the client to continuously expand the dataset and improve accuracy over time.

Iterative model development for segmentation and verification

We evaluated existing image segmentation models but found them too large or slow for on-device execution. Rather than using an off-the-shelf segmentation architecture, our team built on MobileNet — a model commonly used on edge devices, typically for classification — adding custom layers on top so it could function as a segmentation model. A data scientist built the initial version optimized for quality, which was then fine-tuned, ported, and benchmarked by an ML engineer for performance on the target hardware.

Each iteration was tracked with benchmark metrics, including per-image inference time and hardware compatibility validated via OpenVINO. The segmentation module received two major updates over the course of the engagement, each achieving statistically significant improvements in IoU and MAPE evaluation metrics for object dimension estimation. This iterative approach allowed us to gradually reduce model complexity while preserving accuracy, ultimately delivering a version that met both speed and reliability thresholds.

Lightweight, deployable architecture

To simplify installation and updates, we shipped the entire solution as a versioned Python package, including:

This modular packaging strategy reduced update sizes and made it easy for the client to deploy the solution at scale across multiple machines, even in bandwidth-limited environments.

Ready for future expansion

The system architecture supports future needs such as:

The final solution delivers accurate, real-time image analysis at the edge, enabling secure, fraud-resistant recycling flows. All recognition runs locally on-device, with internet connectivity used only for sending captured images for analysis and receiving model updates.

Case Study Schema Building a Real-Time Packaging Recognition System Designed for Edge

Tools

Python

Python

Have a similar project in mind?

LET'S TALK!

Challenges

Fragmented and Low-Quality Image Data
The first batches of imagery provided by the client were heavily downsampled, making it impossible to train a reliable model for shape or material detection. We worked with the client to re-establish a data acquisition process that consistently delivered high-resolution images with proper metadata.

Lack of Suitable Public Datasets
Off-the-shelf datasets fell short — not just in class coverage or volume, but in the specific object positioning and framing required. Since the system must verify object dimensions in addition to type, precision was critical. Public datasets like TACO or the Bottles Dataset lacked consistently positioned, high-resolution images necessary for reliable size estimation and edge-case detection. We designed and built a custom dataset pipeline from scratch to meet these requirements.

Underrepresented and Visually Challenging Packaging Types
Black bottles and transparent containers presented specific difficulties. Black surfaces absorb light and yield poor segmentation masks; transparent containers confuse models that rely on surface texture or opacity. Addressing these required targeted data collection, dedicated labeling, and multiple model iterations before reaching acceptable accuracy.

Edge Deployment Under Strict Latency Constraints
Running multiple deep learning modules on a Raspberry Pi 5 — within a 600ms total budget — required precise engineering. No individual module could afford to be bloated. We iterated between quality tuning and OpenVINO-based optimization to reach the performance envelope, making careful trade-offs between speed and accuracy across the full pipeline.

Ambiguity in Packaging Edge Cases
Real-world recyclables aren't always perfect. Items arrived with unscrewed bottle caps, crushed necks, or partially torn labels, leading to labeling inconsistencies. Rather than over-engineering logic for every corner case, we created clear annotation standards and maintained a feedback loop with the labeling team to enforce consistency and reduce noise during training.

Scalability and Updatability Across Devices
With hundreds — and eventually thousands — of machines expected to run the models, maintenance needed to be lightweight. We kept the trained model files separate from the inference code and dependencies, so the client can push a small model update without re-shipping the entire versioned package each time.

Our other projects:

Recordya, Knowledge management

Building an Agentic AI Search Platform for Enterprise Knowledge Work

From a search box to a reasoning engine — how nexocode designed and built Recordya, an enterprise agentic AI search platform that goes beyond retrieval to deliver answers.

Generative AI Agentic AI Data Engineering

Time4Travel

AI-Powered CRM for Group Travel Reservations

Transforming group travel management with AI and intuitive design

AI Data Engineering LLMs Generative AI

Katana Studios

Powering Real-Time 3D Automotive Configurator with Multi-Cloud GPU Rendering at Scale

Empowering real-time product visualization in automotive marketing with a resilient, cloud-native rendering platform and elastic UI Challenge Accepted!

Computer Vision Data Engineering

See more projects

This site uses cookies for analytical purposes.

Accept Privacy Policy

In the interests of your safety and to implement the principle of lawful, reliable and transparent processing of your personal data when using our services, we developed this document called the Privacy Policy. This document regulates the processing and protection of Users’ personal data in connection with their use of the Website and has been prepared by Nexocode.

To ensure the protection of Users' personal data, Nexocode applies appropriate organizational and technical solutions to prevent privacy breaches. Nexocode implements measures to ensure security at the level which ensures compliance with applicable Polish and European laws such as:

  1. Regulation (EU) 2016/679 of the European Parliament and of the Council of 27 April 2016 on the protection of natural persons with regard to the processing of personal data and on the free movement of such data, and repealing Directive 95/46/EC (General Data Protection Regulation) (published in the Official Journal of the European Union L 119, p 1); Act of 10 May 2018 on personal data protection (published in the Journal of Laws of 2018, item 1000);
  2. Act of 18 July 2002 on providing services by electronic means;
  3. Telecommunications Law of 16 July 2004.

The Website is secured by the SSL protocol, which provides secure data transmission on the Internet.

1. Definitions

  1. User – a person that uses the Website, i.e. a natural person with full legal capacity, a legal person, or an organizational unit which is not a legal person to which specific provisions grant legal capacity.
  2. Nexocode – NEXOCODE sp. z o.o. with its registered office in Kraków, ul. Wadowicka 7, 30-347 Kraków, entered into the Register of Entrepreneurs of the National Court Register kept by the District Court for Kraków-Śródmieście in Kraków, 11th Commercial Department of the National Court Register, under the KRS number: 0000686992, NIP: 6762533324.
  3. Website – website run by Nexocode, at the URL: nexocode.com whose content is available to authorized persons.
  4. Cookies – small files saved by the server on the User's computer, which the server can read when when the website is accessed from the computer.
  5. SSL protocol – a special standard for transmitting data on the Internet which unlike ordinary methods of data transmission encrypts data transmission.
  6. System log – the information that the User's computer transmits to the server which may contain various data (e.g. the user’s IP number), allowing to determine the approximate location where the connection came from.
  7. IP address – individual number which is usually assigned to every computer connected to the Internet. The IP number can be permanently associated with the computer (static) or assigned to a given connection (dynamic).
  8. GDPR – Regulation 2016/679 of the European Parliament and of the Council of 27 April 2016 on the protection of individuals regarding the processing of personal data and onthe free transmission of such data, repealing Directive 95/46 / EC (General Data Protection Regulation).
  9. Personal data – information about an identified or identifiable natural person ("data subject"). An identifiable natural person is a person who can be directly or indirectly identified, in particular on the basis of identifiers such as name, identification number, location data, online identifiers or one or more specific factors determining the physical, physiological, genetic, mental, economic, cultural or social identity of a natural person.
  10. Processing – any operations performed on personal data, such as collecting, recording, storing, developing, modifying, sharing, and deleting, especially when performed in IT systems.

2. Cookies

The Website is secured by the SSL protocol, which provides secure data transmission on the Internet. The Website, in accordance with art. 173 of the Telecommunications Act of 16 July 2004 of the Republic of Poland, uses Cookies, i.e. data, in particular text files, stored on the User's end device.
Cookies are used to:

  1. improve user experience and facilitate navigation on the site;
  2. help to identify returning Users who access the website using the device on which Cookies were saved;
  3. creating statistics which help to understand how the Users use websites, which allows to improve their structure and content;
  4. adjusting the content of the Website pages to specific User’s preferences and optimizing the websites website experience to the each User's individual needs.

Cookies usually contain the name of the website from which they originate, their storage time on the end device and a unique number. On our Website, we use the following types of Cookies:

  • "Session" – cookie files stored on the User's end device until the Uses logs out, leaves the website or turns off the web browser;
  • "Persistent" – cookie files stored on the User's end device for the time specified in the Cookie file parameters or until they are deleted by the User;
  • "Performance" – cookies used specifically for gathering data on how visitors use a website to measure the performance of a website;
  • "Strictly necessary" – essential for browsing the website and using its features, such as accessing secure areas of the site;
  • "Functional" – cookies enabling remembering the settings selected by the User and personalizing the User interface;
  • "First-party" – cookies stored by the Website;
  • "Third-party" – cookies derived from a website other than the Website;
  • "Facebook cookies" – You should read Facebook cookies policy: www.facebook.com
  • "Other Google cookies" – Refer to Google cookie policy: google.com

3. How System Logs work on the Website

User's activity on the Website, including the User’s Personal Data, is recorded in System Logs. The information collected in the Logs is processed primarily for purposes related to the provision of services, i.e. for the purposes of:

  • analytics – to improve the quality of services provided by us as part of the Website and adapt its functionalities to the needs of the Users. The legal basis for processing in this case is the legitimate interest of Nexocode consisting in analyzing Users' activities and their preferences;
  • fraud detection, identification and countering threats to stability and correct operation of the Website.

4. Cookie mechanism on the Website

Our site uses basic cookies that facilitate the use of its resources. Cookies contain useful information and are stored on the User's computer – our server can read them when connecting to this computer again. Most web browsers allow cookies to be stored on the User's end device by default. Each User can change their Cookie settings in the web browser settings menu: Google ChromeOpen the menu (click the three-dot icon in the upper right corner), Settings > Advanced. In the "Privacy and security" section, click the Content Settings button. In the "Cookies and site date" section you can change the following Cookie settings:

  • Deleting cookies,
  • Blocking cookies by default,
  • Default permission for cookies,
  • Saving Cookies and website data by default and clearing them when the browser is closed,
  • Specifying exceptions for Cookies for specific websites or domains

Internet Explorer 6.0 and 7.0
From the browser menu (upper right corner): Tools > Internet Options > Privacy, click the Sites button. Use the slider to set the desired level, confirm the change with the OK button.

Mozilla Firefox
browser menu: Tools > Options > Privacy and security. Activate the “Custom” field. From there, you can check a relevant field to decide whether or not to accept cookies.

Opera
Open the browser’s settings menu: Go to the Advanced section > Site Settings > Cookies and site data. From there, adjust the setting: Allow sites to save and read cookie data

Safari
In the Safari drop-down menu, select Preferences and click the Security icon.From there, select the desired security level in the "Accept cookies" area.

Disabling Cookies in your browser does not deprive you of access to the resources of the Website. Web browsers, by default, allow storing Cookies on the User's end device. Website Users can freely adjust cookie settings. The web browser allows you to delete cookies. It is also possible to automatically block cookies. Detailed information on this subject is provided in the help or documentation of the specific web browser used by the User. The User can decide not to receive Cookies by changing browser settings. However, disabling Cookies necessary for authentication, security or remembering User preferences may impact user experience, or even make the Website unusable.

5. Additional information

External links may be placed on the Website enabling Users to directly reach other website. Also, while using the Website, cookies may also be placed on the User’s device from other entities, in particular from third parties such as Google, in order to enable the use the functionalities of the Website integrated with these third parties. Each of such providers sets out the rules for the use of cookies in their privacy policy, so for security reasons we recommend that you read the privacy policy document before using these pages. We reserve the right to change this privacy policy at any time by publishing an updated version on our Website. After making the change, the privacy policy will be published on the page with a new date. For more information on the conditions of providing services, in particular the rules of using the Website, contracting, as well as the conditions of accessing content and using the Website, please refer to the the Website’s Terms and Conditions.

Nexocode Team