From b34658b248895c9b16b4b049aabfff45788d6b9e Mon Sep 17 00:00:00 2001 From: Mohammad Durrani Date: Sun, 14 Jan 2024 15:57:30 -0500 Subject: [PATCH 1/2] removed max detections --- src/main/java/org/photonvision/rknn/RknnJNI.java | 2 +- src/main/native/cpp/rknn_jni.cpp | 2 +- src/main/native/cpp/rknn_jni.h | 2 +- src/test/java/org/photonvision/rknn/RknnTest.java | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/photonvision/rknn/RknnJNI.java b/src/main/java/org/photonvision/rknn/RknnJNI.java index a81ffab..0b990e4 100644 --- a/src/main/java/org/photonvision/rknn/RknnJNI.java +++ b/src/main/java/org/photonvision/rknn/RknnJNI.java @@ -89,6 +89,6 @@ public boolean equals(Object obj) { * @param maxDetections */ public static native RknnResult[] detect( - long detectorPtr, long imagePtr, double nmsThresh, double boxThresh, int maxDetections + long detectorPtr, long imagePtr, double nmsThresh, double boxThresh ); } diff --git a/src/main/native/cpp/rknn_jni.cpp b/src/main/native/cpp/rknn_jni.cpp index d8d964d..faa33e2 100644 --- a/src/main/native/cpp/rknn_jni.cpp +++ b/src/main/native/cpp/rknn_jni.cpp @@ -92,7 +92,7 @@ Java_org_photonvision_rknn_RknnJNI_destroy JNIEXPORT jobjectArray JNICALL Java_org_photonvision_rknn_RknnJNI_detect (JNIEnv *env, jclass, jlong detector_, jlong input_cvmat_ptr, - jdouble nms_thresh, jdouble box_thresh, jint max_detections) + jdouble nms_thresh, jdouble box_thresh) { RknnWrapper *yolo = reinterpret_cast(detector_); cv::Mat *input_img = reinterpret_cast(input_cvmat_ptr); diff --git a/src/main/native/cpp/rknn_jni.h b/src/main/native/cpp/rknn_jni.h index 83c3283..7f2a502 100644 --- a/src/main/native/cpp/rknn_jni.h +++ b/src/main/native/cpp/rknn_jni.h @@ -50,7 +50,7 @@ JNIEXPORT void JNICALL Java_org_photonvision_rknn_RknnJNI_destroy(JNIEnv *, * Signature: (JJIIF)[Lorg/photonvision/rknn/RknnJNI/RknnResult; */ JNIEXPORT jobjectArray JNICALL Java_org_photonvision_rknn_RknnJNI_detect( - JNIEnv *, jclass, jlong, jlong, jdouble, jdouble, jint); + JNIEnv *, jclass, jlong, jlong, jdouble, jdouble); #ifdef __cplusplus } // extern "C" diff --git a/src/test/java/org/photonvision/rknn/RknnTest.java b/src/test/java/org/photonvision/rknn/RknnTest.java index 76ff212..0f1a676 100644 --- a/src/test/java/org/photonvision/rknn/RknnTest.java +++ b/src/test/java/org/photonvision/rknn/RknnTest.java @@ -79,10 +79,10 @@ public void testBasicBlobs() { System.load("/home/mdurrani808/photon-testing/rknn_jni/cmake_build/librknn_jni.so"); System.out.println("Creating detector"); - long ptr = RknnJNI.create("/home/mdurrani808/photon-testing/rknn_jni/src/test/resources/RK3588/yolov5s-640-640.rknn"); + long ptr = RknnJNI.create("/home/mdurrani808/photon-testing/rknn_jni/src/test/resources/RK3588/yolov5s-640-640.rknn", 80); System.out.println("Running detector"); - var ret = RknnJNI.detect(ptr, img.getNativeObjAddr()); + var ret = RknnJNI.detect(ptr, img.getNativeObjAddr(), .45, .25); System.out.println(Arrays.toString(ret)); System.out.println("Killing detector"); From 0cf529f850971b955b1964084b2f6b614b3692cb Mon Sep 17 00:00:00 2001 From: Mohammad Durrani Date: Sun, 14 Jan 2024 16:24:24 -0500 Subject: [PATCH 2/2] classic javadoc --- src/main/java/org/photonvision/rknn/RknnJNI.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/photonvision/rknn/RknnJNI.java b/src/main/java/org/photonvision/rknn/RknnJNI.java index 0b990e4..9b27def 100644 --- a/src/main/java/org/photonvision/rknn/RknnJNI.java +++ b/src/main/java/org/photonvision/rknn/RknnJNI.java @@ -86,7 +86,6 @@ public boolean equals(Object obj) { * @param imagePtr Pointer to a cv::Mat input image * @param nmsThresh * @param boxThresh - * @param maxDetections */ public static native RknnResult[] detect( long detectorPtr, long imagePtr, double nmsThresh, double boxThresh