Skip to content

Using an Alternative Model Path

When --landmark-model is omitted, Morphace looks for the model in this order:

  1. The path set in MORPHACE_LANDMARK_MODEL.
  2. The application data directory.

To use a model file in a custom location, pass its path with --landmark-model:

Terminal window
morphace morph \
first_image.png \
second_image.png \
--landmark-model ./model/shape_predictor_68_face_landmarks_GTX.dat

The --landmark-model option only affects the command where you use it.

The same option can be used with any command that require the landmark model.

The MORPHACE_LANDMARK_MODEL environment variable applies to future commands in the same shell environment.

Terminal window
export MORPHACE_LANDMARK_MODEL="$PWD/model/shape_predictor_68_face_landmarks_GTX.dat"

After setting this variable, you can run Morphace without passing --landmark-model each time:

Terminal window
morphace morph \
first_image.png \
second_image.png

If you download the model file manually, extract it and place shape_predictor_68_face_landmarks_GTX.dat in the appropriate directory for your operating system.

Use an alternative model path if you want to:

  • Keep the model file inside a project directory.
  • Share one model file across multiple environments.
  • Store large model files on a specific drive or mounted volume.
  • Manage the model file yourself instead of using morphace download.