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.
23 lines
590 B
Python
23 lines
590 B
Python
2 years ago
|
|
||
|
|
||
|
def det_img(model_inference,images_frame,confidence,label_name_list):
|
||
|
|
||
|
result = model_inference.predict(images_frame)
|
||
|
|
||
|
bbox_list = result.boxes
|
||
|
labels_ids_list = result.label_ids
|
||
|
scores_list = result.scores
|
||
|
|
||
|
result_list = []
|
||
|
|
||
|
for i in range(len(labels_ids_list)):
|
||
|
|
||
|
if scores_list[i] > confidence:
|
||
|
|
||
|
if int(labels_ids_list[i]) in range(len(label_name_list)):
|
||
|
|
||
|
result_dict = {label_name_list[int(labels_ids_list[i])]:bbox_list[i]}
|
||
|
result_list.append(result_dict)
|
||
|
|
||
|
|
||
|
return result_list
|