def create_params_from_psi(w): # If this changes then we also need to update # - init_constraints() so that the right weights are positive # - TrainingInstance::GetFeatureForHypothesis() wts = np.array(w[:-2], float) # The factor of 100 here _must_ match that in ComputeFeatureForHypothesis() return py_indoor_context.ManhattanHyperParameters(wts, w[-2]*kPenaltyFactor, w[-1]*kPenaltyFactor)
class ICCV: StereoOffsets = ([-1, 1]) NumAuxFrames = len(StereoOffsets) StereoWeights = np.array([1. / NumAuxFrames] * NumAuxFrames) Weights = np.hstack([.001, 100., 5., 50. * StereoWeights]) CornerPenalty = 70. OcclusionPenalty = 50. Params = py_indoor_context.ManhattanHyperParameters( Weights, CornerPenalty, OcclusionPenalty)
import py_indoor_context from matplotlib.pyplot import * import training_helpers np.set_printoptions(precision=3) w = np.array([ 1., -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))
import numpy as np from matplotlib.pyplot import * import py_indoor_context import training_helpers np.set_printoptions(precision=3) #w = np.array([0., 0., 1.,]) w = np.array([0.331, -0.662, 0.004]) #w = np.array([229.582, 147.414, -11.827, 75.342, 87.373, 27.623, 37.698]) #params = py_indoor_context.ManhattanHyperParameters(w, 400., 600.) params = py_indoor_context.ManhattanHyperParameters(w, 13.462474823, 0.) mgr = py_indoor_context.TrainingManager() #mgr.LoadSequence('lab_kitchen1', [25]) #range(10,80,10)) mgr.LoadSequence('exeter_mcr1', [35]) #range(10,80,10)) #mgr.ComputeAllFeatures([-5,-1,1,5], True) mgr.ComputeMockFeatures() instances = [ mgr.GetInstance(i) for i in range(mgr.GetNumInstances()) ] sum_err = 0. for inst in instances: inst.ConfigureLabellingLoss() print '\nFrame ',inst.GetFrameId() payoffs = py_indoor_context.DPPayoffs() inst.CompileFeatures(params, payoffs) hyp = mgr.Solve(inst, payoffs)
class ECCV2010_v2: Weights = np.array([1.]) CornerPenalty = 10. OcclusionPenalty = 0. Params = py_indoor_context.ManhattanHyperParameters( Weights, CornerPenalty, OcclusionPenalty)