Exemple #1
0
class BatchRCFeats(Feature):
    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

    def features(self, state, **kwargs):
        self.tgt_cld = state.cloud
        self.tgt_ctx.set_cld(self.tgt_cld)
        self.costs = batch_tps_rpm_bij(self.src_ctx, self.tgt_ctx)
        return np.c_[self.costs, self.indicators]

    def set_name2ind(self, action_list):
        self.name2ind = dict([(s, i) for i, s in enumerate(action_list)])

    def get_ind(self, a):
        return self.name2ind[a]

    @staticmethod
    def get_size(num_actions):
        return num_actions + 1
Exemple #2
0
class BatchRCFeats(Feature):

    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

    def features(self, state, **kwargs):
        self.tgt_cld = state.cloud
        self.tgt_ctx.set_cld(self.tgt_cld)
        self.costs = batch_tps_rpm_bij(self.src_ctx, self.tgt_ctx)
        return np.c_[self.costs, self.indicators]

    def set_name2ind(self, action_list):
        self.name2ind = dict([(s, i) for i, s in enumerate(action_list)])

    def get_ind(self, a):
        return self.name2ind[a]

    @staticmethod
    def get_size(num_actions):
        return num_actions + 1
Exemple #3
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
Exemple #4
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