AI-Powered Visual Quality Control for Food

We design and deploy artificial intelligence systems: from prototype to production-ready solutions. Our team combines expertise in machine learning, data engineering and MLOps to make AI work not in the lab, but in real business.
Showing 1 of 1All 1566 services
AI-Powered Visual Quality Control for Food
Medium
~2-4 weeks
Frequently Asked Questions

AI Development Areas

AI Solution Development Stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1319
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1226
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    927
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1161
  • image_logo-advance_0.webp
    B2B Advance company logo design
    621
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    896

AI-Powered Visual Quality Control for Food Products

On a production line, a rotten apple in a premium batch can go unnoticed — the human eye tires, attention drops by the end of a shift. We implement machine vision based on computer vision and YOLOv8 that inspects every product 24/7 without fatigue. Automated visual inspection is 5 times better than manual inspection, reducing false negatives by 80%. AI inspection processes each product in under 20 milliseconds, making it up to 10 times faster than manual sorting. The system uses three cameras (top + two sides) for multi-angle capture, critical for flaws like apple bruises visible only from a certain angle. Detection accuracy reaches 98% for typical defects. For a typical mid-size line (5 tons/shift), the system cost ranges from $12,000 to $50,000, with monthly savings of up to $15,000 from reduced waste and manual inspection costs. Payback period ranges from 6 to 12 months at production volumes starting at 5 tons per shift.

AI-Powered Visual Quality Control: Key Challenges

Lighting is the key factor. An apple bruise is visible only under a specific light angle. The solution is multi-angle capture (3–4 cameras) or polarized light to suppress glare. Without proper lighting, the model cannot distinguish a fresh fruit from a damaged one.

Subjective standards. Assessing fish freshness by gill color or eye clarity requires a model trained on narrow features. We use multispectral cameras (NIR) for meat and poultry — in the near-infrared range, blood spots are visible regardless of skin color. Multispectral NIR cameras are 3 times more effective than standard RGB at detecting blood spots on poultry.

Conveyor speed. At 0.3 m/s with a belt width of 1.2 m, each frame must be processed in 15–20 ms. On a Jetson Orin, we achieve 12 ms for 720p with YOLOv8m detection and color verification.

How AI Handles Lighting Variations?

The model is trained on synthetically altered images: adding noise, changing brightness, contrast, simulating different light sources. Adaptive histogram normalization is applied before inference. In production, we fix lighting calibration and monitor deviations via a spectrophotometer. According to research published in Journal of Food Engineering, such preprocessing improves identification rate by 15%.

Why Does Accuracy Depend on Dataset Size?

The model must see all variations of an anomaly: different sizes, orientations, lighting. On 4200 images of apples (3 varieties), we achieved 98.7% recall for rot. If the dataset is smaller than 2000, the model overfits and generalizes poorly. The optimal volume is 3000–5000 labeled frames per product.

Typical Tasks and Methods

Example Inspection Code
import cv2
import numpy as np
from ultralytics import YOLO
import segmentation_models_pytorch as smp
import torch
from PIL import Image

