Inspiration

Current AI-based road-safety systems face a trade-off between cloud processing and on-device processing. Cloud AI can provide more computing power, but network latency and connectivity can make real-time detection unreliable. On-device AI avoids network dependency, but mobile devices have limited processing resources.

We wanted to build a system that could intelligently adapt to these conditions instead of always using only one approach.

What We Built

We built AdaptiveAI, a mobile road-safety AI prototype using Flutter, YOLO object detection, and TensorFlow Lite.

The application continuously analyzes camera frames and monitors:

  • AI detection confidence
  • Local inference time
  • Device workload
  • Network availability and latency

Based on these conditions, AdaptiveAI decides whether processing should remain on the mobile device or be delegated to the cloud.

For example, when the device is performing well, the system can use mobile inference. When local inference becomes expensive and network conditions are suitable, the system recommends cloud processing. When network conditions are poor, the system can fall back to local processing.

How It Works

The basic pipeline is:

Camera → Image preprocessing → YOLO/TFLite → Object detection → Performance monitoring → Adaptive decision

The mobile application uses a YOLO model converted to TensorFlow Lite. Camera frames are converted into the format required by the model and resized to the model's 640×640 input.

The application displays detected objects, confidence scores, bounding boxes, inference time, network status, and the current adaptive decision.

Technical Implementation

The project was developed using:

  • Flutter and Dart
  • Android Camera API through the Flutter camera package
  • TensorFlow Lite
  • YOLO object detection
  • Background inference using TFLite IsolateInterpreter
  • YUV420 camera-frame preprocessing
  • Network latency monitoring
  • Device workload and inference-time monitoring

A major focus was keeping the camera preview responsive while performing AI inference in the background.

Challenges

One of the main challenges was processing camera frames without making the preview slow or unstable. We solved this by limiting inference frequency and moving TensorFlow Lite inference to a background isolate.

Another challenge was converting Android camera YUV420 frames into the RGB tensor required by the YOLO model while maintaining the correct 640×640 input dimensions.

We also had to handle the difference between camera frame resolution and model input resolution and ensure that detection coordinates were displayed correctly on the camera preview.

Results

The final prototype successfully runs YOLO object detection directly on an Android device and displays real-time detections with bounding boxes and confidence scores.

AdaptiveAI also measures local inference performance and network conditions and uses these measurements to make a MOBILE or CLOUD processing recommendation.

This demonstrates the core idea of adaptive edge AI: instead of permanently choosing either mobile or cloud processing, the system can make a decision based on the current conditions.

Future Improvements

Future versions could use a more specialized road-safety detection model, improve detection accuracy through additional training data, implement an actual cloud inference endpoint, and use more advanced workload prediction to make the mobile/cloud decision more accurate.

Built With

Share this project:

Updates

Submission history