Exemplo n.º 1
0
def train_object_detector(cfg):
    """
    Trains an object detector as specified in the configuration
    :param cfg: the configuration
    :return: the eval model of the trained detector
    """

    detector_name = _get_detector_name(cfg)
    eval_model = None
    if cfg["CNTK"].MAKE_MODE:
        print("loading {}".format(detector_name))
    else:
        print("training {}".format(detector_name))
    if detector_name == 'FastRCNN':
        from FastRCNN.FastRCNN_train import prepare, train_fast_rcnn
        prepare(cfg, use_arg_parser=False)
        eval_model = train_fast_rcnn(cfg)
    elif detector_name == 'FasterRCNN':
        from FasterRCNN.FasterRCNN_train import prepare, train_faster_rcnn
        prepare(cfg, use_arg_parser=False)
        eval_model = train_faster_rcnn(cfg)
    else:
        print('Unknown detector: {}'.format(detector_name))

    return eval_model
Exemplo n.º 2
0
def train_object_detector(cfg):
    """
    Trains an object detector as specified in the configuration
    :param cfg: the configuration
    :return: the eval model of the trained detector
    """

    detector_name = _get_detector_name(cfg)
    eval_model = None
    print("training {}".format(detector_name))
    if detector_name == 'FastRCNN':
        from FastRCNN.FastRCNN_train import prepare, train_fast_rcnn
        prepare(cfg, use_arg_parser=False)
        eval_model = train_fast_rcnn(cfg)
    elif detector_name == 'FasterRCNN':
        from FasterRCNN.FasterRCNN_train import prepare, train_faster_rcnn
        prepare(cfg, use_arg_parser=False)
        eval_model = train_faster_rcnn(cfg)
    else:
        print('Unknown detector: {}'.format(detector_name))

    return eval_model