You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
def analysis_yolov8 ( frame , model_coco , confidence_set ) :
# 第一步: 用COCO数据集推理
results_coco = model_coco ( frame )
re_list = [ ]
if results_coco :
for r in results_coco :
boxes = r . boxes
idx = 0
for box in boxes :
idx + = 1
b = box . xyxy [ 0 ] # get box coordinates in (top, left, bottom, right) format
c = box . cls
# 保存标签和坐标值作为返回结果
blist = b . tolist ( )
labels_name = model_coco . names [ int ( c ) ]
confidence = float ( box . conf )
confidence = round ( confidence , 2 )
# 过滤置信度以下目标
if confidence < confidence_set :
continue
if labels_name == ' person ' :
# 一个结果字典
re_dict = { labels_name : blist }
re_list . append ( re_dict )
return re_list