脚本专栏 发布日期:2025/11/11 浏览次数:1
当你还是个孩子坐车旅行的时候,你玩过数经过的汽车的数目的游戏吗"htmlcode">
import cv2
import matplotlib.pyplot as plt
import cvlib as cv
from cvlib.object_detection import draw_bbox
im = cv2.imread('cars_4.jpeg')
bbox, label, conf = cv.detect_common_objects(im)
output_image = draw_bbox(im, bbox, label, conf)
plt.imshow(output_image)
plt.show()
print('Number of cars in the image is ' str(label.count('car')))
此图像的输出:
Number of cars in the image is 29
此图像的输出:
Number of cars in the image is 22
此图像的输出:
Number of cars in the image is 25
你的汽车计数器程序现在已经准备好了。你可以用它来做一些有趣的实验,比如计算每天经过你家门前车道的汽车数量。
要了解更多关于cvlib库的信息,可以访问下面的链接。
cvlib: https://www.cvlib.net
欢迎关注PyTorch官方中文教程站:http://pytorch.panchuang.net/
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。