# ============================================================================== # FindFace Security configuration file # ============================================================================== # # This config file is written in Python's syntax and interpreted at FindFace Security # service startup. You have to restart the service in order to apply changes. # # If you have any questions or suggestions, please contact us at support@ntechlab.com # ============================================================================== # GENERAL SETTINGS # ============================================================================== # enables additional logs DEBUG = False # media files directory MEDIA_ROOT = "/var/lib/findface-security/uploads" # static files directory STATIC_ROOT = "/var/lib/findface-security/static" # language code LANGUAGE_CODE = 'en-us' # time zone TIME_ZONE = 'UTC' # Database is used by FindFace Security to store cameras, # camera groups, watchlists and so on. Only PostgreSQL is supported. DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'DISABLE_SERVER_SIDE_CURSORS': True, 'NAME': 'ffsecurity', 'PORT': 5439, 'USER': 'ntech', 'PASSWORD': 'ItMyot3J4YOauf2946KiG9ul5SWAKBtz', } } # Signature key for session encryption # Use pwgen -sncy 50 1|tr "'" "." to generate your own unique key SECRET_KEY = 'e6dbe9fb25162b88b30389a714f1f13b' # ============================================================================== # FINDFACE SECURITY SETTINGS # ============================================================================== # SERVICE_EXTERNAL_ADDRESS is prioritized for FFSecurity webhooks and Genetec plugin. # EXTERNAL_ADDRESS is used instead if SERVICE_EXTERNAL_ADDRESS is not provided. # You must provide either SERVICE_EXTERNAL_ADDRESS or EXTERNAL_ADDRESS in order # to be able to work with FFSecurity webhooks and Genetec plugin. SERVICE_EXTERNAL_ADDRESS = 'http://172.20.127.113' # EXTERNAL_ADDRESS is used to access objects created inside FFSecurity via external links. EXTERNAL_ADDRESS = '' # - Base FFSecurity settings - # enable permissions system ENABLE_ACL = True FFSECURITY = { # findface-video-worker authorization token 'VIDEO_DETECTOR_TOKEN': 'ab7c0ed611917e22f1f88db57567f5d6', # optional objects to detect 'ENABLE_CARS': False, 'ENABLE_BODIES': False, # base face matching confidence threshold 'FACE_CONFIDENCE_THRESHOLD': 0.723, # model: [kiwi_320] # base body matching confidence threshold 'BODY_CONFIDENCE_THRESHOLD': 0.65, # model: [andariel] # base car matching confidence threshold 'CAR_CONFIDENCE_THRESHOLD': 0.65, # model: [alonso] # episodes specific matching threshold that is used to join faces in an episode 'EPISODES_THRESHOLD': 0.688, # FAR = 1.00E-06 # model: [kiwi_320] # minimum confidence for license plate number, country and region identification 'MIN_CAR_LICENSE_PLATE_CONFIDENCE': 0.2, # model: [carattr.license_plate.v0] # NOTE. quality settings below do not apply to new events, # change video manager job's `filter_min_quality` (camera setting) to filter events # minimum face quality sufficient to add it to a dossier and use object in counter 'MINIMUM_FACE_QUALITY': 0.45, # model: [quality.v1] # minimum body quality sufficient to add it to a dossier and use object in counter 'MINIMUM_BODY_QUALITY': 0.6, # model: [pedattr.quality.v0] # minimum car quality sufficient to add it to a dossier and use object in counter 'MINIMUM_CAR_QUALITY': 0.65, # model: [carattr.quality.v0] # use additional features for extra confidence when matching cars by emben 'EXTRA_CAR_MATCHING': { 'color': {'enabled': False, 'min_confidence': 0}, 'body': {'enabled': False, 'min_confidence': 0}, 'make': {'enabled': False, 'min_confidence': 0}, 'model': {'enabled': False, 'min_confidence': 0}, }, # do not save unmatched events (GDPR support) 'IGNORE_UNMATCHED': False, # blur all unmatched objects on the full frame of the matched event (GDPR support) 'BLUR_UNMATCHED_OBJECTS': False, # full frame jpeg quality when `BLUR_UNMATCHED_OBJECTS` is enabled 'BLURRED_FULLFRAME_JPEG_QUALITY': 85, # matched face events older than EVENTS_MAX_MATCHED_AGE will be automatically # deleted (every night at 1:17 am by default) 'FACE_EVENTS_MAX_MATCHED_AGE': 30, # same as above but for unmatched face events 'FACE_EVENTS_MAX_UNMATCHED_AGE': 30, # same as EVENTS_MAX_MATCHED_AGE but for matched full frame face images only (thumbnails won't be deleted) 'FACE_EVENTS_MAX_FULLFRAME_MATCHED_AGE': 30, # same as above but for unmatched full frame face images only (thumbnails won't be deleted) 'FACE_EVENTS_MAX_FULLFRAME_UNMATCHED_AGE': 30, # same as above but for car events 'CAR_EVENTS_MAX_MATCHED_AGE': 30, 'CAR_EVENTS_MAX_UNMATCHED_AGE': 30, 'CAR_EVENTS_MAX_FULLFRAME_MATCHED_AGE': 30, 'CAR_EVENTS_MAX_FULLFRAME_UNMATCHED_AGE': 30, # same as above but for body events 'BODY_EVENTS_MAX_MATCHED_AGE': 30, 'BODY_EVENTS_MAX_UNMATCHED_AGE': 30, 'BODY_EVENTS_MAX_FULLFRAME_MATCHED_AGE': 30, 'BODY_EVENTS_MAX_FULLFRAME_UNMATCHED_AGE': 30, # same as above but for counter records 'COUNTER_RECORDS_MAX_AGE': 30, # required percentage of bbox intersection with ROI 'COUNTERS_ROI_INTERSECTION_THRESHOLD': 0.75, # same as above but for person events (if no person events left in person, it is deleted too) 'PERSON_EVENTS_MAX_AGE': 90, # same as above but for audit logs 'AUDIT_LOGS_MAX_AGE': 0, # when closing episode, delete all events except the best episode event 'EPISODE_KEEP_ONLY_BEST_EVENT': False, # NTLS licence server url 'NTLS_HTTP_URL': 'http://127.0.0.1:3185', # findface-video-worker face posting address, # it must be set to either FFSecurity EXTERNAL_ADDRESS (by default) # or findface-facerouter url (in some specific cases) 'ROUTER_URL': 'http://127.0.0.1', # send serialized dossiers, dossier-lists, camera and camera groups in webhooks 'VERBOSE_WEBHOOKS': False, # jpeg quality used when saving thumbnails 'THUMBNAIL_JPEG_QUALITY': 75, # FFServer services urls 'VIDEO_MANAGER_ADDRESS': 'http://127.0.0.1:18810', 'SF_API_ADDRESS': 'http://127.0.0.1:18411', 'FFCOUNTER_ADDRESS': 'http://127.0.0.1:18300', 'LIVENESS_API_ADDRESS': 'http://127.0.0.1:18301', # upload video archives to this path, it differs from media root and # you have to change alias in corresponding nginx location also (/videos/) 'VIDEO_ARCHIVE_UPLOAD_PATH': '/var/lib/findface-security/uploads/videos/', # additional events features # make sure that corresponding extractors are licensed # and enabled at findface-extraction-api config file # available features: gender, age, emotions, beard, glasses, medmask 'FACE_EVENTS_FEATURES': [], # available features: color 'BODY_EVENTS_FEATURES': [], # available features are: description, license_plate 'CAR_EVENTS_FEATURES': [], # feature specific confidence thresholds 'LIVENESS_THRESHOLD': 0.85, # model: [liveness.alleyn.v2] 'EMOTIONS_THRESHOLD': 0.25, # model: [emotions.v1] 'BEARD_THRESHOLD': 0.7, # model: [beard.v0] # counters full frame saving options: # `always` - save always # `detect` - save only if faces or silhouettes have been detected # `never` - never save full frames 'COUNTERS_SAVE_FULLFRAME': 'always', 'COUNTERS_FULLFRAME_JPEG_QUALITY': 75, 'COUNTERS_THUMBNAIL_JPEG_QUALITY': 75, # max camera frames_dropped percent 'MAX_CAMERA_DROPPED_FRAMES': {'yellow': 0.1, 'red': 0.3}, # max camera faces_failed percent 'MAX_CAMERA_FAILED_FACES': {'yellow': 0.1, 'red': 0.3}, # -- Persons configuration -- # rrule (recurrence rule) for scheduling persons clusterization # WARNING: all scheduling works with UTC time and NOT aware of any timezone 'PERSONS_CLUSTERIZATION_SCHEDULE': 'RRULE:FREQ=DAILY;INTERVAL=1;WKST=MO;BYHOUR=0;BYMINUTE=0', # face to person matching confidence threshold 'PERSONS_CONFIDENCE_THRESHOLD': 0.723, # model: [kiwi_320] # minimum required face quality for person creation 'PERSON_EVENT_MIN_QUALITY': 0.45, # model: [quality.v1] # minimum required number events in episode for person creation 'PERSON_EVENT_MIN_EPISODE_EVENTS': 1, # pin persons with matched events 'PIN_MATCHED_PERSONS': False, # maximum concurrent video manager jobs for video archives processing 'MAX_VIDEO_ARCHIVE_JOBS': 3, # reports image saving options 'REPORT_THUMBNAIL_JPEG_QUALITY': 75, 'REPORT_THUMBNAIL_MAX_HEIGHT': 100, 'REPORT_FULLFRAME_JPEG_QUALITY': 75, 'REPORT_FULLFRAME_MAX_HEIGHT': 250, # authorization token for POST /events/{face, car, body}/add 'EVENTS_CREATION_API_TOKEN': 'GOOD_TOKEN', # -- Startup tests -- # required services availability test 'SERVICES_AVAILABILITY_TEST': True, # enable saving audit logs to PostgresSQL 'ENABLE_AUDIT_LOGS': True, # -- FFSecurity Onvif -- # auth credentials for ffsecurity_onvif # ONVIF_CREDENTIALS = [ # { # "hostnames": ["192.168.1.64", "2a00:1370:8117:ab87:a614:37ff:fe49:2683"], # "login": "admin", # "password": "admin123" # } # ], 'ONVIF_CREDENTIALS': {}, # list of all hostnames that will be ignored during Onvif service discovery # ONVIF_IGNORE_LIST = ["192.168.1.217"], 'ONVIF_IGNORE_LIST': [], # -- Optional parameters -- # Edit CUSTOM_FIELDS->dossier_meta section to customize dossier content. # Below is an example for integration FindFace Security with Sigur. # Edit CUSTOM_FIELDS->face_object section to customize face object content. # Below is an example with every field type possible. # 'CUSTOM_FIELDS': { # 'dossier_meta': { # 'items': [ # { # 'name': 'personid', # 'default': '', # 'label': 'PersonID', # 'display': ['list', 'form'], # 'description': 'Sigur person ID' # }, # { # 'name': 'firstname', # 'default': '', # 'label': 'First Name', # 'display': ['list', 'form'], # 'description': 'Sigur first name' # }, # { # 'name': 'lastname', # 'default': '', # 'label': 'Last Name', # 'display': ['list', 'form'], # 'description': 'Sigur last name' # }, # { # 'name': 'version', # 'default': '', # 'label': 'Version', # 'display': ['list', 'form'], # 'description': 'Sigur photo version' # } # ], # 'filters': [ # { # 'name': 'personid', # 'label': 'Sigur person ID filter', # 'field': 'personid' # } # ] # }, # 'face_object': { # 'items': [ # { # "field_name": "tag_name_1", # "type": "string", # "default": "change_me" # }, # { # "field_name": "tag_name_2", # "type": "uint", # "default": 123 # }, # { # "field_name": "tag_name_3", # "type": "bool", # "default": True # }, # ] # } # }, # maximum event age in seconds than could be added to an episode. # 'EPISODE_SEARCH_INTERVAL': 60, # If none of these events matched, new episode is created. # maximum episode duration (episode is closed after) # 'EPISODE_MAX_DURATION': 300, # if no new event added to an episode during this timeout, episode will be closed. # 'EPISODE_EVENT_TIMEOUT': 30, # maximum created thumbnail width # 'THUMBNAIL_MAX_WIDTH': 320, # url of the backend which is used for social network search. # contact support for additional information. # 'SOCIAL_BACKEND': None, # additional social backend headers. # 'SOCIAL_HEADERS': {}, # unacknowledged events notification interval # 'UNACKNOWLEDGED_NOTIFY_INTERVAL': 1, # set to True to run all media requests (photos, attachments) through the # django application for acl checks. # enabling this setting slightly increases security but # has severe negative effects on performance. # you will also have to mark /uploads/ location as 'internal' in nginx config # # 'OVERPROTECT_MEDIA': False, } # - FindFace Security authorization configuration dictionary - FFSECURITY_AUTH_CONFIG = { # available options: face, password, face_and_password, face_or_password 'AUTH_TYPE': 'face_or_password', 'FACE_AUTH_CONFIDENCE': 0.723, # model: [kiwi_320] # 180 days by default 'MAXIMUM_SESSION_LENGTH': 15552000, 'NEED_SESSION_RENEW': False, 'RENEW_SESSION_INTERVAL': 0, 'MAXIMUM_RENEW_ATTEMPTS': 2, } # - FindFace Security user interface configuration dictionary - FFSECURITY_UI_CONFIG = { # Adjustable confidence threshold presets for objects matching. # Please consult with our support before changing. "objects": { "faces": { "features": { "f_gender_class": ["male", "female"], "age": { "f_age_gte": "", "f_age_lte": "" }, "f_emotions_class": ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"], "f_glasses_class": ["none", "eye", "sun"], "f_beard_class": ["none", "beard"], "f_liveness_class": ["real", "fake"], "f_medmask_class": ["none", "incorrect", "correct"], }, "confidence_display": [ {"confidence": 0.00, "color": "#000000", "label": {"ru": "Очень низкий", "en": "Very Low"}}, {"confidence": 0.65, "color": "#FF0300", "label": {"ru": "Низкий", "en": "Low"}}, {"confidence": 0.704, "color": "#FFB700", "label": {"ru": "Пониженный", "en": "Slightly Low"}}, {"confidence": 0.723, "color": "#B8FA00", "label": {"ru": "Нормальный", "en": "Moderate"}}, {"confidence": 0.75, "color": "#7EFF2B", "label": {"ru": "Повышенный", "en": "Slightly High"}}, {"confidence": 0.80, "color": "#4DFF60", "label": {"ru": "Высокий", "en": "High"}}, {"confidence": 0.85, "color": "#1DFF96", "label": {"ru": "Очень высокий", "en": "Very High"}}, ] }, "cars": { "features": { "f_color": [ "beige", "black", "blue", "brown", "cyan", "gold", "green", "grey", "orange", "pink", "purple", "red", "silver", "violet", "white", "yellow" ], "f_body": [ "suv", "sedan", "crossover", "convertible", "coupe", "wagon", "cab", "minibus", "minivan", "limousine" ], "f_make": [ "ac", "acura", "adler", "alfa_romeo", "alpina", "am_general", "amc", "aro", "asia", "aston_martin", "audi", "austin", "austin_healey", "avtokam", "baic", "bajaj", "bentley", "blakely", "bmw", "borgward", "bradley", "brilliance", "bugatti", "buick", "bus", "byd", "cadillac", "can_am", "chana", "changan", "changfeng", "changhe", "chery", "chevrolet", "chrysler", "citroen", "dacia", "dadi", "daewoo", "daihatsu", "daimler", "dallara", "datsun", "derways", "dkw", "dodge", "dongfeng", "doninvest", "ds", "dw_hower", "eagle", "excalibur", "faw", "ferrari", "fiat", "fisker", "ford", "foton", "gaz", "geely", "genesis", "geo", "gmc", "great_wall", "hafei", "haima", "hanomag", "haval", "hawtai", "holden", "honda", "horch", "huanghai", "hudson", "hummer", "hyundai", "ig", "infiniti", "international", "iran_khodro", "isuzu", "jac", "jaguar", "jeep", "jinbei", "jmc", "kamaz", "kia", "lamborghini", "lancia", "land_rover", "landwind", "lexus", "lifan", "lincoln", "lotus", "luaz", "luxgen", "mahindra", "maruti", "maserati", "maybach", "mazda", "mclaren", "mercedes", "mercury", "metrocab", "mg", "mini", "mitsubishi", "mitsuoka", "morgan", "morris", "moscvich", "nash", "nissan", "oldsmobile", "opel", "packard", "peugeot", "plymouth", "polaris", "pontiac", "porsche", "proton", "puch", "ram", "rambler", "ravon", "renault", "rimac", "rolls_royce", "rover", "saab", "samsung", "saturn", "scion", "seat", "shanghai_maple", "shuanghuan", "simca", "skoda", "smart", "smz", "spyker", "ssang_yong", "steyr", "studebaker", "subaru", "sunbeam", "suzuki", "tagaz", "talbot", "tata", "tatra", "tesla", "think", "tianma", "tianye", "toyota", "trabant", "triumph", "uaz", "vauxhall", "vaz", "volkswagen", "volvo", "vortex", "wanderer", "wartburg", "willis", "willys", "xinkai", "zaz", "zenvo", "zil", "zis", "zotye", "zx" ], "f_model": {"url": "/static/car_models.json"}, "f_license_plate_number": "", "f_license_plate_country": ["unknown", "RU", "AE"], "f_license_plate_region": ["unknown", "DXB", "SHJ", "ADH", "AJM", "UAK", "RAK", "FUJ"] }, "confidence_display": [ # model: [alonso] {"confidence": 0.00, "color": "#000000", "label": {"ru": "Очень низкий", "en": "Very Low"}}, {"confidence": 0.30, "color": "#FF0300", "label": {"ru": "Низкий", "en": "Low"}}, {"confidence": 0.45, "color": "#FFB700", "label": {"ru": "Пониженный", "en": "Slightly Low"}}, {"confidence": 0.65, "color": "#B8FA00", "label": {"ru": "Нормальный", "en": "Moderate"}}, {"confidence": 0.75, "color": "#7EFF2B", "label": {"ru": "Повышенный", "en": "Slightly High"}}, {"confidence": 0.85, "color": "#4DFF60", "label": {"ru": "Высокий", "en": "High"}}, {"confidence": 0.90, "color": "#1DFF96", "label": {"ru": "Очень высокий", "en": "Very High"}}, ] }, "bodies": { "features": { "f_top_color": [ "white", "black", "grey", "brown", "red", "orange", "yellow", "green", "lightblue", "blue", "purple", "pink", "beige" ], "f_bottom_color": [ "white", "black", "grey", "brown", "red", "orange", "yellow", "green", "lightblue", "blue", "purple", "pink", "beige" ], }, "confidence_display": [ # model: [andariel] {"confidence": 0.00, "color": "#000000", "label": {"ru": "Очень низкий", "en": "Very Low"}}, {"confidence": 0.50, "color": "#FF0300", "label": {"ru": "Низкий", "en": "Low"}}, {"confidence": 0.60, "color": "#FFB700", "label": {"ru": "Пониженный", "en": "Slightly Low"}}, {"confidence": 0.65, "color": "#B8FA00", "label": {"ru": "Нормальный", "en": "Moderate"}}, {"confidence": 0.80, "color": "#7EFF2B", "label": {"ru": "Повышенный", "en": "Slightly High"}}, {"confidence": 0.85, "color": "#4DFF60", "label": {"ru": "Высокий", "en": "High"}}, {"confidence": 0.90, "color": "#1DFF96", "label": {"ru": "Очень высокий", "en": "Very High"}}, ] } } } # -- ASGI-server configuration -- # consult support before changing these settings. # per worker thread pool size. ASGI_THREADS = 32 UVICORN_SETTINGS = { # worker processes count, 'auto' sets it to logical cpu count 'workers': 'auto', 'host': 'localhost', 'port': 8002, # websocket worker processes count, # 'auto' sets it to logical cpu count, but not more than 8. 'ws-workers': 'auto', 'ws-host': 'localhost', 'ws-port': 8003, } # disable unused services to increase # overall system performance in some cases. SERVICES = { "ffsecurity": { "episodes": True, "webhooks": True, # use queue manager to prevent drops of video archive events "video_archive_events_manager": True, "persons": False, } } # -- Other settings -- # The number of threads in the night clusterization. # Not recommended values are greater than the number of cores in the processor. # Consult with support before changing this value. NUMPY_OMP_NUM_THREADS = 'auto' # ============================================================================== # FINDFACE SECURITY PLUGINS # ============================================================================== # Uncomment lines below to enable plugins. Please consult documentation for # a plugin specific settings. # =============== Axxon ================ # INSTALLED_APPS.append('ffsecurity_axxon') # AXXON = [ # { # 'name': 'server_name', # 'api': 'http://example.com/', # 'rtsp': 'rtsp://example.com:554/', # 'user': 'user', # 'password': 'password', # } # ] # FFSECURITY_UI_CONFIG['dossier'] = { # 'video': True, # } # =============== Genetec ================ # INSTALLED_APPS.append('ffsecurity_genetec') # ================ Sigur ================= # keep in mind, that SIGUR plugin also uses CUSTOM_FIELDS and THUMBNAIL_MAX_WIDTH settings # INSTALLED_APPS.append('ffsecurity_sigur') # SIGUR = { # 'LOGIN': 'admin', # 'PASSWORD': 'admin', # 'MF_SELECTOR': 'biggest', # what to do with several faces in sigur person photo; allowed ['biggest', 'reject'] # 'ONLY_RT_EVENTS': True, # only events with bs_type == realtime, # 'EVENT_DELAY': 0.004 # minimum time between two events of same person in seconds. # If interval between two events with same person is less, than this value, second event will be dropped # } # ======= CryptoPRO authentication ======= # INSTALLED_APPS.append('ffsecurity_cproauth') # REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] = [ # 'ffsecurity.auth.TokenAuthentication', # 'ffsecurity_cproauth.auth.CryptoProOrTokenAuthentication' # ] # ========== DossierLists sync =========== # INSTALLED_APPS.append('ffsecurity_sync') # token must be identical on master and slave # use pwgen -s 64 1 # SYNC_TOKEN = 'change_me' # rrule that defines sync schedule # SYNC_SCHEDULE = 'RRULE:FREQ=DAILY;WKST=MO;BYHOUR=4;BYMINUTE=0' # if True synchronization will occur on FindFace Security startup and restart # SYNC_AT_STARTUP = False # if True synchronization will occur immediately after creating synchronization for dossier list # SYNC_AT_CREATION = False # ============== Puppeteer =============== # INSTALLED_APPS.append('ffsecurity_puppeteer') # PUPPETEER_CONFIG = { # 'UNSAVED_RESULTS_DELETION_TIMEOUT': 3600, # maximum lifetime of search results not saved involuntarily # 'REMOTE_MONITORING_SYNC_INTERVAL': 600, # monitoring data synchronization interval, seconds # 'ENABLE_DAILY_SEARCH': True, # daily search activation (default False) # 'DAILY_SEARCH_PUSH_HOUR': 2, # daily search dossiers synchronization hour # 'DAILY_SEARCH_PULL_HOUR': 6, # hour in which results of daily search will be obtained # 'puppets': [ # { # 'id': 'first_puppet', # puppet ID # 'url': 'http://1.1.1.1:8010/', # puppet URL # 'token': 'first_puppet_token', # use pwgen -s 64 1 (should match the token in puppet) # 'facen_model': 'kiwi_320' # face model in puppet # }, # { # 'id': 'second_puppet', # 'url': 'http://1.1.1.1:8010/', # 'token': 'second_puppet_token', # # # if remote installation has a different face model than the one used in FFSecurity - # # you need to specify its name and ExtractionAPI URL where the corresponding face model is specified # 'facen_model': 'grapefruit_480', # 'extractor': 'http://127.0.0.1:18667', # }, # ] # } # # ================= Vns ================== # A plugin for using FindFace Security as a puppeteer server # INSTALLED_APPS.append('ffsecurity_vns') # VNS_CONFIG = { # 'USERS': { # 'user1': 'token1', # 'user2': 'token2' # }, # 'MONITORING_THRESHOLD': 0.75, # 'DAILY': { # 'ENABLED': False, # 'THRESHOLD': 0.75, # 'START_TIME': "00:00:00" # } # }