Skip to content

Commit

Permalink
Yeet skeet
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Jan 7, 2024
1 parent d4a4a27 commit bced34b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ build
rknpu2
cmake_build
.gradle

*.onnx
*.jar
13 changes: 11 additions & 2 deletions src/test/java/org/photonvision/rknn/RknnTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,35 @@
package org.photonvision.rknn;

import java.io.IOException;
import java.util.Arrays;

import org.junit.jupiter.api.Test;
import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.dnn.Dnn;
import org.opencv.imgcodecs.Imgcodecs;

public class RknnTest {
public static void main(String[] args) throws IOException {
@Test
public void testBasicBlobs() throws IOException {
// I really really hate this. Someone should fix this for me
System.load("/home/matt/Documents/GitHub/photonvision/photon-targeting/build/NativeMain/RawRuntimeLibs/linux/x86-64/shared/libopencv_java480.so");

// This also needs to get fixed
System.load("/home/matt/Documents/rknn/rknn_java/cmake_build/librknn_java.so");

Mat img = Imgcodecs.imread("src/test/resources/bus.jpg");
System.out.println(img);

var blob = Dnn.blobFromImage(img, 1.0 / 255.0, new Size(640, 640));

// This also needs to get changed
long ptr = RknnJNI.create("/home/matt/Documents/rknn/rknn_java/src/test/resources/yolov7-tiny.onnx");
System.out.println(ptr);

var ret = RknnJNI.detect(ptr, blob.getNativeObjAddr(), 0, 0, 1);
System.out.println(ret);
System.out.println(Arrays.toString(ret));

RknnJNI.destroy(ptr);

System.out.println(blob);
Expand Down

0 comments on commit bced34b

Please sign in to comment.