예제 #1
0
    is_run_sgd = False

    # Batch size during evaluation. Reduce if you run out of GPU memory.
    batch_size = 128
    # Device to use: cuda, cpu, or try_cuda
    device = 'try_cuda'

    assert config_file is not None, "No config_file provided"
    ex.add_config(config_file)  # Adds config entries from the previous script
    run_dir = os.path.dirname(config_file)
    eval_dir = os.path.join(run_dir, "eval")
    os.makedirs(eval_dir, exist_ok=True)
    ex.observers.append(FileStorageObserver(eval_dir))


device = ex.capture(exp_utils.device)
get_model = ex.capture(exp_utils.get_model)
evaluate_model = ex.capture(exp_utils.evaluate_model)
evaluate_ood = ex.capture(exp_utils.evaluate_ood)
evaluate_marglik = ex.capture(exp_utils.evaluate_marglik)


@ex.capture
def get_eval_data(data, eval_data):
    if eval_data is not None:
        return exp_utils.get_data(eval_data, "cpu")
    else:
        return exp_utils.get_data(data, "cpu")


@ex.capture
from tracker.resnet import resnet50

from sklearn.utils.linear_assignment_ import linear_assignment
from easydict import EasyDict as edict
from mot_evaluation.io import read_txt_to_struct, read_seqmaps, extract_valid_gt_data, print_metrics
from mot_evaluation.bbox import bbox_overlap
from mot_evaluation.measurements import clear_mot_hungarian, idmeasures

ex = Experiment()

ex.add_config('experiments/cfgs/oracle_tracker.yaml')

# hacky workaround to load the corresponding cnn config and not having to hardcode it here
ex.add_config(ex.configurations[0]._conf['oracle_tracker']['siamese_config'])

Tracker = ex.capture(Tracker, prefix='oracle_tracker.tracker')


def preprocessingDB(trackDB, gtDB, distractor_ids, iou_thres, minvis):
    """
    Preprocess the computed trajectory data.
    Matching computed boxes to groundtruth to remove distractors and low visibility data in both trackDB and gtDB
    trackDB: [npoints, 9] computed trajectory data
    gtDB: [npoints, 9] computed trajectory data
    distractor_ids: identities of distractors of the sequence
    iou_thres: bounding box overlap threshold
    minvis: minimum visibility of groundtruth boxes, default set to zero because the occluded people are supposed to be interpolated for tracking.
    """
    track_frames = np.unique(trackDB[:, 0])
    gt_frames = np.unique(gtDB[:, 0])
    nframes = min(len(track_frames), len(gt_frames))
예제 #3
0
import cv2

import torch
from torch.utils.data import DataLoader
from tracktor.config import cfg

from tracktor.config import get_output_dir, get_tb_dir
from tracktor.correlation.solver import Solver
#from tracktor.datasets.factory import Datasets
from tracktor.datasets.dataloader_correlation import Dataset
from tracktor.correlation.correlation_head import CorrelationHead

ex = Experiment()
ex.add_config('experiments/cfgs/correlation.yaml')

Solver = ex.capture(Solver, prefix='correlation.solver')


@ex.automain
def my_main(_config, correlation):
    # set all seeds
    torch.manual_seed(correlation['seed'])
    torch.cuda.manual_seed(correlation['seed'])
    np.random.seed(correlation['seed'])
    torch.backends.cudnn.deterministic = True

    #print(_config)

    output_dir = osp.join(get_output_dir(correlation['module_name']),
                          correlation['name'])
예제 #4
0
import numpy as np
import yaml
import cv2

import torch
from torch.utils.data import DataLoader

from tracktor.config import get_output_dir, get_tb_dir
from tracktor.solver import Solver
from tracktor.datasets.factory import Datasets
from tracktor.resnet import resnet50

ex = Experiment()
ex.add_config('experiments/cfgs/siamese.yaml')

Solver = ex.capture(Solver, prefix='siamese.solver')


@ex.automain
def my_main(_config, siamese):
    # set all seeds
    torch.manual_seed(siamese['seed'])
    torch.cuda.manual_seed(siamese['seed'])
    np.random.seed(siamese['seed'])
    torch.backends.cudnn.deterministic = True

    print(_config)

    output_dir = osp.join(get_output_dir(siamese['module_name']),
                          siamese['name'])
    tb_dir = osp.join(get_tb_dir(siamese['module_name']), siamese['name'])