2025-03-26 11:55:56 +09:00
|
|
|
import argparse
|
2025-11-25 23:19:45 +09:00
|
|
|
|
ref: Add comprehensive test suite and enhance model functionality
- Add new test files for age_gender, factory, landmark, recognition, scrfd, and utils
- Add new scripts for age_gender, landmarks, and video detection
- Update documentation in README.md, MODELS.md, QUICKSTART.md
- Improve model constants and face utilities
- Update detection models (retinaface, scrfd) with enhanced functionality
- Update project configuration in pyproject.toml
2025-11-15 21:09:37 +09:00
|
|
|
from uniface.constants import (
|
2025-11-25 23:19:45 +09:00
|
|
|
AgeGenderWeights,
|
|
|
|
|
ArcFaceWeights,
|
|
|
|
|
DDAMFNWeights,
|
|
|
|
|
LandmarkWeights,
|
|
|
|
|
MobileFaceWeights,
|
|
|
|
|
RetinaFaceWeights,
|
|
|
|
|
SCRFDWeights,
|
|
|
|
|
SphereFaceWeights,
|
ref: Add comprehensive test suite and enhance model functionality
- Add new test files for age_gender, factory, landmark, recognition, scrfd, and utils
- Add new scripts for age_gender, landmarks, and video detection
- Update documentation in README.md, MODELS.md, QUICKSTART.md
- Improve model constants and face utilities
- Update detection models (retinaface, scrfd) with enhanced functionality
- Update project configuration in pyproject.toml
2025-11-15 21:09:37 +09:00
|
|
|
)
|
2025-03-26 11:55:56 +09:00
|
|
|
from uniface.model_store import verify_model_weights
|
|
|
|
|
|
2025-11-25 23:19:45 +09:00
|
|
|
MODEL_TYPES = {
|
2025-11-30 20:32:07 +09:00
|
|
|
'retinaface': RetinaFaceWeights,
|
|
|
|
|
'sphereface': SphereFaceWeights,
|
|
|
|
|
'mobileface': MobileFaceWeights,
|
|
|
|
|
'arcface': ArcFaceWeights,
|
|
|
|
|
'scrfd': SCRFDWeights,
|
|
|
|
|
'ddamfn': DDAMFNWeights,
|
|
|
|
|
'agegender': AgeGenderWeights,
|
|
|
|
|
'landmark': LandmarkWeights,
|
ref: Add comprehensive test suite and enhance model functionality
- Add new test files for age_gender, factory, landmark, recognition, scrfd, and utils
- Add new scripts for age_gender, landmarks, and video detection
- Update documentation in README.md, MODELS.md, QUICKSTART.md
- Improve model constants and face utilities
- Update detection models (retinaface, scrfd) with enhanced functionality
- Update project configuration in pyproject.toml
2025-11-15 21:09:37 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-11-25 23:19:45 +09:00
|
|
|
def download_models(model_enum):
|
|
|
|
|
for weight in model_enum:
|
2025-11-30 20:32:07 +09:00
|
|
|
print(f'Downloading: {weight.value}')
|
2025-11-25 23:19:45 +09:00
|
|
|
try:
|
|
|
|
|
verify_model_weights(weight)
|
2025-11-30 20:32:07 +09:00
|
|
|
print(f' Done: {weight.value}')
|
2025-11-25 23:19:45 +09:00
|
|
|
except Exception as e:
|
2025-11-30 20:32:07 +09:00
|
|
|
print(f' Failed: {e}')
|
2025-11-25 23:19:45 +09:00
|
|
|
|
|
|
|
|
|
2025-03-26 11:55:56 +09:00
|
|
|
def main():
|
2025-11-30 20:32:07 +09:00
|
|
|
parser = argparse.ArgumentParser(description='Download model weights')
|
ref: Add comprehensive test suite and enhance model functionality
- Add new test files for age_gender, factory, landmark, recognition, scrfd, and utils
- Add new scripts for age_gender, landmarks, and video detection
- Update documentation in README.md, MODELS.md, QUICKSTART.md
- Improve model constants and face utilities
- Update detection models (retinaface, scrfd) with enhanced functionality
- Update project configuration in pyproject.toml
2025-11-15 21:09:37 +09:00
|
|
|
parser.add_argument(
|
2025-11-30 20:32:07 +09:00
|
|
|
'--model-type',
|
ref: Add comprehensive test suite and enhance model functionality
- Add new test files for age_gender, factory, landmark, recognition, scrfd, and utils
- Add new scripts for age_gender, landmarks, and video detection
- Update documentation in README.md, MODELS.md, QUICKSTART.md
- Improve model constants and face utilities
- Update detection models (retinaface, scrfd) with enhanced functionality
- Update project configuration in pyproject.toml
2025-11-15 21:09:37 +09:00
|
|
|
type=str,
|
2025-11-25 23:19:45 +09:00
|
|
|
choices=list(MODEL_TYPES.keys()),
|
2025-11-30 20:32:07 +09:00
|
|
|
help='Model type to download. If not specified, downloads all.',
|
2025-03-26 11:55:56 +09:00
|
|
|
)
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
ref: Add comprehensive test suite and enhance model functionality
- Add new test files for age_gender, factory, landmark, recognition, scrfd, and utils
- Add new scripts for age_gender, landmarks, and video detection
- Update documentation in README.md, MODELS.md, QUICKSTART.md
- Improve model constants and face utilities
- Update detection models (retinaface, scrfd) with enhanced functionality
- Update project configuration in pyproject.toml
2025-11-15 21:09:37 +09:00
|
|
|
if args.model_type:
|
2025-11-30 20:32:07 +09:00
|
|
|
print(f'Downloading {args.model_type} models...')
|
2025-11-25 23:19:45 +09:00
|
|
|
download_models(MODEL_TYPES[args.model_type])
|
2025-03-26 11:55:56 +09:00
|
|
|
else:
|
2025-11-30 20:32:07 +09:00
|
|
|
print('Downloading all models...')
|
2025-11-25 23:19:45 +09:00
|
|
|
for name, model_enum in MODEL_TYPES.items():
|
2025-11-30 20:32:07 +09:00
|
|
|
print(f'\n{name}:')
|
2025-11-25 23:19:45 +09:00
|
|
|
download_models(model_enum)
|
2025-03-26 11:55:56 +09:00
|
|
|
|
2025-11-30 20:32:07 +09:00
|
|
|
print('\nDone!')
|
2025-03-26 11:55:56 +09:00
|
|
|
|
|
|
|
|
|
2025-11-30 20:32:07 +09:00
|
|
|
if __name__ == '__main__':
|
2025-03-26 11:55:56 +09:00
|
|
|
main()
|