predict.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:ppap_detect 作者: ashitani 项目源码 文件源码
def draw_boxes(im_org,sorted_boxes,classes,block_x,block_y,biases,colors):
  im_marked=im_org.copy()
  im_size=np.shape(im_org)
  im_h=im_size[0]
  im_w=im_size[1]

  for sorted_box in sorted_boxes:
      b,j,class_id,p_class = sorted_box

      print classes[class_id], np.max(p_class)*100

      x=b.x
      y=b.y
      w=b.w
      h=b.h

      x0 = int(np.clip(x-w/2,0,im_w))
      y0 = int(np.clip(y-h/2,0,im_h))
      x1 = int(np.clip(x+w/2,0,im_w))
      y1 = int(np.clip(y+h/2,0,im_h))
      im_marked=cv2.rectangle(im_marked, (x0, y0),(x1, y1),colors[class_id],thickness=2)
#      im_marked=cv2.rectangle(im_marked, (x0, y0),(x0+100, y0+20) ,colors[class_id],thickness=-1)
#      cv2.putText(im_marked, classes[class_id],(x0+5,y0+15), cv2.FONT_HERSHEY_SIMPLEX,0.5,(0,0,0),thickness=2)
  return im_marked
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号