Downloads · 30 days
62
61% of all-time downloads
anan19990108/yolov8s-1024-int8-tflite
yolov8s-1024-int8-tflite is a object detection model from anan19990108. Use it when you need objects located in an image. The card lists the license as agpl-3.0.
Fully integer post-training quantized YOLOv8s for 1024×1024 object detection. The artifact was calibrated with COCO images and validated on the complete 5,000-image COCO val2017 split using the Qualcomm QNN HTP delegate.
Downloads · 30 days
62
61% of all-time downloads
All-time downloads
101
Public
Repo size
11.6 MB
Likes
1
Public
Click a slice to open those files.
.tflite11.6 MB · 100%
From the Hugging Face model README
Fully integer post-training quantized YOLOv8s for 1024×1024 object detection. The artifact was calibrated with COCO images and validated on the complete 5,000-image COCO val2017 split using the Qualcomm QNN HTP delegate.
The YOLOv8s architecture and COCO-trained weights originate from Ultralytics. Andrew Chiao performed the 1024×1024 export, representative-dataset calibration, full-integer quantization, TensorFlow Lite packaging, Android QNN HTP integration, and device-level accuracy and latency validation.
| File | Input / output | Input size | Size | SHA-256 |
|---|---|---|---|---|
yolov8s_1024_int8.tflite | INT8 / INT8 | 1024×1024 | 11.10 MiB | 036f778c5c87f36726fc40f61ad82edaf6c0613e5c620677d4cea810f9677de4 |
Output tensor shape: [1, 84, 21504]. Non-maximum suppression is performed
outside the model.
tf.lite.Optimize.DEFAULTTFLITE_BUILTINS_INT8[0, 1]Evaluation used COCO val2017 (5,000 images, 80 classes).
| Metric | Result |
|---|---|
| mAP50 | 0.571802 |
| mAP50–95 | 0.370733 |
| Predictions | 354,125 |
| Mean model invoke | 6.285 ms |
| Inference-only throughput | 159.10 FPS |
| Runtime pipeline excluding source decode | 57.60 FPS |
| Sequential end-to-end | 21.86 FPS |
Timing environment:
The inference-only number measures Interpreter.run. Source image decoding,
preprocessing, output decoding, and NMS are outside that boundary. Host/device
transfers performed inside the delegate cannot be isolated through the TFLite
Java API.
The matching FP16 baseline reached mAP50 0.593022 and mAP50–95 0.411226. The INT8 model is the speed-first deployment option; FP16 remains the accuracy-first baseline.
The example below runs the model and converts the INT8 output back to real values. Letterbox metadata must be retained to map boxes back to the source image.
import numpy as np
from PIL import Image
import tensorflow as tf
interpreter = tf.lite.Interpreter("yolov8s_1024_int8.tflite")
interpreter.allocate_tensors()
inp = interpreter.get_input_details()[0]
out = interpreter.get_output_details()[0]
image = Image.open("image.jpg").convert("RGB")
# Production code should preserve aspect ratio and letterbox with RGB 114.
image = image.resize((1024, 1024), Image.Resampling.BILINEAR)
real = np.asarray(image, dtype=np.float32)[None] / 255.0
in_scale, in_zero = inp["quantization"]
input_int8 = np.clip(np.rint(real / in_scale + in_zero), -128, 127).astype(np.int8)
interpreter.set_tensor(inp["index"], input_int8)
interpreter.invoke()
raw_int8 = interpreter.get_tensor(out["index"])
out_scale, out_zero = out["quantization"]
prediction = (raw_int8.astype(np.float32) - out_zero) * out_scale
print(prediction.shape) # (1, 84, 21504)
prediction[:, 0:4, :] contains box channels and
prediction[:, 4:84, :] contains the 80 class-score channels. Apply the same
score threshold, coordinate transform, and NMS used during validation.
The Qualcomm QNN LiteRT delegate and matching QNN runtime must come from an authorized, version-compatible Qualcomm SDK package. A minimal Java setup is:
QnnDelegate.Options qnn = new QnnDelegate.Options();
qnn.setSkelLibraryDir(context.getApplicationInfo().nativeLibraryDir);
qnn.setCacheDir(context.getCacheDir().getAbsolutePath());
qnn.setModelToken("yolov8s_1024_int8");
qnn.setBackendType(QnnDelegate.Options.BackendType.HTP_BACKEND);
qnn.setHtpUseConvHmx(QnnDelegate.Options.HtpUseConvHmx.HTP_CONV_HMX_ON);
qnn.setHtpPerformanceMode(
QnnDelegate.Options.HtpPerformanceMode.HTP_PERFORMANCE_BURST);
if (!QnnDelegate.checkCapability(
QnnDelegate.Capability.HTP_RUNTIME_QUANTIZED)) {
throw new IllegalStateException("Quantized QNN HTP runtime unavailable");
}
qnn.setHtpPrecision(QnnDelegate.Options.HtpPrecision.HTP_PRECISION_QUANTIZED);
QnnDelegate delegate = new QnnDelegate(qnn);
Interpreter.Options options = new Interpreter.Options();
options.setUseNNAPI(false);
options.setUseXNNPACK(false);
options.addDelegate(delegate);
Interpreter interpreter = new Interpreter(modelBuffer, options);
Keep the QnnDelegate alive for at least as long as the interpreter and close
both when the runtime is replaced. Verify in device logs that the graph is
delegated to HTP and that CPU fallback is not masking an integration failure.
The exported model derives from Ultralytics YOLOv8. The local export metadata identifies the upstream license as AGPL-3.0. Review the upstream Ultralytics license and your intended deployment obligations before use.