-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image for Rock 4 SE RK 3399 #2
Comments
Dear @ajay01994, If you look at Radxa's website, you are facing the same journey as I did. |
Hi , Thanks for the reply , do you have a model zoo for YOLO V5,V7,V8 for RK 3399 , Also could you help with TNN how to install that ? |
The RK3399 has no NPU on board. You can use the ncnn models made for the Raspberry Pi. Or any other framework, like MNN, TNN, TensorFlow-Lite. |
Hi yes it worked for Rk 3399 thanks a lot ! I also bought a rk3588 with NPU , and was able to run yolov5 , do you have inference code for yolo v7,v8 for NPU ,and help with steps to install and inference on NPU for these models |
First of all great work @Qengineering . I appreciate your efforts. Hi Ajay! can you tell me how can I run yolov5 as a demo on rk3588 with NPU. Thank you in advance. And yes @Qengineering , I'm also interested in yolov8-seg inference with NPU. Thank you in advance you too!! |
I will port the NPU examples for the RK3566 to the RK3588 and upload them to GitHub next week. |
I have already ran build-linux_RK3588.sh file on rknpu2 examples but later I do not know what to do to make running yolov5 demo . If you guide me then it would be great. Thank you in advance |
@Qengineering Finally, I ran successfully yolov5 demo on the image you provided. Now, I would like to test yolov8_seg based on RK3588 whenever you put it. I'm really looking forward to testing it. Thank you once again! |
Hi @Qengineering , thank you so much for it. But I'm not able to download Rock 5 image from your sync site. This new image contains yolov8 examples right? And One more thing, if I would like to run my custom trained model inference on Rock 5b with NPU then should I change in .cpp right? and the model itself. Is there anything should I need to tale care of or? |
To get your custom model up and running, you need to use the rknn_toolkit2 toolkit, installed on a Linux PC, you can port the model to an INT8 or FP16 rknn model. Please use the example that best fits your architecture. For instance, ~/rknn-toolkit2/rknn-toolkit2/examples/tensorflow. Here, use test.py to port your *.pd model to *.rknn. Sometimes you need to modify test.py a little to get everything working. Also, not every model can be ported to the NPU domain. And, of course, some models don't act well with INT8. Once running, postprocces.cpp is location where you alter the code to get your outputs. (Mostly) |
The link is up and running. |
Thank you!! Sure! I will try it and will update you or ask you if I need any assistance. One more thing about the image. I'm using the rock5b image already from this repo. is it sufficient to test new examples or should I use this Rock5_ubuntu22.img for yolov8 seg? |
The latter. The Rock5B image doesn't have all the new examples. However, you could download the examples separately from the GitHub repo, as they were published this weekend. See the overview. |
So, basically, I can download the examples repo and can use in the existing Rock5 image and no need to use newer one. Right? |
OpenCV and the latest RKNPU2 library must be installed on your system. |
Thanks again. I will check. |
Hey @Qengineering, I'm trying to run the demo first and getting some error. could you please look into it please? `rock@rock-5b:~/examples/YoloV8-seg-NPU$ ./YoloV8_seg busstop.jpg rk3588/yolov8n-seg.rknn Aborted` |
Now, I'm not getting this error but it got stuck after this |
Sorry to hear.
|
My bad representation. In the second issue, it does not throw any error regarding image size. It just got stuck after this. and later not proceeding at all. Not throwing any error. I will try with the new image but I really want to run it on the Armbian Rock5 OS. But if it gets solved here then it would be great as it's not throwing any error. Just stucking on something. |
Hi @Qengineering , I tried the new image Rock5 ubuntu one and still getting the same error as mentioned below. Aborted (core dumped) |
@Qengineering I was able to run it. Instead of using imshow. I just saved image to see if it works or not. Atleast demo is working. Next thing is, to make it run for custom model. I will update you for it. Thank you once again. |
|
Hi @Qengineering , I'm working with SSH only. And yes. GTK backend is the Opencv issue. But it's fine as long as I'm able to run and save the image with prediction and verify it. I'm trying to run my custom model. I will ask you if I need some assistance. Thank you for the help |
FYI. I've just published a new SD image with the RKNPU model zoo examples. |
Thank you! I will check it. One question to you. I have customized yolov8n-seg model. Customized I mean just different classes. Just 2 instead of 80. I think I do not have to change alot in cpp side right? I tried to run after converting my model but it didn't draw any mask but just showed FPS. Do you have any idea what could be wrong? Model conversion? or something needs to be changed in drawing mask? Thank you in advance. |
Now you're on your own. I have no idea. Both can be the case. |
@Qengineering Hey! I was able to run everything properly regarding the issue mentioned above. I have another question that can I use this rock 5 image for my rock 5c and run models on RK3588S for inference? or do I have to make changes? Thank you in advance! |
You can not use this image for the Rock5C. Althrough the same RK3588(s) CPU, there are low level I/O differences. |
Thank you @Qengineering ! I will try this way. But I have a question that when I convert my model from onnx to rknn, I have to specity target platform. Should I provide RK3588 or RK3588s? |
RK3588 and RK3588s are identical from the RKNPU2 toolkit point of view. (Both have the same 3 NPU cores). |
Thank you for your answer. So, basically I can use the same converted model i used for rock5b but on rock5c image which you mentioned above. Can i copy rknn-toolkit2(contains and software directory (contains yolov8_seg model) from rock 5 image (which you have created) to the new rock5c image and then if I run the script then it will work right? |
Indeed. You're right. |
Thank you so much for your inputs! @Qengineering . it worked well with RockPi 5C. But I have observed that when I try to run fp16 rknn converted model then I'm facing segmentation fault issue. What could be wrong when I use fp16 model? I use same versions and dependencies what I used for int 8 conversion. Thank you in advance for you answer. |
fp16 requires different post-processing. std::vector<Box> get_detection_boxes_fp32(void *outputs, int grid_w, int grid_h, int num_classes, int num_anchors, const std::vector<float>& anchors, float threshold, int8_t zp, float sc)
{
std::vector<Box> boxes;
rknn_output *_outputs = (rknn_output *)outputs; //_outputs are now float32
float *out = (float *)_outputs[0].buf;
int grid_len = grid_h * grid_w;
int PropBoxSize = (5 + num_classes);
for (int a = 0; a < 5; a++){ //anchors
for (int i = 0; i < grid_h; i++){ //height
for (int j = 0; j < grid_w; j++){ //width
float box_confidence = out[(PropBoxSize * a + 4) * grid_len + i * grid_w + j]; The void *outputs points to the fp16 array. A few lines later they are cast to fp32. Now you can work with them with normal C++ code. No need for additional fp16 library. (BTW, fp16 is not bfloat16. There are differences) To call the routine: rknn_output outputs[rknn_app_ctx.io_num.n_output];
.............
// allocate outputs
memset(outputs, 0, sizeof(outputs));
for(uint32_t i = 0; i < rknn_app_ctx.io_num.n_output; i++){
outputs[i].index = i;
outputs[i].want_float = (!rknn_app_ctx.is_quant);
}
// run
rknn_run(rknn_app_ctx.rknn_ctx, nullptr);
rknn_outputs_get(rknn_app_ctx.rknn_ctx, rknn_app_ctx.io_num.n_output, outputs, NULL);
// post process
std::vector<Box> boxes = get_detection_boxes_fp32(outputs, grid_w, grid_h, num_classes, num_anchors, anchors, threshold, rknn_app_ctx.output_attrs[0].zp, rknn_app_ctx.output_attrs[0].scale); It are snippets of code from a larger program. I'm not sure if it is flawless. More a direction. |
You can find a fp16 example of YoloV5 here. |
Hi ,could you please also help me. with releasing the same model for Rock pi 4SE ,RK 3399 architecture.this would be really helpful since there are supply chain issues with Raspberry pi
https://forum.radxa.com/c/rockpi4
The text was updated successfully, but these errors were encountered: