diff --git a/app/src/main/assets/yolov5s_416_6shave.blob b/app/src/main/assets/yolov5s_416_6shave.blob new file mode 100644 index 0000000..6b16a1f Binary files /dev/null and b/app/src/main/assets/yolov5s_416_6shave.blob differ diff --git a/app/src/main/cpp/native-lib.cpp b/app/src/main/cpp/native-lib.cpp index a9c78b0..b241d4c 100644 --- a/app/src/main/cpp/native-lib.cpp +++ b/app/src/main/cpp/native-lib.cpp @@ -73,8 +73,12 @@ Java_com_example_depthai_1android_1jni_1example_MainActivity_startDevice(JNIEnv detectionNetwork->setConfidenceThreshold(0.5f); detectionNetwork->setNumClasses(80); detectionNetwork->setCoordinateSize(4); - detectionNetwork->setAnchors({10, 14, 23, 27, 37, 58, 81, 82, 135, 169, 344, 319}); - detectionNetwork->setAnchorMasks({{"side26", {1, 2, 3}}, {"side13", {3, 4, 5}}}); +// Yolov3/v4 tiny +// detectionNetwork->setAnchors({10, 14, 23, 27, 37, 58, 81, 82, 135, 169, 344, 319}); +// detectionNetwork->setAnchorMasks({{"side26", {1, 2, 3}}, {"side13", {3, 4, 5}}}); +// Yolov5s + detectionNetwork->setAnchors({10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326}); + detectionNetwork->setAnchorMasks({{"side52", {0, 1, 2}}, {"side26", {3, 4, 5}}, {"side13", {6, 7, 8}}}); detectionNetwork->setIouThreshold(0.5f); detectionNetwork->setBlob(model_blob); detectionNetwork->setNumInferenceThreads(2); diff --git a/app/src/main/java/com/example/depthai_android_jni_example/MainActivity.java b/app/src/main/java/com/example/depthai_android_jni_example/MainActivity.java index c0da45b..1a9bac6 100644 --- a/app/src/main/java/com/example/depthai_android_jni_example/MainActivity.java +++ b/app/src/main/java/com/example/depthai_android_jni_example/MainActivity.java @@ -21,6 +21,7 @@ public class MainActivity extends AppCompatActivity { private static final String yolov3_model_path = "yolo-v3-tiny-tf.blob"; private static final String yolov4_model_path = "yolov4_tiny_coco_416x416_6shave.blob"; + private static final String yolov5_model_path = "yolov5s_416_6shave.blob"; private static final String mobilenet_model_path = "mobilenet-ssd.blob"; private ImageView rgbImageView, depthImageView; @@ -73,7 +74,7 @@ public void run() { if(running){ if(firstTime){ // Start the device - startDevice(yolov4_model_path, rgbWidth, rgbHeight); + startDevice(yolov5_model_path, rgbWidth, rgbHeight); firstTime = false; }