Open corner4world opened 6 months ago
You linked an unmaintained project. Also it looks like the function you are calling returns an int32 not a uint32. https://github.com/airockchip/rknn-toolkit2/blob/b25dadacc24b88eb7dfcaa47c9c525ecca89b319/rknpu2/examples/rknn_yolov5_android_apk_demo/app/src/main/cpp/rknn_api.h#L460 int in C is 32bit signed not unsigned. Using int
in Go for this is not correct. Use int32
rknn_query The return value only proves that the execution was successful. A pointer was passed in the parameter, and the function changed the value of the pointer, which is also required by the program. The function was executed twice, with the first execution result being correct and the second failure to obtain the correct io_num
@corner4world is this still happening with the latest commit?
@corner4world is this still happening with the latest commit?
Hello, I am using v0.5.1 @TotallyGamerJet
Are you saying it's still happening? If so, can you try the latest commit? https://github.com/ebitengine/purego/commit/33b97fd6a58bb9b0a49975db60adc78b4619047e
Yes, it's not the expected outcome either
This is my project code: rknn.zip @TotallyGamerJet
I am using Purego to call Microchip Micro 3588 rknn_ Npu2, after registering the corresponding function, use rknn_query function returns an error in uint32 when querying model input:
Expected: Model input num: 1, output num: 1
Result: Model input num: 508, output num: 4294967295
The code is as follows: package main
import ( "fmt" "github.com/ebitengine/purego" "io" "os" "unsafe" )
func openLibrary(name string) (uintptr, error) { return purego.Dlopen(name, purego.RTLD_NOW|purego.RTLD_GLOBAL) }
func load_model(model_path string) (model []byte, model_len int64, err error) { file, err := os.Open(model_path) if err != nil { panic(err) }
}
func main() { var ctx rknn_context librknn, err := openLibrary("/userdata/rknpu2/runtime/RK3588/Linux/librknn_api/aarch64/librknn_api.so") if err != nil { panic(err) }
}