0
0
Computer Visionml~20 mins

Face embedding and comparison in Computer Vision - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Face Embedding Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What does a face embedding represent?

Imagine you have a photo of a face. A face embedding is a way to turn that photo into a list of numbers. What do these numbers represent?

AThe coordinates of the face in the original image.
BThe exact pixel colors of the face image stored as numbers.
CA random set of numbers unrelated to the face's appearance.
DA unique numeric summary capturing important features of the face for comparison.
Attempts:
2 left
💡 Hint

Think about how a fingerprint summarizes unique patterns.

Predict Output
intermediate
2:00remaining
Output of cosine similarity between two face embeddings

Given two face embeddings as numpy arrays, what is the output of the cosine similarity calculation?

Computer Vision
import numpy as np
embedding1 = np.array([1, 0, 0])
embedding2 = np.array([0, 1, 0])
cos_sim = np.dot(embedding1, embedding2) / (np.linalg.norm(embedding1) * np.linalg.norm(embedding2))
print(round(cos_sim, 2))
A0.00
B1.00
C0.50
D-1.00
Attempts:
2 left
💡 Hint

Cosine similarity measures angle between vectors; orthogonal vectors have similarity zero.

Model Choice
advanced
2:00remaining
Best model type for generating face embeddings

Which type of neural network model is best suited to generate face embeddings that capture facial features effectively?

ARecurrent Neural Network (RNN) trained on text data
BDecision tree trained on tabular data
CConvolutional Neural Network (CNN) trained on face images
DFully connected network trained on random noise
Attempts:
2 left
💡 Hint

Think about models good at processing images.

Metrics
advanced
2:00remaining
Choosing a metric for face embedding comparison

You have two face embeddings and want to decide if they belong to the same person. Which metric is most commonly used for this comparison?

AMean squared error
BCosine similarity
CAccuracy score
DCross-entropy loss
Attempts:
2 left
💡 Hint

Think about measuring angle similarity between vectors.

🔧 Debug
expert
2:00remaining
Why does this face embedding comparison code fail?

Consider this code snippet to compare two face embeddings:

embedding1 = [0.1, 0.2, 0.3]
embedding2 = [0.1, 0.2, 0.3]
cos_sim = sum(embedding1 * embedding2) / (sum(embedding1**2)**0.5 * sum(embedding2**2)**0.5)
print(round(cos_sim, 2))

What error will this code raise?

ATypeError: can't multiply sequence by sequence
BZeroDivisionError: division by zero
CNameError: name 'embedding1' is not defined
DNo error, outputs 1.00
Attempts:
2 left
💡 Hint

Look at how lists are multiplied in Python.