Example #1
0
params = py_indoor_context.ManhattanHyperParameters(w, 4., 6.)

w2 = np.array([
    2.,
    -.5,
    .1,
])
params2 = py_indoor_context.ManhattanHyperParameters(w2, 3., 7.)

train_ids = [20, 40, 60]
test_ids = [65, 70]

mgr = py_indoor_context.TrainingManager()
mgr.LoadSequence("lab_kitchen1", train_ids + test_ids)

fm = py_indoor_context.FeatureManager('/tmp')
for i in range(mgr.NumInstances()):
    fm.ComputeMockFeatures(mgr.GetInstance(i))
    fm.CommitFeatures()

train_instances = [mgr.GetInstance(i) for i in range(len(train_ids))]

test_instances = [
    mgr.GetInstance(i) for i in range(len(train_ids),
                                      len(train_ids) + len(test_ids))
]

r = training_helpers.Reporter(train_instances, test_instances, fm,
                              'foo/testexp')
r.add_iteration(params)
r.add_iteration(params2)
Example #2
0
import numpy as np
import py_indoor_context
import matplotlib.pyplot as plt

ftr_dir = '/home/alex/Code/indoor_context/data/svm_features/test'

mgr = py_indoor_context.TrainingManager()
mgr.LoadSequence('lab_kitchen1', [20,25])

inst0 = mgr.GetInstance(0)
inst1 = mgr.GetInstance(1)

fm = py_indoor_context.FeatureManager(ftr_dir)
fm.ComputeMockFeatures(inst0)
fm.CommitFeatures()
f2 = fm.GetFeature(2,0)

fm.ComputeMockFeatures(inst1)
fm.CommitFeatures()
assert(not np.all(fm.GetFeature(2,0) == f2))

fm.LoadFeaturesFor(inst0)
assert(np.all(fm.GetFeature(2,0) == f2))
test_set = training_params.Datasets.Large.TestSet

params = training_params.ECCV2010_v2.Params

feature_store = os.path.join(training_params.FeatureStoreBase, 'eccv2010')
output_path = 'experiments/mar05_eccv2010_cornerpenalty10'

# Check that we're not about to overwrite a previous experiment
if os.path.exists(output_path):
    print 'Error: Experiment dir already exists: ',output_path
    exit(-1)

# Load the dataset
mgr = py_indoor_context.TrainingManager()
instances = []
for sequence,frame_ids in test_set:
    print '  From %s loading frames %s' % (sequence, ','.join(map(str, frame_ids)))
    instances += training_helpers.load_sequence(mgr, sequence, frame_ids)

print 'Loaded %d instances' % len(instances)

# Compute features
fm = py_indoor_context.FeatureManager(feature_store)
for inst in instances:
    fm.ComputeSweepFeatures(inst)
    fm.CommitFeatures()

# Run evaluation
reporter = training_helpers.Reporter([], instances, fm, output_path)
reporter.generate_report(params, extended=True)
Example #4
0
############################################################
StereoOffsets = [-5, -1, 1, 5]

Dataset = training_params.Datasets.Large
FeatureSet = FeatureSets.ALLMULTIVIEW
LossFunction = LossFunctions.TWOLABELLING

#OutputPath = 'experiments/foo'
OutputPath = 'experiments/mar07_labellingloss_multiview-all_large'

FeatureStore = os.path.join(training_params.FeatureStoreBase, 'multiview-all')

############################################################

Mgr = py_indoor_context.TrainingManager()
FtrMgr = py_indoor_context.FeatureManager(FeatureStore)
Inference = py_indoor_context.ManhattanInference()
Reporter = None


def relerr(a, b):
    return np.abs(a - b) / b


def abserr(a, b):
    return np.abs(a - b)


def errcheck(a, b, reltol=1e-5, abstol=1e-6):
    return abserr(a, b) > abstol and relerr(a, b) > reltol