可能我是读了一个假的研究生,这么简单的弄了3个小时,本来打算用现成的 可是一直保存不了,后面没办法自己写了一个。
其中 VOC_BBOX_LABEL_NAMES是list数组 保存对应的标签名,如果类别多的话可以用循环来写(我写在第二个代码上),颜色全部固定一致的,我第一种写法颜色是不一致的。
pred_bboxes_, pred_labels_, pred_scores_ = faster_rcnn.predict(imgs, [
sizes])
image = cv2.imread(
'/media/chenli/F1/cell_data/BCCD_Dataset/BCCD/' + 'JPEGImages/' + str(id_[0]) + '.jpg')
bboxs = at.tonumpy(pred_bboxes_[0])
name = at.tonumpy(pred_labels_[0]).reshape(-1)
score = at.tonumpy(pred_scores_[0]).reshape(-1)
for i in range(len(name)):
xmin = int(round(float(bboxs[i, 1])))
ymin = int(round(float(bboxs[i, 0])))
xmax = int(round(float(bboxs[i, 3])))
ymax = int(round(float(bboxs[i, 2])))
if name[i