我正在尝试使用gluoncv中的Faster-RCNN实现来计算图像中的车辆数量,如here中所示。我想获取图像的字符串标签。例如,在下图中,字符串标签为'bus'。我怎么能得到它?
以下是我的实现。
import os
import glob
from matplotlib import pyplot as plt
from gluoncv import model_zoo, data, utils
vehiclesum1 = []
for filename in glob.glob('/home/xx/PythonCode/test/*.jpg'):
x, orig_img = data.transforms.presets.rcnn.load_test(filename)
box_ids, scores, bboxes = net(x)
ax = utils.viz.plot_bbox(orig_img, bboxes[0], scores[0], box_ids[0], class_names=net.classes)
# I want to identify this label1
vehiclesum1.append(label1.count('car') + label1.count('truck') + label1.count('motorcycle') + label1.count('bus'))
plt.show()
答案 0 :(得分:0)
这样的事情怎么样?
Windows