# Steps of setting mediapipe model path
## Step 1. Get the MediaPipe package path
Create a python cmd
```python=
import mediapipe as mp
import os
MP_PATH = os.path.dirname(mp.__file__)
MP_PATH.replace('\\', '/')
```
## Step 2. Go to MediaPipe package folder
進入```MP_PATH/python/solutions/```,這個資料夾裡面控制了MP所有ML model的路徑
以修改mediapipe的holistic model為例,總共有三個檔案路徑
holistic.py,line 52~63,
```python=52
_BINARYPB_FILE_PATH = 'mediapipe/modules/holistic_landmark/holistic_landmark_cpu.binarypb'
def _download_oss_pose_landmark_model(model_complexity):
"""Downloads the pose landmark lite/heavy model from the MediaPipe Github repo if it doesn't exist in the package."""
if model_complexity == 0:
download_utils.download_oss_model(
'mediapipe/modules/pose_landmark/pose_landmark_lite.tflite')
elif model_complexity == 2:
download_utils.download_oss_model(
'mediapipe/modules/pose_landmark/pose_landmark_heavy.tflite')
```
修改以上路徑到你設定的路徑, E.g.,
```python=52
_BINARYPB_FILE_PATH = 'path-to-the-model-structure'
def _download_oss_pose_landmark_model(model_complexity):
"""Downloads the pose landmark lite/heavy model from the MediaPipe Github repo if it doesn't exist in the package."""
if model_complexity == 0:
download_utils.download_oss_model(
'path-to-the-model-weights-1')
elif model_complexity == 2:
download_utils.download_oss_model(
'path-to-the-model-weights-2')
```
## Step 3. Relocate MP model
進入```MP_PATH/modules```,如果model有被下載過,裡面會有.pb或.tflite的檔案。
建議複製整個資料夾到你指定的路徑, E.g., ```holistic_landmark```
