INNER CODE UNIT · Python
test
minivision-ai/Silent-Face-Anti-Spoofing · test.py:34
def test(image_name, model_dir, device_id):
model_test = AntiSpoofPredict(device_id)
image_cropper = CropImage()
image = cv2.imread(SAMPLE_IMAGE_PATH + image_name)
result = check_image(image)
if result is False:
return
image_bbox = model_test.get_bbox(image)
prediction = np.zeros((1, 3))
test_speed = 0
# sum the prediction from single model's result
for model_name in os.listdir(model_dir):
h_input, w_input, model_type, scale = parse_model_name(model_name)
param = {
"org_img": image,
"bbox": image_bbox,
"scale": scale,
"out_w": w_input,