예제 #1
0
def main():

    if not mlboard:
        print_fun("Skipped: no mlboard detected")
        return

    parser = argparse.ArgumentParser()
    add_common_args(parser)
    parser.add_argument(
        'model_name',
        help='Exported model name.',
        type=str,
    )
    parser.add_argument(
        'model_version',
        help='Exported model version.',
        type=str,
    )
    args = parser.parse_args()

    utils.print_fun('Uploading model...')
    mlboard.model_upload(args.model_name, args.model_version,
                         args.classifiers_dir)
    update_task_info({
        'model_reference':
        catalog_ref(args.model_name, 'mlmodel', args.model_version)
    })
    utils.print_fun("New model uploaded as '%s', version '%s'." %
                    (args.model_name, args.model_version))
예제 #2
0
def main():
    parser = argparse.ArgumentParser()
    add_common_args(parser)
    add_bg_remove_args(parser)
    add_detector_args(parser)
    add_image_args(parser)
    args = parser.parse_args()
    detector = detector_args(args)
    image = image_args(detector, args)
    image.process()
예제 #3
0
def main():
    parser = argparse.ArgumentParser()
    utils.configure_logging()

    add_common_args(parser)
    add_bg_remove_args(parser)
    add_detector_args(parser)
    add_listener_args(parser)
    add_video_args(parser)
    add_video_notify_args(parser)
    add_notify_args(parser)
    args = parser.parse_args()

    detector = detector_args(args)
    listener = listener_args(args)
    camera = video_args(detector, listener, args)
    init_notifier_args(args)
    init_in_video_detected(args)

    camera.start()
예제 #4
0
def main():
    parser = argparse.ArgumentParser()
    add_aligner_args(parser)
    add_common_args(parser)
    add_classifier_args(parser)
    add_bg_remove_args(parser)
    utils.add_normalization_args(parser)
    parser.add_argument(
        '--skip_align',
        help=
        'Skip alignment for source images from input dir, only calculate embeddings and train classifiers.',
        action='store_true',
    )
    parser.add_argument(
        '--skip_train',
        help=
        'Skip calculating embeddings and training, only alignment for source images from input dir.',
        action='store_true',
    )
    parser.add_argument(
        '--align_images_limit',
        type=int,
        help='Set limit for processed images in alignment.',
        default=None,
    )
    parser.add_argument(
        '--model_name',
        help='Exported model name.',
        type=str,
        default=None,
    )
    parser.add_argument(
        '--model_version',
        help='Exported model version.',
        type=str,
        default=None,
    )
    parser.add_argument(
        '--complementary',
        help='Complementary align and training.',
        action='store_true',
    )
    parser.add_argument(
        '--best_threshold',
        help='Find best threshold.',
        action='store_true',
    )
    args = parser.parse_args()
    if not args.skip_align:
        al = aligner_args(args)
        al.align(args.align_images_limit)
    if not args.skip_train:
        clf = classifiers_args(args)
        clf.train()
        from app.control.client import Client
        cl = Client()
        cl.call('reload_classifiers')
        if args.model_name is not None and args.model_version is not None:
            from app.mlboard import mlboard, update_task_info, catalog_ref
            utils.print_fun('Uploading model...')
            model_version = args.model_version
            if args.device not in args.model_version:
                model_version = args.model_version + '-%s' % args.device
            mlboard.model_upload(args.model_name, model_version,
                                 args.classifiers_dir)
            update_task_info({
                'model_reference':
                catalog_ref(args.model_name, 'mlmodel', args.model_version)
            })
            utils.print_fun("New model uploaded as '%s', version '%s'." %
                            (args.model_name, args.model_version))
import argparse

from app.recognize import add_common_args
from app.tools import downloader

parser = argparse.ArgumentParser()
add_common_args(parser)
parser.add_argument(
    'classifiers_url',
    type=str,
    help='URL for the pretrained classifiers',
)
args = parser.parse_args()

err = downloader.Downloader(args.classifiers_url, args.classifiers_dir).extract()
if err is not None:
    raise ValueError(err)