GetModel
- class lib.utils.GetModel(model_filename: str | list[str], git_model_id: int)
Bases:
objectCheck for models in the cache path.
If available, return the path, if not available, get, unzip and install model
- Parameters:
model_filename (str | list[str]) – The name of the model to be loaded (see notes below)
git_model_id (int) – The second digit in the github tag that identifies this model. See https://github.com/deepfakes-models/faceswap-models for more information
Notes
Models must have a certain naming convention: <model_name>_v<version_number>.<extension> (eg: s3fd_v1.pb).
Multiple models can exist within the model_filename. They should be passed as a list and follow the same naming convention as above. Any differences in filename should occur AFTER the version number: <model_name>_v<version_number><differentiating_information>.<extension> (eg: [“mtcnn_det_v1.1.py”, “mtcnn_det_v1.2.py”, “mtcnn_det_v1.3.py”], [“resnet_ssd_v1.caffemodel” ,”resnet_ssd_v1.prototext”]
Example
>>> from lib.utils import GetModel >>> model_downloader = GetModel("s3fd_keras_v2.h5", 11)
Attributes Summary
The model path(s) in the cache folder.
Attributes Documentation
- model_path
The model path(s) in the cache folder.
Example
>>> from lib.utils import GetModel >>> model_downloader = GetModel("s3fd_keras_v2.h5", 11) >>> model_downloader.model_path '/path/to/s3fd_keras_v2.h5'
- property model_path: str | list[str]
The model path(s) in the cache folder.
Example
>>> from lib.utils import GetModel >>> model_downloader = GetModel("s3fd_keras_v2.h5", 11) >>> model_downloader.model_path '/path/to/s3fd_keras_v2.h5'