# mediapipe-python-sample **Repository Path**: juneral/mediapipe-python-sample ## Basic Information - **Project Name**: mediapipe-python-sample - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-06-29 - **Last Updated**: 2021-10-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # mediapipe-python-sample [MediaPipe](https://github.com/google/mediapipe)のPythonパッケージのサンプルです。
2021/06/04時点でPython実装のある以下7機能について用意しています。 * [Hands](https://google.github.io/mediapipe/solutions/hands)
![suwkm-avmbx](https://user-images.githubusercontent.com/37477845/101514487-a59d8500-39c0-11eb-8346-d3c9ab917ea6.gif)
* [Pose](https://google.github.io/mediapipe/solutions/pose)
![z9e49-wa894](https://user-images.githubusercontent.com/37477845/101512555-7ab23180-39be-11eb-814c-9fad59e0cf9a.gif)
* [Face Mesh](https://google.github.io/mediapipe/solutions/face_mesh)
![8w6n9-lavib](https://user-images.githubusercontent.com/37477845/101512592-869df380-39be-11eb-8a80-241e272cc195.gif)
* [Holistic](https://google.github.io/mediapipe/solutions/holistic)
![4xbuq-2o9kx](https://user-images.githubusercontent.com/37477845/101908209-1336f480-3bff-11eb-9f3f-5a3055821ebd.gif)
* [Face Detection](https://google.github.io/mediapipe/solutions/face_detection)
![12-01 MediaPipeFaceDetection](https://user-images.githubusercontent.com/37477845/109686899-0e625b00-7bc6-11eb-991e-7fbecfb841cf.gif)
* [Objectron](https://google.github.io/mediapipe/solutions/objectron)
![12-03 MediaPipeObjectron](https://user-images.githubusercontent.com/37477845/109686979-25a14880-7bc6-11eb-8290-4e87968f6044.gif) * [Selfie Segmentation](https://google.github.io/mediapipe/solutions/selfie_segmentation)
![06-04 MediaPipeSelfieSegmentation](https://user-images.githubusercontent.com/37477845/120812014-8f473f00-c587-11eb-8ac8-944c25c2f264.gif) # Requirement * mediapipe 0.8.5 or later * OpenCV 3.4.2 or later mediapipeはpipでインストールできます。 ```bash pip install mediapipe ``` # Demo デモの実行方法は以下です。 #### Face Mesh ```bash python sample_facemesh.py ``` * --device
カメラデバイス番号の指定
デフォルト:0 * --width
カメラキャプチャ時の横幅
デフォルト:960 * --height
カメラキャプチャ時の縦幅
デフォルト:540 * --max_num_hands
最大手検出数
デフォルト:1 * --min_detection_confidence
検出信頼値の閾値
デフォルト:0.5 * --min_tracking_confidence
トラッキング信頼値の閾値
デフォルト:0.5 * --use_brect
外接矩形を描画するか否か
デフォルト:指定なし #### Hands ```bash python sample_hand.py ``` * --device
カメラデバイス番号の指定
デフォルト:0 * --width
カメラキャプチャ時の横幅
デフォルト:960 * --height
カメラキャプチャ時の縦幅
デフォルト:540 * --max_num_faces
最大顔検出数
デフォルト:1 * --min_detection_confidence
検出信頼値の閾値
デフォルト:0.7 * --min_tracking_confidence
トラッキング信頼値の閾値
デフォルト:0.5 * --use_brect
外接矩形を描画するか否か
デフォルト:指定なし #### Pose ```bash python sample_pose.py ``` * --device
カメラデバイス番号の指定
デフォルト:0 * --width
カメラキャプチャ時の横幅
デフォルト:960 * --height
カメラキャプチャ時の縦幅
デフォルト:540 * --model_complexity
モデルの複雑度(0:Lite 1:Full 2:Heavy)
※性能差は[Pose Estimation Quality](https://google.github.io/mediapipe/solutions/pose#pose-estimation-quality)を参照ください
デフォルト:1 * --min_detection_confidence
検出信頼値の閾値
デフォルト:0.5 * --min_tracking_confidence
トラッキング信頼値の閾値
デフォルト:0.5 * --use_brect
外接矩形を描画するか否か
デフォルト:指定なし #### Holistic ```bash python sample_holistic.py ``` * --device
カメラデバイス番号の指定
デフォルト:0 * --width
カメラキャプチャ時の横幅
デフォルト:960 * --height
カメラキャプチャ時の縦幅
デフォルト:540 * --model_complexity
モデルの複雑度(0:Lite 1:Full 2:Heavy)
※性能差は[Pose Estimation Quality](https://google.github.io/mediapipe/solutions/pose#pose-estimation-quality)を参照ください
デフォルト:1 * --min_detection_confidence
検出信頼値の閾値
デフォルト:0.5 * --min_tracking_confidence
トラッキング信頼値の閾値
デフォルト:0.5 * --use_brect
外接矩形を描画するか否か
デフォルト:指定なし #### Face Detection ```bash python sample_facedetection.py ``` * --device
カメラデバイス番号の指定
デフォルト:0 * --width
カメラキャプチャ時の横幅
デフォルト:960 * --height
カメラキャプチャ時の縦幅
デフォルト:540 * --min_detection_confidence
検出信頼値の閾値
デフォルト:0.5 #### Objectron ```bash python sample_objectron.py ``` * --device
カメラデバイス番号の指定
デフォルト:0 * --width
カメラキャプチャ時の横幅
デフォルト:960 * --height
カメラキャプチャ時の縦幅
デフォルト:540 * --static_image_mode
静止画像モード ※トラッキング無し
デフォルト:指定なし * --min_detection_confidence
検出信頼値の閾値
デフォルト:0.5 * --min_tracking_confidence
トラッキング信頼値の閾値
デフォルト:0.99 * --model_name
検出対象(20201/03/03時点:'Shoe', 'Chair', 'Cup', 'Camera'の4種類)
デフォルト:Cup #### Selfie Segmentation ```bash python sample_selfie_segmentation ``` * --device
カメラデバイス番号の指定
デフォルト:0 * --width
カメラキャプチャ時の横幅
デフォルト:960 * --height
カメラキャプチャ時の縦幅
デフォルト:540 * --model_selection
モデル種類指定
0:Generalモデル(256x256x1 出力)
1:Landscapeモデル(144x256x1 出力)
デフォルト:0 * --score_th
スコア閾値(閾値以上:人間、閾値未満:背景)
デフォルト:0.1 * --bg_path
背景画像格納パス ※未指定時はグリーンバック
デフォルト:None # For Raspberry Pi 以下のRaspberry Pi向けビルドを利用することで、Raspberry Pi上で本サンプルを試すことが出来ます。 * [Raspberry Piで手軽にMediaPipeを楽しむ方法](https://zenn.dev/karaage0703/articles/63fed2a261096d) * [PINTO0309/mediapipe-bin](https://github.com/PINTO0309/mediapipe-bin)
# ToDo - [x] ~~[Holistic](https://google.github.io/mediapipe/solutions/holistic)のサンプル追加 (mediapipe 0.8.1)~~ - [x] ~~Poseのz座標表示を追加 (mediapipe 0.8.3)~~ - [x] ~~[Face Detection](https://google.github.io/mediapipe/solutions/face_detection)のサンプル追加 (mediapipe 0.8.3)~~ - [x] ~~[Objectron](https://google.github.io/mediapipe/solutions/objectron)のサンプル追加 (mediapipe 0.8.3)~~ # Reference * [MediaPipe](https://github.com/google/mediapipe) # Author 高橋かずひと(https://twitter.com/KzhtTkhs) # License mediapipe-python-sample is under [Apache-2.0 License](LICENSE). また、女性の画像、および背景画像は[フリー素材ぱくたそ](https://www.pakutaso.com)様の写真を利用しています。