Open ThomaswellY opened 21 hours ago
Hi @ThomaswellY,
It appears that you are still using the legacy Pose solution, which has been replaced by the upgraded Pose Landmarker Task API. Please note that support for the legacy solution has ended. You can find more details about this change in the legacy guide and available solutions documentation.
We recommend migrating to the new Pose Landmarker Task API, which offers improved features and support. You can review the API overview and follow the Python implementation guide to get started.
If you are still using the legacy solution, you may try the provided workaround here, but please note that further assistance is limited as support for the legacy version has ended. However, if you are using the upgraded API and need help suppressing warning logs, we may be able to assist. please let us know if you need further clarification.
Thank you!!
HI!@kuaashish Thank you for your response and for pointing out the transition to the Pose Landmarker Task API. I have migrated my implementation to the upgraded API, following the Python implementation guide](https://ai.google.dev/edge/mediapipe/solutions/vision/pose_landmarker/python?hl=zh-cn) . However, I am still encountering the issue of persistent log outputs in the console. Despite applying various log suppression techniques, including setting environment variables (TF_CPP_MIN_LOG_LEVEL, GLOG_minloglevel), adjusting Abseil's logging verbosity, and redirecting stdout/stderr during the execution, logs such as the following continue to appear: WARNING: All log messages before absl::InitializeLog() is called are written to STDERR I0000 00:00:1731930035.529357 21253 task_runner.cc:85] GPU suport is not available: INTERNAL: ; RET_CHECK failure (mediapipe/gpu/gl_context_egl.cc:84) egl_initializedUnable to initialize EGL INFO: Created TensorFlow Lite XNNPACK delegate for CPU. W0000 00:00:1731930035.660247 28339 inference_feedback_manager.cc:114] Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors. W0000 00:00:1731930035.831237 28343 inference_feedback_manager.cc:114] Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors. Here is a simplified version of the code that reproduces the issue: import mediapipe as mp import os import cv2 os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' os.environ['GLOG_minloglevel'] = '2' model_path = "/xx/models/mediapipe/pose_landmarker.task" BaseOptions = mp.tasks.BaseOptions PoseLandmarker = mp.tasks.vision.PoseLandmarker PoseLandmarkerOptions = mp.tasks.vision.PoseLandmarkerOptions VisionRunningMode = mp.tasks.vision.RunningMode options = PoseLandmarkerOptions( base_options=BaseOptions(model_asset_path=model_path), running_mode=VisionRunningMode.IMAGE ) with PoseLandmarker.create_from_options(options) as landmarker: image = cv2.imread("example.jpg") mp_image_input = mp.Image.create_from_file("example.jpg") result = landmarker.detect(mp_image_input) Issue: The logs persist during the creation of the PoseLandmarker instance Question: Is there a specific way to suppress these logs (INFO, WARNING, and others) using the Pose Landmarker Task API? I look forward to your suggestions or insights to address this persistent issue. Please let me know if additional details or context are needed.
Thank you for your continued support!
Best regards, ThomaswellY
Hello, I am using Mediapipe's Pose module in Python to extract region masks from images. My environment includes VS Code for debugging. Despite my efforts to suppress logs, I am still seeing a significant amount of information printed to the console, including INFO, WARNING, and other messages from Mediapipe and TensorFlow. Here is an excerpt of the problematic log output: INFO: Created TensorFlow Lite XNNPACK delegate for CPU. INFO: Created TensorFlow Lite XNNPACK delegate for CPU. WARNING: All log messages before absl::InitializeLog() is called are written to STDERR W0000 00:00:1731912234.538702 75025 inference_feedback_manager.cc:114] Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors. W0000 00:00:1731912234.624405 75029 landmark_projection_calculator.cc:186] Using NORM_RECT without IMAGE_DIMENSIONS is only supported for the square ROI. Provide IMAGE_DIMENSIONS or use PROJECTION_MATRIX. I have already implemented multiple solutions to suppress the output, including: 1.Setting environment variables: os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' os.environ['GLOG_minloglevel'] = '3' 2.Using Abseil's logging verbosity: from absl import logging as absl_logging absl_logging.set_verbosity(absl_logging.FATAL) 3.Redirecting stdout and stderr during the execution of Mediapipe's code: from contextlib import contextmanager @contextmanager def suppress_all_output(): devnull = open(os.devnull, 'w') old_stdout, old_stderr = sys.stdout, sys.stderr try: sys.stdout, sys.stderr = devnull, devnull yield finally: sys.stdout, sys.stderr = old_stdout, old_stderr devnull.close() Despite these efforts, the logs persist, particularly during the instantiation of Mediapipe's Pose module and subsequent processing steps. My Environment: Operating System: Ubuntu 20.04 Python Version: 3.9 Mediapipe Version: 0.10.18 tensorboard 2.18.0 tensorboard-data-server 0.7.2 tensorboard-plugin-wit 1.8.1 tensorboardX 2.6.2.2 tensorflow-io-gcs-filesystem 0.37.1 Debugger: VS Code Steps to Reproduce: 1.Load an image and process it using Mediapipe's Pose: with mp.solutions.pose.Pose(min_detection_confidence=0.5, min_tracking_confidence=0.5) as pose: results = pose.process(cv2.cvtColor(image, cv2.COLOR_BGR2RGB)) 2.Observe the persistent log output in the console. Expected Behavior: No logs should be printed to the console if suppression methods are applied. Actual Behavior: Logs from TensorFlow, Mediapipe, and Abseil persist even after applying the above suppression techniques. Question: Is there a definitive way to completely suppress all logs (including INFO, WARNING, and ERROR) from Mediapipe, TensorFlow, and Abseil without modifying Mediapipe's source code?
Alternatively, if source code modification is required, could you provide detailed guidance on which parts of the Mediapipe source are responsible for logging and how to suppress them effectively?
Thank you for your time and assistance.