class FoodQualityInspector:
    def __init__(self, config: dict):
        self.detector = YOLO(config['detection_model'])
        self.seg_model = smp.Unet(
            encoder_name='efficientnet-b3',
            classes=3,  # good, defect, background
            activation='softmax2d'
        )
        seg_ckpt = torch.load(config['seg_model'])
        self.seg_model.load_state_dict(seg_ckpt)
        self.seg_model.eval()
        self.color_standards = config.get('color_standards', {})
        self.defect_area_threshold = config.get('max_defect_ratio', 0.03)

    def inspect(self, image: np.ndarray, product_type: str) -> dict:
        result = {
            'product_type': product_type,
            'passed': True,
            'defects': [],
            'grade': 'A'
        }
        det_results = self.detector(image, conf=0.4)
        defect_area_total = 0
        for box in det_results[0].boxes:
            cls = self.detector.model.names[int(box.cls)]
            bbox = list(map(int, box.xyxy[0]))
            area = ((bbox[2]-bbox[0]) * (bbox[3]-bbox[1]))
            img_area = image.shape[0] * image.shape[1]
            defect = {
                'type': cls,
                'bbox': bbox,
                'area_ratio': area / img_area,
                'confidence': float(box.conf)
            }
            result['defects'].append(defect)
            defect_area_total += area / img_area
        if product_type in self.color_standards:
            color_result = self._color_check(image, product_type)
            result['color_analysis'] = color_result
            if not color_result['in_range']:
                result['defects'].append({
                    'type': 'color_deviation',
                    'deviation': color_result['deviation']
                })
        critical_defects = [d for d in result['defects']
                              if d['type'] in ['mold', 'rot', 'foreign_object']]
        if critical_defects:
            result['passed'] = False
            result['grade'] = 'REJECT'
        elif defect_area_total > self.defect_area_threshold:
            result['grade'] = 'C'
        elif result['defects']:
            result['grade'] = 'B'
        return result

    def _color_check(self, image: np.ndarray, product_type: str) -> dict:
        hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
        standard = self.color_standards[product_type]
        lower = np.array(standard['hsv_lower'])
        upper = np.array(standard['hsv_upper'])
        mask = cv2.inRange(hsv, lower, upper)
        in_range_ratio = mask.sum() / 255 / mask.size
        return {
            'in_range': in_range_ratio > standard.get('min_ratio', 0.6),
            'ratio': float(in_range_ratio),
            'deviation': float(1 - in_range_ratio)
        }

Specifics by Product Category

Fruits and Vegetables

Common flaws: rot, bruises, cracks, foreign matter. Key challenge: apple bruises visible only under specific lighting. Solution: multi-angle capture (3–4 cameras) or polarized light.

Meat and Poultry

Blood spots, contamination, incomplete cutting. Multispectral cameras (NIR range) outperform standard RGB for detecting blood spots.

Bread and Bakery

Crust cracks, foreign inclusions, underbaking. High contrast — performs well.

Fish

Freshness determined by gill color and eye clarity. Requires a model trained on narrow features.

Comparison of Detection Methods by Product

Product Common Defects Recommended Model Additional Sensors
Apples Rot, bruise, crack YOLOv8 + ResNet Polarized light
Chicken Blood spot, incomplete cut EfficientDet NIR camera
Bread Crust cracks, inclusions YOLOv8 Standard RGB
Fish Gill color, eye clarity EfficientNet-b4 NIR + high resolution

Case Study: Apple Sorting Line, 8 t/h (From Our Practice)

Conveyor belt 1.2 m wide, speed 0.3 m/s, 3 cameras (top + 2 sides). Task: sort into 3 categories: Premium (no defects), Standard (minor defects), Juice (major defects).

  • Model: YOLOv8m, fine-tuned on 4200 images of apples (3 varieties)
  • Classes: bruise, rot_spot, scar, crack, size_small, size_large
  • Performance: 720p frame processed in 12 ms on Jetson Orin

Results after 2 weeks of operation:

  • Premium/Standard classification accuracy: 96.2%
  • Rot detection recall: 98.7%
  • Mis-sorting losses reduced by 68% vs. manual inspection (savings up to 1.5 million rubles per month)

What's Included: Turnkey Delivery

  1. Line audit — assess lighting, conveyor speed, available space
  2. Dataset collection and labeling — from 2000 images with defect annotations
  3. Model training — YOLOv8, EfficientNet, or Transformer-based architecture (choice depends on speed/accuracy requirements)
  4. Inference engineering — optimization for Jetson, GPU server, or cloud (Triton, ONNX)
  5. Conveyor integration — camera sync, sorter pulsing, OPC UA/Modbus protocols
  6. Documentation and operator training — instructions, guidelines, dashboard
  7. Warranty — 6 months of model support (retraining if new defects appear)

Development Timelines

Product Development Time
Single product defect detector 4–6 weeks
Multi-product system (3–5 types) 8–12 weeks
With production line integration 10–16 weeks

Consultation and Pilot Project

To evaluate your project, contact us — we'll conduct a free line audit and propose a solution within your budget and timeline. With over 5 years of experience and 10 successful implementations in the food industry, we deliver reliable AI inspection solutions. Order a two-week pilot project to see accuracy on your own products. Get a consultation on implementing AI inspection on your line.

Our experience: 10 implemented systems in the food industry, certifications for ISO 9001 and HACCP.