mediapipe
mediapipe copied to clipboard
Python crashes for holistic model on video
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
Yes
OS Platform and Distribution
Ubuntu 22.04
Mobile device if the issue happens on mobile device
No response
Browser and version if the issue happens on browser
No response
Programming Language and version
Python
MediaPipe version
0.10.14
Bazel version
No response
Solution
Holistic
Android Studio, NDK, SDK versions (if issue is related to building in Android environment)
No response
Xcode & Tulsi version (if issue is related to building for iOS)
No response
Describe the actual behavior
Python kernel crashes at the start of calling mediapipe holistic model
Describe the expected behaviour
Not crashing
Standalone code/steps you may have used to try to get what you need
Dear mediapipe-team,
I tried different steps to solve that issue:
1) Using mediapipe in MacOs and Windows
2) Use of CPU and GPU delegates
3) Use of images instead of videos
4) Conversion of the original MOV to MP4 format
However, this did not resolve the issue. I wonder whether this issue is related to the file format (MP4/MOV), but cv2 is able to read that and plotting the numpy array results in the expected image.
Thus, I would highly appreciate your support. You can find an example code attached:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 4 19:12:15 2024
@author: christian.schmitz
"""
My code:
import cv2
import sys
import os
import glob
import numpy as np
import mediapipe as mp # mediapipe for hand dectection
import plotly.graph_objs as go
from plotly.subplots import make_subplots
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.animation
import pandas as pd
import plotly.graph_objects as go
import plotly.io as pio
import scipy as sc
from scipy import signal
from mediapipe.tasks import python
BaseOptions =python.BaseOptions
HolisticLandmarker = mp.tasks.vision.HolisticLandmarker
HolisticLandmarkerOptions = mp.tasks.vision.HolisticLandmarkerOptions
VisionRunningMode = mp.tasks.vision.RunningMode
# Create a face landmarker instance with the video mode:
options = HolisticLandmarkerOptions(
base_options=BaseOptions(model_asset_path="/data/Christian/MoCap/holistic_landmarker.task"),
min_face_detection_confidence=0.8,
min_face_suppression_threshold=0.8,
min_face_landmarks_confidence=0.8,
min_pose_detection_confidence=0.8,
min_pose_suppression_threshold=0.8,
min_pose_landmarks_confidence=0.8,
min_hand_landmarks_confidence=0.8,
output_face_blendshapes=True,
running_mode=VisionRunningMode.VIDEO)
input_dir = r'/data/video'
video_files = np.array(glob.glob(os.path.join(input_dir, "**",'*mp4'),recursive=True))
# Set mediapipe model
# Iterate through video_file (words)
for video_file in video_files:
# Create a directory for the current word
video_file_path = video_file[:video_file.rfind(os.sep)]
outputName = video_file[video_file.rfind(
os.sep)+1:video_file.rfind('video')]
output_video_path = os.path.join(
output_dir, video_file[video_file.rfind("/")+1:-4])
subject = outputName[outputName.rfind(
"sub-"):outputName.rfind("_ses")]
session = outputName[outputName.rfind(
"ses-"):outputName.find("_", outputName.find("_")+1)]
if not os.path.exists(os.path.join(output_video_path, subject, session)):
os.makedirs(os.path.join(output_video_path, subject,
session, '.video'), exist_ok=True)
os.makedirs(os.path.join(output_video_path, subject,
session, 'motion'), exist_ok=True)
video_path = os.path.join(video_file_path, video_file)
with HolisticLandmarker.create_from_options(options) as holistic:
# The landmarker is initialized. Use it here.
# Read video and calculate duration
cap = cv2.VideoCapture(video_path)
# Saving Video-
fps = int(cap.get(cv2.CAP_PROP_FPS))
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
out = cv2.VideoWriter(os.path.join(output_video_path, subject, session, '.video', outputName +
'desc-overlayVideo_video.mov'), fourcc, fps, (int(cap.get(3)), int(cap.get(4))))
# Initialize empty list for keypoints
keypoints_list = []
success = 1
# Iterate through frames in the sequence
while success:
# Read video frame
success, frame = cap.read()
frame_timestamp_ms = int(cap.get(cv2.CAP_PROP_POS_MSEC))
# Make detections and draw landmarks
mp_image = mp.Image(image_format=mp.ImageFormat.SRGB, data=frame)
results = holistic.detect_for_video(mp_image, frame_timestamp_ms)
Other info / Complete Logs
No response
Here is the error message:
I0000 00:00:1717520611.283032 68206 gl_context_egl.cc:85] Successfully initialized EGL. Major : 1 Minor: 5
I0000 00:00:1717520611.285679 70364 gl_context.cc:357] GL version: 3.2 (OpenGL ES 3.2 Mesa 23.2.1-1ubuntu3.1~22.04.2), renderer: llvmpipe (LLVM 15.0.7, 256 bits)
Fatal Python error: Aborted
Main thread:
Current thread 0x00007f0e2b8eb440 (most recent call first):
File "/home/christian.schmitz/.conda/envs/MNI-mocap/lib/python3.8/site-packages/mediapipe/python/packet_getter.py", line 61 in get_proto
File "/home/christian.schmitz/.conda/envs/MNI-mocap/lib/python3.8/site-packages/mediapipe/tasks/python/vision/holistic_landmarker.py", line 170 in _build_landmarker_result
File "/home/christian.schmitz/.conda/envs/MNI-mocap/lib/python3.8/site-packages/mediapipe/tasks/python/vision/holistic_landmarker.py", line 535 in detect_for_video
File "/tmp/ipykernel_68206/2139099985.py", line 103 in <module>
Restarting kernel...
Hi @ChristianNSchmitz,
It looks like we are already aware of this issue. Could you please confirm if it is similar to issue https://github.com/google-ai-edge/mediapipe/issues/5181? If so, please follow up on that issue as we are already tracking it, and close this one.
Thank you!!
Dear @kuaashish,
thanks for the quick reply! It might actually be related to #5181. Is there a roadmap for the bug fix?
Dear @kuaashish,
thanks for the quick reply! Upon further testing, I do get also a similar error for the FaceMesh and Pose models both on Ubuntu and on MacOs:
- Error on Ubuntu:
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast: /home/christian.schmitz/.conda/envs/MNI-mocap/lib/python3.11/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libLLVM-15.so.1) (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
I0000 00:00:1718005884.583256 1286400 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
W0000 00:00:1718005884.583600 1286400 face_landmarker_graph.cc:174] Sets FaceBlendshapesGraph acceleration to xnnpack by default.
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast: /home/christian.schmitz/.conda/envs/MNI-mocap/lib/python3.11/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libLLVM-15.so.1) (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast: /home/christian.schmitz/.conda/envs/MNI-mocap/lib/python3.11/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libLLVM-15.so.1) (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast: /home/christian.schmitz/.conda/envs/MNI-mocap/lib/python3.11/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libLLVM-15.so.1) (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast: /home/christian.schmitz/.conda/envs/MNI-mocap/lib/python3.11/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libLLVM-15.so.1) (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast: /home/christian.schmitz/.conda/envs/MNI-mocap/lib/python3.11/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libLLVM-15.so.1) (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
W0000 00:00:1718005884.598783 3871238 inference_feedback_manager.cc:114] Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors.
W0000 00:00:1718005884.610541 3871257 inference_feedback_manager.cc:114] Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors.
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast: /home/christian.schmitz/.conda/envs/MNI-mocap/lib/python3.11/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libLLVM-15.so.1) (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
I0000 00:00:1718005884.615151 1286400 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
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast: /home/christian.schmitz/.conda/envs/MNI-mocap/lib/python3.11/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libLLVM-15.so.1) (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast: /home/christian.schmitz/.conda/envs/MNI-mocap/lib/python3.11/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libLLVM-15.so.1) (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast: /home/christian.schmitz/.conda/envs/MNI-mocap/lib/python3.11/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libLLVM-15.so.1) (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast: /home/christian.schmitz/.conda/envs/MNI-mocap/lib/python3.11/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libLLVM-15.so.1) (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast: /home/christian.schmitz/.conda/envs/MNI-mocap/lib/python3.11/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libLLVM-15.so.1) (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
W0000 00:00:1718005884.700489 3871280 inference_feedback_manager.cc:114] Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors.
W0000 00:00:1718005884.723198 3871286 inference_feedback_manager.cc:114] Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors.
Traceback (most recent call last):
Cell In[24], line 29
face_landmarker_result = face_landmarker.detect_for_video(mp_image, timestamps)
File ~/.conda/envs/MNI-mocap/lib/python3.11/site-packages/mediapipe/tasks/python/vision/face_landmarker.py:3185 in detect_for_video
_IMAGE_IN_STREAM_NAME: packet_creator.create_image(image).at(
TypeError: at(): incompatible function arguments. The following argument types are supported:
1. (self: mediapipe.python._framework_bindings.packet.Packet, arg0: int) -> mediapipe.python._framework_bindings.packet.Packet
2. (self: mediapipe.python._framework_bindings.packet.Packet, arg0: mediapipe.python._framework_bindings.timestamp.Timestamp) -> mediapipe.python._framework_bindings.packet.Packet
Invoked with: <mediapipe.Packet with timestamp: UNSET and C++ type: ::mediapipe::Image>, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,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0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
- Error on MacOs:
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1718008223.473977 22071636 gl_context.cc:357] GL version: 2.1 (2.1 Metal - 88), renderer: Apple M3 Pro
W0000 00:00:1718008223.476454 22071636 face_landmarker_graph.cc:174] Sets FaceBlendshapesGraph acceleration to xnnpack by default.
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
W0000 00:00:1718008223.484174 22082016 inference_feedback_manager.cc:114] Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors.
W0000 00:00:1718008223.492176 22082024 inference_feedback_manager.cc:114] Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors.
I0000 00:00:1718008223.495504 22071636 gl_context.cc:357] GL version: 2.1 (2.1 Metal - 88), renderer: Apple M3 Pro
W0000 00:00:1718008223.649430 22082036 inference_feedback_manager.cc:114] Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors.
W0000 00:00:1718008223.692241 22082036 inference_feedback_manager.cc:114] Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors.
Traceback (most recent call last):
Cell In[3], line 532
FaceBody(input_dir, output_dir)
Cell In[3], line 277 in FaceBody
face_landmarker_result = face_landmarker.detect_for_video(mp_image, timestamps)
File ~/opt/anaconda3/envs/MNI-mocap/lib/python3.11/site-packages/mediapipe/tasks/python/vision/face_landmarker.py:3185 in detect_for_video
_IMAGE_IN_STREAM_NAME: packet_creator.create_image(image).at(
TypeError: at(): incompatible function arguments. The following argument types are supported:
1. (self: mediapipe.python._framework_bindings.packet.Packet, arg0: int) -> mediapipe.python._framework_bindings.packet.Packet
2. (self: mediapipe.python._framework_bindings.packet.Packet, arg0: mediapipe.python._framework_bindings.timestamp.Timestamp) -> mediapipe.python._framework_bindings.packet.Packet
Invoked with: <mediapipe.Packet with timestamp: UNSET and C++ type: ::mediapipe::Image>, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0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 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
Do you have a workaround for that issue or is there a roadmap for the bug fix? Thanks!
Hi @ChristianNSchmitz,
You should not encounter a similar error in the Face Mesh and Pose models, as this issue is specific to the Holistic Landmarker Task API. We believe you might be using the legacy Face Mesh and Pose solutions. Could you please provide the complete standalone code you are using so we can verify this?
Thank you!!
Hi @kuaashish,
thanks for getting back to me so quickly! Here is the code (without the pretext):
BaseOptions = mp.tasks.BaseOptions
FaceLandmarker = mp.tasks.vision.FaceLandmarker
FaceLandmarkerOptions = mp.tasks.vision.FaceLandmarkerOptions
VisionRunningMode = mp.tasks.vision.RunningMode
BaseOptions = mp.tasks.BaseOptions
PoseLandmarker = mp.tasks.vision.PoseLandmarker
PoseLandmarkerOptions = mp.tasks.vision.PoseLandmarkerOptions
VisionRunningMode = mp.tasks.vision.RunningMode
# Create a face landmarker instance with the video mode:
options_pose = PoseLandmarkerOptions(
base_options=BaseOptions(model_asset_path="/Users/christian/Desktop/Forschung/Projekte/MoCap/pose_landmarker_full.task"),
num_poses=1,
min_pose_detection_confidence=0.8,
min_pose_presence_confidence=0.8,
min_tracking_confidence=0.8,
running_mode=VisionRunningMode.VIDEO)
options_face = FaceLandmarkerOptions(
base_options=BaseOptions(model_asset_path="//Users/christian/Desktop/Forschung/Projekte/MoCap/face_landmarker.task"),
num_faces=1,
min_face_detection_confidence=0.8,
min_face_presence_confidence=0.8,
min_tracking_confidence=0.8,
output_face_blendshapes=True,
output_facial_transformation_matrixes=True,
running_mode=VisionRunningMode.VIDEO)
video_files = [np.array(glob.glob(os.path.join(input_dir, "**",'*mov'),recursive=True))[0]]
# Iterate through video_file (words)
for video_file in video_files:
# Create a directory for the current word
video_file_path = video_file[:video_file.rfind(os.sep)]
outputName = video_file[video_file.rfind(
os.sep)+1:video_file.rfind('video')]
output_video_path = os.path.join(
output_dir, video_file[video_file.rfind("/")+1:-4])
subject = outputName[outputName.rfind(
"sub-"):outputName.rfind("_ses")]
session = outputName[outputName.rfind(
"ses-"):outputName.find("_", outputName.find("_")+1)]
if not os.path.exists(os.path.join(output_video_path, subject, session)):
os.makedirs(os.path.join(output_video_path, subject,
session, '.video'), exist_ok=True)
os.makedirs(os.path.join(output_video_path, subject,
session, 'motion'), exist_ok=True)
video_path = os.path.join(video_file_path, video_file)
with FaceLandmarker.create_from_options(options_face) as face_landmarker, PoseLandmarker.create_from_options(options_pose) as pose_landmarker:
# The landmarker is initialized. Use it here.
# Read video and calculate duration
cap = cv2.VideoCapture(video_path)
frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
# Saving Video-
fps = int(cap.get(cv2.CAP_PROP_FPS))
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
out = cv2.VideoWriter(os.path.join(output_video_path, subject, session, '.video', outputName +
'desc-overlayVideo_video.mov'), fourcc, fps, (int(cap.get(3)), int(cap.get(4))))
# Initialize empty list for keypoints
face_keypoints_list = []
pose_keypoints_list = []
# Iterate through frames in the sequence
for frame_num in range(frame_count):
try:
# Read video frame
ret, frame = cap.read()
if not ret:
print("1")
break
timestamps = [cap.get(cv2.CAP_PROP_POS_MSEC)]
# Make detections and draw landmarks
mp_image = mp.Image(image_format=mp.ImageFormat.SRGB, data=frame)
face_landmarker_result = face_landmarker.detect_for_video(mp_image, timestamps)
pose_landmarker_result = pose_landmarker.detect_for_video(mp_image, timestamps)
Hi @kuaashish, I wanted to get back to you regarding this issue. Do you have a roadmap for the fix? Thanks a lot!
Hi @ChristianNSchmitz,
Currently, I do not have any information about this fix. However, a new release is coming soon, and we hope this issue will be resolved in the upcoming version.
Thank you!!
Hi @ChristianNSchmitz,
We are closing this issue as a duplicate of https://github.com/google-ai-edge/mediapipe/issues/5181. Please follow up on that issue, as we are tracking it there.
Thank you!!