Skip to content

Commit 721de78

Browse files
committed
Fix variable name for gender/age model in configuration files and add hash validation for downloads without expected hash
1 parent 62ca3d8 commit 721de78

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎compose/cpu.env‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ COMPOSE_PROJECT_NAME=insightface-rest
22
IFR_VERSION=v0.8.4.0
33
DET_NAME=yolov5l-face
44
REC_NAME=w600k_r50
5-
GA_MODEL=None
5+
GA_NAME=None
66
MASK_DETECTOR=None
77
REC_BATCH_SIZE=1
88
DET_BATCH_SIZE=1

‎compose/example.env‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ DET_NAME=yolov5l-face
1515
REC_NAME=w600k_r50
1616

1717
# Gender/Age Model (None to disable, or 'genderage_v1')
18-
GA_MODEL=None
18+
GA_NAME=None
1919

2020
# Face Mask Detection Model (None to disable, or 'mask_detector*')
2121
MASK_DETECTOR=None

‎if_rest/core/utils/download_google.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ def check_hash(filename, hash, algo='md5'):
2727
'sha256': hashlib.sha256,
2828
'sha512': hashlib.sha512,
2929
}
30+
# No expected hash provided (e.g. models.json entry without an 'md5' field):
31+
# nothing to verify against, so treat the download as valid.
32+
if not hash:
33+
return True
34+
3035
hasher = algos[algo]()
3136
with open(filename, 'rb') as f:
3237
while True:

0 commit comments

Comments
 (0)