Dzaky Zakiyal Fawwaz

Daewoong Pharmaceutical · 2021–2022

Real-Time Encapsulation Quality Detection

AI Engineer

Real-Time Encapsulation Quality Detection

Problem

Encapsulation only preserves a material when droplets come out equal in size and shape, in a straight chain with even spacing. Bad settings give uneven droplets, unstable flow, and coalescence. The team needed to tell from the camera feed whether the process, and its frequency setting, was good.

Approach

From 300K raw images across 22 frequency settings, frequencies with high success rates were labeled good. A single frame can mislead, so I tiled 16 sequential frames into one 2D image grid, which keeps the temporal information at far lower cost than a 3D model and still supports class activation maps. An EfficientNet classifier predicts good or bad, a second model predicts the frequency range, and activation-map checks confirmed the models look at the droplets.

Architecture

Hover a component to trace its connections · drag to pan · use + / − to zoom

  • Source
  • Processing
  • Model
  • Data store
  • Output

How It Works

  1. CaptureThe encapsulator camera saves frames to a folder as the machine runs.
  2. Grid16 sequential frames are tiled into one square image grid.
  3. ClassifyAn EfficientNet model predicts good or bad encapsulation, and a second model predicts the frequency range (450 is optimal).
  4. ExplainGrad-CAM, Grad-CAM++, Score-CAM, and Faster Score-CAM show which regions drive each prediction.
  5. ShowA desktop app displays the prediction, a console log, and image details in real time.

What I Built

  • The image-grid dataset: 16 sequential frames per sample, built from 300K raw images across 22 frequency settings.
  • An EfficientNet-B0 good/bad classifier (93.5% test accuracy) and an EfficientNet-B3 frequency-range classifier over 8 classes (83% test accuracy).
  • Model validation with Grad-CAM, Grad-CAM++, Score-CAM, and Faster Score-CAM.
  • A standalone real-time GUI (Tkinter, packaged with PyInstaller) that watches the camera’s output folder, so operators run it without installing Python or TensorFlow.

Impact

The good/bad model reached 93.5% test accuracy and the frequency model 83%, with activation maps focused on the droplets. The app ships as one executable that runs beside the machine and updates predictions as new frames arrive.

Screenshots & Figures

Real-time bead prediction desktop app
The standalone app: last frame, 16-frame grid, quality and frequency predictions, and a live log.
Droplets leaving the encapsulation nozzle
Raw camera frame of the droplet stream.
Good and bad droplet frames
Good frequencies give even, evenly spaced droplets; bad ones give uneven droplets and coalescence.
Class activation maps on an image grid
Grad-CAM, Grad-CAM++, Score-CAM, and Faster Score-CAM confirm the model attends to the droplets.
Training and test accuracy curves
Good-vs-bad model accuracy over 20 epochs.

Key Metrics

93.5%Good vs bad test accuracy
83%Frequency-range test accuracy
300KRaw images across 22 frequency settings
16Sequential frames per prediction
2.4 sDetection time per 16-frame batch

Tech Stack

PythonTensorFlow 2 / KerasEfficientNet-B0 / B3Grad-CAMTkinterPyInstallerimgaug