Example with ONNX Runtime GPU:
sess_options = ort.SessionOptions()
sess_options.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_EXTENDED
providers = ['CUDAExecutionProvider', 'CPUExecutionProvider']
sess = ort.InferenceSession("w600k-r50.onnx", sess_options, providers=providers)
The "W600K" prefix refers to WebFace600K, a massive cleaned-up version of the original CASIA-WebFace dataset. w600k-r50.onnx
[1, 512] (A 512-dimensional embedding vector).
session = ort.InferenceSession("w600k-r50.onnx", providers=['CUDAExecutionProvider', 'CPUExecutionProvider']) Example with ONNX Runtime GPU: sess_options = ort
def preprocess_face(image_path): img = cv2.imread(image_path) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) img = cv2.resize(img, (112, 112)) img = img.astype(np.float32) img = (img / 255.0) # Normalize to [0,1] # Note: Some versions require img = (img - 127.5) / 128.0 img = np.transpose(img, (2, 0, 1)) # HWC -> CHW img = np.expand_dims(img, axis=0) # Add batch dimension return img The "W600K" prefix refers to WebFace600K , a
A typical w600k-r50.onnx file size is between 90MB and 110MB. Let's analyze its internal structure.