Toybrick

display boxes in inference result

jefferyzhang

版主

积分
13007
楼主
发表于 2020-4-20 16:56:32 | 显示全部楼层
Which version of rknn-toolkit you used, there is a drawing code in latest (1.3.0) sample code as below:
  1. # Draw result
  2.     for i in range(0, vaildCnt):
  3.         if candidateBox[0][i] == -1:
  4.             continue

  5.         n = candidateBox[0][i]

  6.         xmin = max(0.0, min(1.0, predictions[0][n][1])) * INPUT_SIZE
  7.         ymin = max(0.0, min(1.0, predictions[0][n][0])) * INPUT_SIZE
  8.         xmax = max(0.0, min(1.0, predictions[0][n][3])) * INPUT_SIZE
  9.         ymax = max(0.0, min(1.0, predictions[0][n][2])) * INPUT_SIZE

  10.         # print("%d @ (%d, %d) (%d, %d) score=%f" % (topClassScoreIndex, xmin, ymin, xmax, ymax, topClassScore))
  11.         cv2.rectangle(orig_img, (int(xmin), int(ymin)), (int(xmax), int(ymax)),
  12.              (random.random()*255, random.random()*255, random.random()*255), 3)

  13.     cv2.imwrite("out.jpg", orig_img)
复制代码


回复

使用道具 举报

jefferyzhang

版主

积分
13007
沙发
发表于 2020-4-21 08:32:35 | 显示全部楼层
NG1368 发表于 2020-4-20 23:56
I use from1.2.1 version

You have to download the latest rknn-toolkit from http://t.rock-chips.com/forum.ph ... &extra=page%3D1

And you will find the 1.3.0 has more samples there
回复

使用道具 举报

jefferyzhang

版主

积分
13007
板凳
发表于 2020-4-22 08:43:33 | 显示全部楼层
In the 1.3.0 sample, coco_label_list.txt is the idx2name file.
You can use it to search the class name
回复

使用道具 举报

jefferyzhang

版主

积分
13007
地板
发表于 2020-4-23 08:25:40 | 显示全部楼层
NG1368 发表于 2020-4-23 02:39
can you send me a link of example that use from this code for display boxes?

Try it:

https://rockchips-my.sharepoint. ... %2E3%2E0%2Fexamples
回复

使用道具 举报

jefferyzhang

版主

积分
13007
5#
发表于 2020-4-23 15:25:55 | 显示全部楼层
回复

使用道具 举报

jefferyzhang

版主

积分
13007
6#
发表于 2020-4-24 08:27:03 | 显示全部楼层
NG1368 发表于 2020-4-24 03:48
it didn't work and ended up in the same error.

  Other people can work properly ...
Try this one:
https://github.com/rockchip-linux/rknn-toolkit
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

产品中心 购买渠道 开源社区 Wiki教程 资料下载 关于Toybrick


快速回复 返回顶部 返回列表