2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【解決済み】mediapipe で face_meshがエラーになる件

Last updated at Posted at 2024-03-13

mediappeのface_meshでエラー発生

python で下記のコードでエラーが出た。

import mediapipe as mp
import cv2

mp_face_mesh = mp.solutions.face_mesh

with mp_face_mesh.FaceMesh(max_num_faces=1, min_detection_confidence=0.5, static_image_mode=True) as face_mesh:

エラー出力

    with mp_face_mesh.FaceMesh(max_num_faces=1, min_detection_confidence=0.5, static_image_mode=True) as face_mesh:
  File "/opt/anaconda3/envs/pj_mp_cv/lib/python3.8/site-packages/mediapipe/python/solutions/face_mesh.py", line 95, in __init__
    super().__init__(
  File "/opt/anaconda3/envs/pj_mp_cv/lib/python3.8/site-packages/mediapipe/python/solution_base.py", line 248, in __init__
    self._graph = calculator_graph.CalculatorGraph(
RuntimeError: ValidatedGraphConfig Initialization failed.
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
ImageToTensorCalculator: ; RET_CHECK failure (mediapipe/calculators/tensor/image_to_tensor_calculator.cc:144) ValidateOptionOutputDims(options) returned INTERNAL: ; RET_CHECK failure (./mediapipe/calculators/tensor/image_to_tensor_utils.h:136) options.has_output_tensor_float_range() || options.has_output_tensor_int_range() || options.has_output_tensor_uint_range()Output tensor range is required. 
SplitTensorVectorCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
SplitTensorVectorCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
SplitTensorVectorCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.

環境

ソフト

macOS 14.3
python 3.8.18 (3.11.8に上げても同じエラーが出た)
mediapipe 0.10.10

ハード

MacBook Air 2024

解決策

いろいろ調べた結果、mediapipeのバージョンを落とすとうまく動いた
エラーが発生するバージョン: 0.10.10, 0.10.11
エラーが発生しないバージョン: 0.10.9

mediapipe のバージョン確認

> pip list | grep mediapipe
mediapipe             0.10.11

バージョン0.10.9をインストール

> pip install mediapipe==0.10.9

参考にした記事
https://github.com/google/mediapipe/issues/5168

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?