Ejemplo n.º 1
0
 def __init__(self, actionfile, action_list=[]):
     self.src_ctx = SrcContext()
     self.src_ctx.read_h5(actionfile)
     self.tgt_cld = None
     self.tgt_ctx = TgtContext(self.src_ctx)
     self.name2ind = dict([(s, i)
                           for i, s in enumerate(self.src_ctx.seg_names)])
     self.costs = np.zeros(self.src_ctx.N)
     self.N = len(self.src_ctx.seg_names)
     self.indicators = np.eye(self.N)
     self.weights = np.r_[-1, np.zeros(self.N)]
     self.w0 = 0
Ejemplo n.º 2
0
 def batch_cost(self, test_scene_state):
     if not(self.actionfile):
         raise ValueError('No actionfile provided for gpu context')
     tgt_ctx = TgtContext(self.src_ctx)
     cloud = test_scene_state.cloud
     cloud = self._clip_cloud(cloud)
     tgt_ctx.set_cld(cloud)
     
     cost_array = batch_tps_rpm_bij(self.src_ctx, tgt_ctx,
                                    T_init=self.rad_init, T_final=self.rad_final, 
                                    outlierfrac=self.outlierfrac, outlierprior=self.outlierprior, 
                                    outliercutoff=settings.OUTLIER_CUTOFF, 
                                    em_iter=self.em_iter, 
                                    component_cost=True)
     costs = dict(zip(self.src_ctx.seg_names, cost_array))
     return costs
Ejemplo n.º 3
0
 def set_landmark_file(self, landmarkf):
     self.landmark_ctx = GPUContext()
     self.landmark_ctx.read_h5(landmarkf)
     self.landmark_targ_ctx = TgtContext(self.landmark_ctx)
     self.weights = np.zeros(self.src_ctx.N + self.landmark_ctx.N +
                             MulFeats.N_costs)