Skip to content

Commit

Permalink
add face recognition
Browse files Browse the repository at this point in the history
  • Loading branch information
pliablepixels committed Apr 2, 2021
1 parent 5591cc4 commit 547b0e8
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
8 changes: 8 additions & 0 deletions docs/guides/breaking.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Breaking Changes
----------------

Version 6.1.18 onwards
~~~~~~~~~~~~~~~~~~~~~~~
- I now support face detection using TPU (NOT recognition). See objectconfig.ini for an example
- You can now add descriptive names for each model sequence to better differentiate in logs
- Each model sequence now has an ``enabled`` flag (default is ``yes``). If ``no`` that means the model won't be loaded. This is a good way
to temporarily remove models while keeping config files intact
- We now also have a ``same_model_strategy`` value of ``union`` - when set to ``union`` it will combine detection from all models for that type

Version 6.1.17 onwards
~~~~~~~~~~~~~~~~~~~~~~~
- You can now localize ``past_det_max_diff_area``, ``max_detection_size`` to specific objects
Expand Down
20 changes: 18 additions & 2 deletions hook/objectconfig.ini
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ ml_sequence= {
},
'sequence': [{
#First run on TPU with higher confidence
'name': 'TPU object detection',
'enabled': 'no',
'object_weights':'{{tpu_object_weights_mobiledet}}',
'object_labels': '{{tpu_object_labels}}',
'object_min_confidence': {{tpu_min_confidence}},
Expand All @@ -423,6 +425,8 @@ ml_sequence= {
},
{
# YoloV4 on GPU if TPU fails (because sequence strategy is 'first')
'name': 'YoloV4 GPU/CPU',
'enabled': 'yes', # don't really need to say this explictly
'object_config':'{{yolo4_object_config}}',
'object_weights':'{{yolo4_object_weights}}',
'object_labels': '{{yolo4_object_labels}}',
Expand All @@ -440,9 +444,11 @@ ml_sequence= {
'face': {
'general':{
'pattern': '{{face_detection_pattern}}',
'same_model_sequence_strategy': 'first'
'same_model_sequence_strategy': 'union'
},
'sequence': [{
'name': 'DLIB based face recognition',
'enabled': 'yes',
'save_unknown_faces':'{{save_unknown_faces}}',
'save_unknown_faces_leeway_pixels':{{save_unknown_faces_leeway_pixels}},
'face_detection_framework': '{{face_detection_framework}}',
Expand All @@ -458,7 +464,15 @@ ml_sequence= {
'cpu_max_processes': {{cpu_max_processes}},
'cpu_max_lock_wait': {{cpu_max_lock_wait}},
'max_size':800
}]
},
{
'name': 'TPU face detection',
'enabled': 'no',
'face_detection_framework': 'tpu',
'face_weights':'/var/lib/zmeventnotification/models/coral_edgetpu/ssd_mobilenet_v2_face_quant_postprocess_edgetpu.tflite',
'face_min_confidence': 0.3,

}]
},

'alpr': {
Expand All @@ -469,6 +483,8 @@ ml_sequence= {

},
'sequence': [{
'name': 'Platerecognizer cloud',
'enabled': 'yes',
'alpr_api_type': '{{alpr_api_type}}',
'alpr_service': '{{alpr_service}}',
'alpr_key': '{{alpr_key}}',
Expand Down
2 changes: 1 addition & 1 deletion hook/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
LICENSE = 'GPL'
INSTALL_REQUIRES = [
'numpy', 'requests', 'Shapely', 'imutils',
'pyzm>=0.3.41', 'scikit-learn', 'future', 'imageio',
'pyzm>=0.3.42', 'scikit-learn', 'future', 'imageio',
'imageio-ffmpeg','pygifsicle', 'Pillow'
]

Expand Down
4 changes: 3 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,12 @@ install_hook() {


echo 'Checking for Google Coral Edge TPU data files...'
targets=( 'coco_indexed.names' 'ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite' 'ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite')
targets=( 'coco_indexed.names' 'ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite' 'ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite' 'ssd_mobilenet_v2_face_quant_postprocess_edgetpu.tflite')
sources=('https://dl.google.com/coral/canned_models/coco_labels.txt'
'https://github.com/google-coral/edgetpu/raw/master/test_data/ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite'
'https://github.com/google-coral/test_data/raw/master/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite'
'https://github.com/google-coral/test_data/raw/master/ssd_mobilenet_v2_face_quant_postprocess_edgetpu.tflite'

)

for ((i=0;i<${#targets[@]};++i))
Expand Down

0 comments on commit 547b0e8

Please sign in to comment.