gluoncv 用已经训练好的模型参数,检测物体
当然这个模型参数,最好用自己的,否则不够精确,我自己的还没训练完。
from matplotlib import pyplot as plt import gluoncv from gluoncv import model_zool_zoo,data,utils net = model_zoo.get_model('faster_rcnn_resnet50_v1b_voc',pretrained = True) x, orig_img = data.transforms.presets.rcnn.load_test('/mnt/hdfs-data-4/data/20180529_151800__00110383_01.jpg') box_ids, scores, bboxes = net(x) ax = utils.viz.plot_bbox(orig_img, bboxes[0], scores[0], box_ids[0], class_names=net.classes) plt.show()