How We Built an AI-Powered Accept/Reject System for Reverse Vending Machines
Introduction
Reverse Vending Machines are the frontline of modern recycling schemes — but behind the slot where a customer drops off a bottle, there’s a critical decision to make: does this item meet the scheme’s rules? For a client in the recycling technology industry, we built an AI-powered vision system that makes that call automatically, identifying, classifying, and measuring every container as it passes through the machine, and deciding in real time whether to accept or reject it.
This is the story of what we delivered, why it matters, and what it means for businesses looking to bring intelligent automation into physical-world operations.
The Business Challenge
Recycling schemes operate under strict rules. A Reverse Vending Machine needs to look at each item — plastic bottles, aluminium cans, glass containers — and instantly answer three questions:
- What material is it? (plastic, metal, glass)
- What condition is it in? (crushed or intact)
- How big is it? (measured in real-world millimetres)
Get the classification wrong and you either accept items that don’t qualify — costing the scheme money — or reject valid items, frustrating customers. It’s a high-stakes, high-volume decision that needs to be right every time. That’s a textbook case for computer vision automation.
What We Built
We delivered a complete, two-phase AI pipeline — an AWS-hosted training system that produces production-ready models, and a lightweight runtime that runs entirely on the RVM’s onboard CPU.
Phase 1: Training Pipeline (AWS)
The training pipeline lives in the cloud and is designed to be repeatable. When new container types need to be added or scheme rules change, we re-run the pipeline and deploy an updated model.
Training Data in S3 — Roughly 900 labelled training videos are stored in an S3 bucket, each tagged with metadata (container type, material, crushed status).
Camera Calibration — We correct wide-angle lens distortion and perspective skew so that measurements are accurate everywhere in the frame, not just the centre. This calibration is baked into the model pipeline.
Auto Mask Generation with SAM 3 — Still on the same EC2 GPU instance, Meta’s SAM 3 (Segment Anything Model) uses text prompts like “plastic bottle” or “aluminium can” to automatically outline every container across every training frame. No manual labelling required — the AI bootstraps its own training data.
Model Training — With masks in hand, two models are trained on the same GPU: a fast YOLO26-seg segmentation model for real-time object detection, and a custom ResNet18-based classifier that identifies material type, condition, and dimensions using the segmentation masks plus geometric shape features.
Evaluation Gate — Before a model is approved, it’s tested against a held-out validation set it has never seen. We measure classification accuracy (material, condition) and measurement error (millimetre precision). Only models that pass predefined acceptance criteria proceed.
Versioned Release via S3 — Approved models are versioned, packaged, and uploaded back to S3, ready for deployment to the fleet of Reverse Vending Machines.
Phase 2: On-Device Runtime (CPU)
This is where the cost savings come in. The trained models run entirely on the RVM’s low-power onboard CPU — no GPU hardware required in each unit. The full inference pipeline executes per item:
- Calibrate — Undistort the lens, rectify to a top-down view with a known millimetres-per-pixel scale.
- Segment — The YOLO model finds and outlines the object in the frame.
- Classify — The ResNet18 classifier labels the item by material, condition, and size.
- Measure — Convert pixel dimensions to real-world millimetres. Intact items get length and width; crushed items get fitted-ellipse axes and area.
- Decide — The classification and measurements are evaluated against the recycling scheme’s acceptance rules, and an accept or reject signal is sent.
Because the heavy lifting happens in the cloud during training, each RVM in the field can be a lower-spec, lower-cost device — making large-scale deployment economically viable.
Why It Matters for Business
The impact goes beyond clever engineering. Here’s what this means for a recycling operation:
- Lower Per-Unit Hardware Costs — Training runs on powerful AWS GPU instances, but each RVM runs the trained model on a low-cost CPU. No GPU in every machine means significantly lower hardware costs at scale.
- Scheme Compliance — The system enforces acceptance rules consistently, every time. No guesswork, no exceptions, no costly misclassification.
- Accuracy — Camera calibration ensures millimetre-precise measurements, eliminating the inconsistencies that lead to false accepts or rejects.
- Speed — The full pipeline — segment, classify, measure, decide — runs in real time on-device, keeping pace with customer throughput expectations.
- Scalable Training — Because the training data is generated automatically (no human labelling) and runs on AWS, the system can be retrained or extended to new container types and scheme rules quickly and cost-effectively.
- Automated Quality Gates — Every model must pass classification accuracy and measurement accuracy thresholds before it’s released. Only approved, versioned models are deployed to machines.
- Reduced Operational Overhead — What once required manual oversight or complex heuristic rules now runs autonomously, reducing the maintenance burden on ops teams.
- Structured Output — Every item produces clean, machine-readable data, making it straightforward to log decisions for audit, report to scheme operators, or integrate with back-end systems.
The Technical Edge
A few deliberate design choices set this system apart:
- GPU training, CPU inference — Heavy model training runs on AWS EC2 GPU instances, while the trained models run on low-power CPUs inside each RVM. This keeps per-unit hardware costs down without sacrificing model quality.
- Separate segmentation and classification models — Rather than bolting everything into one network, we keep them separate. The segmenter converges faster as a single-class model, and the classifier can leverage geometric features like solidity and circularity that a detection-only network simply can’t learn.
- Automatic training data via SAM 3 — This is a game-changer for projects where manual annotation would be prohibitively expensive or slow. The AI generates its own labelled dataset, making the pipeline genuinely scalable.
- Millimetre-accurate calibration — Lens distortion and perspective skew are corrected once, giving reliable real-world measurements across the entire frame. This isn’t a rough estimate — it’s calibrated precision.
- Automated model lifecycle — Training, evaluation, versioning, and release are all handled through the AWS pipeline. Models that don’t meet acceptance criteria are rejected automatically; approved models are versioned and staged for deployment via S3.
Conclusion
This Computer Vision system is a strong example of what happens when modern AI models are combined with careful engineering and a clear business objective. It takes a decision that needs to be right — accept or reject, every time, against strict scheme rules — and automates it with a system that’s fast, accurate, and scalable, without requiring a team of annotators to get it off the ground.
If you’re looking to bring computer vision or AI automation into your products — whether it’s real-time classification, accept/reject decisions, quality control, or inspection — we’d love to talk about how we can help.
Ready to explore what AI can do for your business? Get in touch for a free consultation.
Want to learn more about our approach to AI and automation? Check out our Services page or read about us on the About page.