disable mtcnn batching by default due to unexpected behaviour

This commit is contained in:
galthran-wq 2025-02-21 17:49:34 +00:00
parent c46d886a67
commit add4c73944

View File

@ -82,8 +82,21 @@ class MtCnnClient(Detector):
def _supports_batch_detection(self) -> bool: def _supports_batch_detection(self) -> bool:
import mtcnn import mtcnn
import os
supports_batch_detection = os.getenv(
"ENABLE_MTCNN_BATCH_DETECTION", "false"
).lower() == "true"
if not supports_batch_detection:
logger.warning(
"Batch detection is disabled for mtcnn by default "
"since the results are not consistent with single image detection. "
"You can force enable it by setting the environment variable "
"ENABLE_MTCNN_BATCH_DETECTION to true."
)
return False
try: try:
mtcnn_version = mtcnn.__version__ mtcnn_version = mtcnn.__version__
supports_batch_detection = mtcnn_version >= "1.0.0"
except AttributeError: except AttributeError:
try: try:
import mtcnn.metadata import mtcnn.metadata