Add comment.

This commit is contained in:
h-alice 2025-01-06 11:51:22 +08:00
parent 5747d9648b
commit 5a1881492f
No known key found for this signature in database
GPG Key ID: 5708F34144A70909

View File

@ -37,8 +37,7 @@ class Demography(ABC):
if img_batch.shape[0] == 1: # Single image
img_batch = img_batch.squeeze(0) # Remove batch dimension
predict_result = self.model(img_batch, training=False).numpy()[0, :]
predict_result = np.expand_dims(predict_result, axis=0) # Add batch dimension
predict_result = self.model(img_batch, training=False).numpy()[0, :] # Predict with legacy method.
return predict_result
else: # Batch of images
return self.model.predict_on_batch(img_batch)