Overview
1. spaceGearSDK AAR
Copy the spaceGearSDK-debug.aar library file to objectSample/app/aar.
app/build.gradle
Set implementation AAR.
dependencies {
.
.
.
implementation files('aar/spaceGearSDK-debug.aar')
}2. ObjectDetectionModel Init
MainActivity.java
//TODO intialize the tracker to draw rectangles
tracker = new MultiBoxTracker(this);
//TODO inialize object detector
try {
detector =
ObjectDetectionModel.create(
this,
Config.TFLITE_MODEL,
Config.TFLITE_LABEL,
TF_OD_API_INPUT_SIZE,
true);
detector.setNumThreads(4);
detector.setUseNNAPI(true);
} catch (IOException e) {
throw new RuntimeException(e);
} During app launch, the ObjectDetectionModel from spaceGearSDK is initialized in the onCreate() method.
3. ObjectDetection Recognize Result
drawing/MultiBoxTracker.java
The part where camera preview is received, object detection is performed, and the result values are obtained.
4. Model Change
Inside the "model" folder of the objectSample project, there are the following files: efficientdet_lite0.tflite, efficientdet_lite1.tflite, efficientdet_lite2.tflite, efficientdet_lite3.tflite, lite-model_ssd_mobilenet_v1_1_metadata_2.tflite, and lite-model_yolo-v5-tflite_tflite_model_1.tflite.
After copying the model files to objectSample/app/src/main/assets, modify util/Config.java.
Performance may vary depending on the model and the device.
5. Diagram

Last updated