Using an Alternative Model Path
Model Lookup Order
Section titled “Model Lookup Order”When --landmark-model is omitted, Morphace looks for the model in this
order:
- The path set in
MORPHACE_LANDMARK_MODEL. - The application data directory.
Use a Model Path for One Command
Section titled “Use a Model Path for One Command”To use a model file in a custom location, pass its path with
--landmark-model:
morphace morph \ first_image.png \ second_image.png \ --landmark-model ./model/shape_predictor_68_face_landmarks_GTX.datThe --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.
Set a Model Path for Repeated Use
Section titled “Set a Model Path for Repeated Use”The MORPHACE_LANDMARK_MODEL environment variable applies to future
commands in the same shell environment.
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:
morphace morph \ first_image.png \ second_image.pngDefault Model Directory
Section titled “Default Model Directory”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.
Why Use an Alternative Model Path?
Section titled “Why Use an Alternative Model Path?”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.