Esempio n. 1
0
def main(datadir, limit, threads, segment_length, cachedir, minimal_confidence,
         fold, model, evalgt):
    # dataset = eval(dataset)(datadir, cachedir=cachedir, default_min_conf=minimal_confidence)
    # dataset.download()
    # dataset.prepare()

    dataset = Mot16(datadir,
                    cachedir=cachedir,
                    default_min_conf=minimal_confidence,
                    fold=fold)
    dataset.logdir += '_' + model
    model = eval(model)()

    prep_training_graphs(dataset,
                         cachedir,
                         limit=limit,
                         threads=threads,
                         segment_length_s=segment_length)
    prep_minimal_graph_diffs(dataset, model, threads=threads)
    prep_eval_graphs(dataset, model, threads=threads)

    if evalgt:
        dataset.logdir += '_gt'
        prep_eval_gt_tracks(dataset, model, 'eval', split_on_no_edge=False)
    else:
        train_graphres_minimal(dataset, model)
        prep_eval_tracks(dataset, model, 'eval', threads=1)

    res, res_int = eval_prepped_tracks(dataset, 'eval')
    open(os.path.join(dataset.logdir, "eval_results.txt"), "w").write(res)
    open(os.path.join(dataset.logdir, "eval_results_int.txt"),
         "w").write(res_int)
Esempio n. 2
0
def main(dataset, datadir, threads, segment_length, cachedir, minimal_confidence, fold, max_connect,
         max_worse_eval_epochs, epochs, too_short_track, logdir_prefix):
    opts = dict(cachedir=cachedir, default_min_conf=minimal_confidence)
    if fold is not None:
        opts['fold'] = fold
    dataset = eval(dataset)(datadir, **opts)
    dataset.cachedir = cachedir
    logdir = logdir_prefix + '/' + dataset.logdir

    find_minimal_graph_diff.too_short_track = too_short_track
    find_minimal_graph_diff.long_track = too_short_track * 2


    skipped_ggd_types = set(ggd_types)
    for add in ggd_types_order:
        skipped_ggd_types.remove(add)

        dataset.logdir = logdir + "_added_" + add
        print(dataset.logdir)
        if os.path.exists(dataset.logdir):
            continue

        prep_training_graphs(dataset, cachedir, limit_train_amount=0.1, threads=threads, segment_length_s=segment_length,
                             worker_params=dict(max_connect=max_connect))

        model = NNModelGraphresPerConnection()
        prep_minimal_graph_diffs(dataset, model, threads=threads, skipped_ggd_types=skipped_ggd_types)
        prep_eval_graphs(dataset, model, threads=threads)

        train_graphres_minimal(dataset, model, epochs=epochs, max_worse_eval_epochs=max_worse_eval_epochs)

        prep_eval_tracks(dataset, model, 'eval', threads=1)
        res, res_int = eval_prepped_tracks(dataset, 'eval')
        open(os.path.join(dataset.logdir, "eval_results.txt"), "w").write(res)
        open(os.path.join(dataset.logdir, "eval_results_int.txt"), "w").write(res_int)
Esempio n. 3
0
def main(dataset, datadir, limit, threads, segment_length, cachedir, minimal_confidence, fold, max_connect, no_train, resume, max_worse_eval_epochs, epochs, too_short_track):
    opts = dict(cachedir=cachedir, default_min_conf=minimal_confidence)
    if fold is not None:
        opts['fold'] = fold
    dataset = eval(dataset)(datadir, **opts)
    dataset.download()
    dataset.prepare()

    find_minimal_graph_diff.too_short_track = too_short_track
    find_minimal_graph_diff.long_track = too_short_track * 2

    prep_training_graphs(dataset, cachedir, limit=limit, threads=threads, segment_length_s=segment_length,
                         worker_params=dict(max_connect=max_connect))

    model = NNModelGraphresPerConnection()
    prep_minimal_graph_diffs(dataset, model, threads=threads)
    prep_eval_graphs(dataset, model, threads=threads)

    if not no_train:
        train_graphres_minimal(dataset, model, epochs=epochs, resume=resume, max_worse_eval_epochs=max_worse_eval_epochs)

    prep_eval_tracks(dataset, model, 'eval', threads=1)
    res, res_int = eval_prepped_tracks(dataset, 'eval')
    open(os.path.join(dataset.logdir, "eval_results.txt"), "w").write(res)
    open(os.path.join(dataset.logdir, "eval_results_int.txt"), "w").write(res_int)

    res, res_int = eval_prepped_tracks_joined(dataset, 'eval')
    open(os.path.join(dataset.logdir, "eval_results_joined.txt"), "w").write(res)
    open(os.path.join(dataset.logdir, "eval_results_joined_int.txt"), "w").write(res_int)

    prep_eval_tracks(dataset, model, 'test', threads=1)
    dataset.prepare_submition()
Esempio n. 4
0
def main(threads, cachedir, train_amounts, itterations, logdir_prefix):
    max_extra = 3
    dataset = Duke("data")
    dataset.cachedir = cachedir
    logdir = logdir_prefix + '/' + dataset.logdir

    global_skip = {"LongConnectionOrder", "LongFalsePositiveTrack"}

    for train_amount in map(float, train_amounts.split(',')):
        for itt in range(int(itterations)):
            t0 = time()
            prep_training_graphs(dataset,
                                 cachedir,
                                 limit_train_amount=train_amount,
                                 threads=threads,
                                 seed=hash(logdir) + itt)
            model = NNModelGraphresPerConnection()
            prep_minimal_graph_diffs(dataset,
                                     model,
                                     threads=threads,
                                     skipped_ggd_types=global_skip)
            prep_eval_graphs(dataset, model, threads=threads)

            t1 = time()
            dataset.logdir = logdir + "_%8.6f_%.2d" % (train_amount, itt)
            train_graphres_minimal(dataset,
                                   model,
                                   epochs=1000,
                                   max_worse_eval_epochs=max_extra,
                                   train_amount=train_amount)

            t2 = time()
            fn = sorted(glob("%s/snapshot_???.pyt" %
                             dataset.logdir))[-max_extra - 1]
            prep_eval_tracks(dataset, model, 'eval', threads=1, snapshot=fn)
            res, res_int = eval_prepped_tracks(dataset, 'eval')
            open(os.path.join(dataset.logdir, "eval_results.txt"),
                 "w").write(res)
            open(os.path.join(dataset.logdir, "eval_results_int.txt"),
                 "w").write(res_int)

            t3 = time()
            open(os.path.join(dataset.logdir, "timeing.txt"),
                 "w").write(repr((t0, t1, t2, t3)))

    prep_eval_gt_tracks(dataset, NNModelGraphresPerConnection)
    res, res_int = eval_prepped_tracks(dataset, 'eval')
    open(os.path.join(dataset.cachedir, "eval_gt_results.txt"), "w").write(res)
    open(os.path.join(dataset.cachedir, "eval_gt_results_int.txt"),
         "w").write(res_int)