Ultralytics Android App: Real-time Object Detection with YOLO Models
The Ultralytics Android App is a powerful tool that allows you to run YOLO models directly on your Android device for real-time object detection. This app utilizes TensorFlow Lite for model optimization and various hardware delegates for acceleration, enabling fast and efficient object detection.
Watch: Getting Started with the Ultralytics HUB App (IOS & Android)
Quantization and Acceleration
To achieve real-time performance on your Android device, YOLO models are quantized to either FP16 or INT8 precision. Quantization is a process that reduces the numerical precision of the model's weights and biases, thus reducing the model's size and the amount of computation required. This results in faster inference times without significantly affecting the model's accuracy.
FP16 Quantization
FP16 (or half-precision) quantization converts the model's 32-bit floating-point numbers to 16-bit floating-point numbers. This reduces the model's size by half and speeds up the inference process, while maintaining a good balance between accuracy and performance.
INT8 Quantization
INT8 (or 8-bit integer) quantization further reduces the model's size and computation requirements by converting its 32-bit floating-point numbers to 8-bit integers. This quantization method can result in a significant speedup, but it may lead to a slight reduction in mean average precision (mAP) due to the lower numerical precision.
mAP Reduction in INT8 Models
The reduced numerical precision in INT8 models can lead to some loss of information during the quantization process, which may result in a slight decrease in mAP. However, this trade-off is often acceptable considering the substantial performance gains offered by INT8 quantization.
Delegates and Performance Variability
Different delegates are available on Android devices to accelerate model inference. These delegates include CPU, GPU, Hexagon and NNAPI. The performance of these delegates varies depending on the device's hardware vendor, product line, and specific chipsets used in the device.
- CPU: The default option, with reasonable performance on most devices.
- GPU: Utilizes the device's GPU for faster inference. It can provide a significant performance boost on devices with powerful GPUs.
- Hexagon: Leverages Qualcomm's Hexagon DSP for faster and more efficient processing. This option is available on devices with Qualcomm Snapdragon processors.
- NNAPI: The Android Neural Networks API (NNAPI) serves as an abstraction layer for running ML models on Android devices. NNAPI can utilize various hardware accelerators, such as CPU, GPU, and dedicated AI chips (e.g., Google's Edge TPU, or the Pixel Neural Core).
Here's a table showing the primary vendors, their product lines, popular devices, and supported delegates:
Vendor | Product Lines | Popular Devices | Delegates Supported |
---|---|---|---|
Qualcomm | Snapdragon (e.g., 800 series) | Samsung Galaxy S21, OnePlus 9, Google Pixel 6 | CPU, GPU, Hexagon, NNAPI |
Samsung | Exynos (e.g., Exynos 2100) | Samsung Galaxy S21 (Global version) | CPU, GPU, NNAPI |
MediaTek | Dimensity (e.g., Dimensity 1200) | Realme GT, Xiaomi Redmi Note | CPU, GPU, NNAPI |
HiSilicon | Kirin (e.g., Kirin 990) | Huawei P40 Pro, Huawei Mate 30 Pro | CPU, GPU, NNAPI |
NVIDIA | Tegra (e.g., Tegra X1) | NVIDIA Shield TV, Nintendo Switch | CPU, GPU, NNAPI |
Please note that the list of devices mentioned is not exhaustive and may vary depending on the specific chipsets and device models. Always test your models on your target devices to ensure compatibility and optimal performance.
Keep in mind that the choice of delegate can affect performance and model compatibility. For example, some models may not work with certain delegates, or a delegate may not be available on a specific device. As such, it's essential to test your model and the chosen delegate on your target devices for the best results.
Getting Started with the Ultralytics Android App
To get started with the Ultralytics Android App, follow these steps:
-
Download the Ultralytics App from the Google Play Store.
-
Launch the app on your Android device and sign in with your Ultralytics account. If you don't have an account yet, create one here.
-
Once signed in, you will see a list of your trained YOLO models. Select a model to use for object detection.
-
Grant the app permission to access your device's camera.
-
Point your device's camera at objects you want to detect. The app will display bounding boxes and class labels in real-time as it detects objects.
-
Explore the app's settings to adjust the detection threshold, enable or disable specific object classes, and more.
With the Ultralytics Android App, you now have the power of real-time object detection using YOLO models right at your fingertips. Enjoy exploring the app's features and optimizing its settings to suit your specific use cases.