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