Avoid recreating resp_objects.

As the following code review comment suggested:
https://github.com/serengil/deepface/pull/1396#discussion_r1900015959
This commit is contained in:
h-alice 2025-01-03 10:24:43 +08:00
parent edcef02511
commit 472f146ecc
No known key found for this signature in database
GPG Key ID: 5708F34144A70909

View File

@ -163,7 +163,11 @@ def analyze(
# Convert the list of valid faces to a numpy array # Convert the list of valid faces to a numpy array
faces_array = np.array(valid_faces) faces_array = np.array(valid_faces)
resp_objects = [{} for _ in range(len(valid_faces))]
# Create placeholder response objects for each face
for _ in range(len(valid_faces)):
resp_objects.append({})
# For each action, predict the corresponding attribute # For each action, predict the corresponding attribute
pbar = tqdm( pbar = tqdm(