30 lines
892 B
Python
30 lines
892 B
Python
import numpy as np
|
|
import tritonclient.http as httpclient
|
|
|
|
# Connect to Triton
|
|
client = httpclient.InferenceServerClient(url="localhost:8089")
|
|
|
|
# Prepare dummy input image (e.g., normalized float32 [0,1])
|
|
input_data = np.random.rand(1, 3, 160, 160).astype(np.float32)
|
|
|
|
# Create Triton input
|
|
input_tensor = httpclient.InferInput("input", input_data.shape, "FP32")
|
|
input_tensor.set_data_from_numpy(input_data)
|
|
|
|
# Declare expected outputs
|
|
output_names = ["embedding", "bbox", "score", "landmarks"]
|
|
output_tensors = [httpclient.InferRequestedOutput(name) for name in output_names]
|
|
|
|
# Send inference request
|
|
response = client.infer(
|
|
model_name="face_recognition",
|
|
inputs=[input_tensor],
|
|
outputs=output_tensors
|
|
)
|
|
|
|
# Parse and print outputs
|
|
for name in output_names:
|
|
output = response.as_numpy(name)
|
|
print(f"{name}: shape={output.shape}, dtype={output.dtype}")
|
|
print(output)
|