In “Live Execution” of the Face XY Project,:
def live(state_widget, model, camera, prediction_widget):
global dataset
while state_widget.value == ‘live’:
image = camera.value
preprocessed = preprocess(image)
output = model(preprocessed).detach().cpu().numpy().flatten()
category_index = dataset.categories.index(category_widget.value)
x = output[2 * category_index]
y = output[2 * category_index + 1]x = int(camera.width * (x / 2.0 + 0.5)) y = int(camera.height * (y / 2.0 + 0.5)) prediction = image.copy() prediction = cv2.circle(prediction, (x, y), 8, (255, 0, 0), 3) prediction_widget.value = bgr8_to_jpeg(prediction)
I’m confused on “x = int(camera.width * (x / 2.0 + 0.5))” and " y = int(camera.height * (y / 2.0 + 0.5))"
Is it means output value (nose-x,y, eyes-x,y) of Resnet18 range in [-1, 1] ?
How does the network make the limitions?