Darknet/YOLO v6.0-37-gb57f9029
Object Detection Framework
 
Loading...
Searching...
No Matches
onnx_test_model Namespace Reference

Variables

 _
 
 bbox = draw.textbbox((x1, y1), label, font=font)
 
 best_class_indices = np.argmax(confs, axis=1)
 
dict best_class_scores = confs[np.arange(N), best_class_indices]
 
dict boxes = output_dict["boxes"]
 
list class_names = [f"class_{i}" for i in range(num_classes)]
 
 cls = best_class_indices[idx]
 
dict confs = output_dict["confs"]
 
list detections = []
 
 draw = ImageDraw.Draw(img)
 
 fill
 
 font = ImageFont.load_default()
 
 H
 
 H_img
 
 img = Image.open(sys.argv[2]).convert('RGB')
 
float img_np = np.array(img_resized).astype("float32") / 255.0
 
 img_resized = img.resize((W, H))
 
 input_name = session.get_inputs()[0].name
 
 input_shape = session.get_inputs()[0].shape
 
int k = 10
 
 key
 
str label = f"{class_names[cls]} {score:.2f}"
 
 N
 
 num_classes
 
 outline
 
dict output_dict = {name: value for name, value in zip(output_names, outputs)}
 
list output_names = [o.name for o in session.get_outputs()]
 
 outputs = session.run(output_names, {input_name: img_np})
 
dict score = best_class_scores[idx]
 
 session = ort.InferenceSession(sys.argv[1], providers=["CPUExecutionProvider"])
 
list text_bg = [text_x, text_y, text_x + text_w, text_y + text_h]
 
 text_h = bbox[3] - bbox[1]
 
 text_w = bbox[2] - bbox[0]
 
 text_x = x1
 
 text_y = max(0, y1 - text_h)
 
float threshold = 0.75
 
 topk_indices = np.argsort(-best_class_scores)[:k]
 
 W
 
 W_img
 
 width
 
 x1
 
 x1_pix = x1 * W_img
 
 x2
 
 x2_pix = x2 * W_img
 
 y1
 
 y1_pix = y1 * H_img
 
 y2
 
 y2_pix = y2 * H_img
 

Variable Documentation

◆ _

onnx_test_model._
protected

◆ bbox

onnx_test_model.bbox = draw.textbbox((x1, y1), label, font=font)

◆ best_class_indices

onnx_test_model.best_class_indices = np.argmax(confs, axis=1)

◆ best_class_scores

dict onnx_test_model.best_class_scores = confs[np.arange(N), best_class_indices]

◆ boxes

dict onnx_test_model.boxes = output_dict["boxes"]

◆ class_names

list onnx_test_model.class_names = [f"class_{i}" for i in range(num_classes)]

◆ cls

onnx_test_model.cls = best_class_indices[idx]

◆ confs

dict onnx_test_model.confs = output_dict["confs"]

◆ detections

list onnx_test_model.detections = []

◆ draw

onnx_test_model.draw = ImageDraw.Draw(img)

◆ fill

onnx_test_model.fill

◆ font

onnx_test_model.font = ImageFont.load_default()

◆ H

onnx_test_model.H

◆ H_img

onnx_test_model.H_img

◆ img

onnx_test_model.img = Image.open(sys.argv[2]).convert('RGB')

◆ img_np

onnx_test_model.img_np = np.array(img_resized).astype("float32") / 255.0

◆ img_resized

onnx_test_model.img_resized = img.resize((W, H))

◆ input_name

onnx_test_model.input_name = session.get_inputs()[0].name

◆ input_shape

onnx_test_model.input_shape = session.get_inputs()[0].shape

◆ k

int onnx_test_model.k = 10

◆ key

onnx_test_model.key

◆ label

onnx_test_model.label = f"{class_names[cls]} {score:.2f}"

◆ N

onnx_test_model.N

◆ num_classes

onnx_test_model.num_classes

◆ outline

onnx_test_model.outline

◆ output_dict

dict onnx_test_model.output_dict = {name: value for name, value in zip(output_names, outputs)}

◆ output_names

list onnx_test_model.output_names = [o.name for o in session.get_outputs()]

◆ outputs

onnx_test_model.outputs = session.run(output_names, {input_name: img_np})

◆ score

dict onnx_test_model.score = best_class_scores[idx]

◆ session

onnx_test_model.session = ort.InferenceSession(sys.argv[1], providers=["CPUExecutionProvider"])

◆ text_bg

onnx_test_model.text_bg = [text_x, text_y, text_x + text_w, text_y + text_h]

◆ text_h

onnx_test_model.text_h = bbox[3] - bbox[1]

◆ text_w

onnx_test_model.text_w = bbox[2] - bbox[0]

◆ text_x

onnx_test_model.text_x = x1

◆ text_y

onnx_test_model.text_y = max(0, y1 - text_h)

◆ threshold

float onnx_test_model.threshold = 0.75

◆ topk_indices

onnx_test_model.topk_indices = np.argsort(-best_class_scores)[:k]

◆ W

onnx_test_model.W

◆ W_img

onnx_test_model.W_img

◆ width

onnx_test_model.width

◆ x1

onnx_test_model.x1

◆ x1_pix

onnx_test_model.x1_pix = x1 * W_img

◆ x2

onnx_test_model.x2

◆ x2_pix

onnx_test_model.x2_pix = x2 * W_img

◆ y1

onnx_test_model.y1

◆ y1_pix

onnx_test_model.y1_pix = y1 * H_img

◆ y2

onnx_test_model.y2

◆ y2_pix

onnx_test_model.y2_pix = y2 * H_img