Beispiel #1
0
ap.add_argument('-m', '--monitorid', help='monitor id - needed for mask')
ap.add_argument('-t', '--time', help='log time', action='store_true')
ap.add_argument('-v',
                '--version',
                help='print version and quit',
                action='store_true')

ap.add_argument('-f',
                '--file',
                help='internal testing use only - skips event download')

args, u = ap.parse_known_args()
args = vars(args)

if args['monitorid']:
    log.init('detect', args['monitorid'])
else:
    log.init('detect')

g.logger.info('---------| app version: {} |------------'.format(__version__))
if args['version']:
    print('---------| app version: {} |------------'.format(__version__))
    exit(0)

g.polygons = []

# process config file
g.ctx = ssl.create_default_context()

utils.process_config(args, g.ctx)
# now download image(s)
#!/usr/bin/python3
import argparse
import ssl
import zmes_hook_helpers.log as log
import zmes_hook_helpers.common_params as g
import zmes_hook_helpers.utils as utils
import zmes_hook_helpers.face_train as train

if __name__ == "__main__":
    g.ctx = ssl.create_default_context()
    ap = argparse.ArgumentParser()
    ap.add_argument('-c',
                    '--config',
                    default='/etc/zm/objectconfig.ini',
                    help='config file with path')

    args, u = ap.parse_known_args()
    args = vars(args)

    log.init(process_name='zm_train_faces', dump_console=True)
    utils.process_config(args, g.ctx)
    train.train()
Beispiel #3
0
ap.add_argument('-f',
                '--file',
                help='internal testing use only - skips event download')

args, u = ap.parse_known_args()
args = vars(args)

if not args['config'] or not args['eventid']:
    print('--config and --eventid are required')
    exit(1)

utils.get_pyzm_config(args)

if args['monitorid']:
    log.init(process_name='zmesdetect_' + 'm' + args['monitorid'],
             override=g.config['pyzm_overrides'])
else:
    log.init(process_name='zmesdetect', override=g.config['pyzm_overrides'])

es_version = '(?)'
try:
    es_version = subprocess.check_output(
        ['/usr/bin/zmeventnotification.pl', '--version']).decode('ascii')
except:
    pass

g.logger.info(
    '---------| hook version: {}, ES version: {} |------------'.format(
        __version__, es_version))
if args['version']:
    print(__version__)
Beispiel #4
0
import cv2
import datetime
import os
import re
import sys
import ssl
import argparse

import zmes_hook_helpers.log as log
import zmes_hook_helpers.utils as utils
import zmes_hook_helpers.image_manip as img
import zmes_hook_helpers.common_params as g

# main handler
# set up logging to syslog
log.init('detect_hog')

# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument('-c', '--config', required=True, help='config file with path')
ap.add_argument('-e', '--eventid', required=True, help='event ID to retrieve')
ap.add_argument('-m', '--monitorid', help='monitor id - needed for mask')
ap.add_argument('-t', '--time', help='log time')

args, u = ap.parse_known_args()
args = vars(args)

# process config file
g.ctx = ssl.create_default_context()
utils.process_config(args, g.ctx)
# now download image(s)
Beispiel #5
0
                default='')
ap.add_argument('-m', '--monitorid', help='monitor id - needed for mask')
ap.add_argument('-v',
                '--version',
                help='print version and quit',
                action='store_true')

ap.add_argument('-f',
                '--file',
                help='internal testing use only - skips event download')

args, u = ap.parse_known_args()
args = vars(args)

if args['monitorid']:
    log.init(process_name='zmesdetect_' + 'm' + args['monitorid'])
else:
    log.init(process_name='zmesdetect')

es_version='(?)'
try:
    es_version=subprocess.check_output(['/usr/bin/zmeventnotification.pl', '--version']).decode('ascii')
except:
    pass

g.logger.info('---------| hook version: {}, ES version: {} |------------'.format(__version__, es_version))
if args['version']:
    print(__version__)
    exit(0)

Beispiel #6
0
import zmes_hook_helpers.common_params as g

import zmes_hook_helpers.yolo as yolo
import zmes_hook_helpers.hog as hog
from zmes_hook_helpers.__init__ import __version__


def append_suffix(filename, token):
    f, e = os.path.splitext(filename)
    return f + token + e


# main handler

# set up logging to syslog
log.init('detect')
g.logger.info('---------| app version: {} |------------'.format(__version__))

# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument('-c', '--config', required=True, help='config file with path')
ap.add_argument('-e', '--eventid', required=True, help='event ID to retrieve')
ap.add_argument('-p',
                '--eventpath',
                help='path to store object image file',
                default='')
ap.add_argument('-m', '--monitorid', help='monitor id - needed for mask')
ap.add_argument('-t', '--time', help='log time', action='store_true')
ap.add_argument('-v',
                '--version',
                help='print version and quit',
Beispiel #7
0
        bbox.append([
            int(round(x)),
            int(round(y)),
            int(round(x + w)),
            int(round(y + h))
        ])
        label.append(str(classes[class_ids[i]]))
        conf.append(confidences[i])

    return bbox, label, conf


# main handler

# set up logging to syslog
log.init('detect_yolo')

# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument('-c', '--config', required=True, help='config file with path')
ap.add_argument('-e', '--eventid', required=True, help='event ID to retrieve')
ap.add_argument('-p',
                '--eventpath',
                help='path to store object image file',
                default='')
ap.add_argument('-m', '--monitorid', help='monitor id - needed for mask')
ap.add_argument('-t', '--time', help='log time')

args, u = ap.parse_known_args()
args = vars(args)
g.polygons = []