Back to blogs
Machine LearningTensorFlowDeep LearningAnomaly DetectionPythonRaspberry Pi

Lessons from Deep Learning Anomaly Detection on Sensor Data

What I learned building an ML model for COVID-19 detection using electronic nose sensor data — from data preprocessing and TensorFlow model design to edge inference on Raspberry Pi.

Doni Putra PurbawaDoni Putra Purbawa
November 1, 202311 min read

This post covers the research and engineering behind the i-Nose C-19 project — a deep learning system for detecting COVID-19 biomarkers using an electronic nose (e-nose) sensor array and TensorFlow.

The Problem

Traditional COVID-19 detection required expensive lab equipment or slow antigen tests. We explored whether exhaled breath patterns captured by MOS (Metal Oxide Semiconductor) sensors could distinguish COVID-19 positive samples.

Data Collection Challenges

The hardest part wasn't the model — it was the data pipeline. Each breath sample produced a time-series of 8 sensor readings over 60 seconds. Noise, sensor drift, and environmental variation required careful preprocessing.

def preprocess_sensor_data(raw_readings: np.ndarray) -> np.ndarray:
    normalized = (raw_readings - raw_readings.mean(axis=0)) / raw_readings.std(axis=0)
    features = np.concatenate([
        normalized.max(axis=0),
        normalized.mean(axis=0),
        np.trapz(normalized, axis=0),
    ])
    return features

Model Architecture

We evaluated LSTM, CNN-LSTM hybrid, and a feedforward network. The CNN-LSTM hybrid performed best, capturing both local patterns and temporal dependencies.

Edge Inference on Raspberry Pi

Deploying TensorFlow Lite on a Raspberry Pi 4 required model quantization to reduce size from 12MB to 3MB while preserving accuracy within 2%.

Published Results

The work was published in an Elsevier Q1 journal with 94% classification accuracy on held-out test data. The key lesson: ML research that ends up in a real device teaches you things no Kaggle competition can.

Doni Putra Purbawa

Doni Putra Purbawa

Cloud Architect & Senior Backend Engineer | AWS, Fintech, Cloud & AI

Designing reliable AWS cloud architecture, fintech platforms, and AI-powered backend systems. Based in Indonesia, open to Japan relocation.

View full profile →

Comments

No comments yet. Be the first to share your thoughts!

Leave a Comment

Comments are moderated and will appear after approval.