def write(self):
     if not (len(self.examples) > 0):
         print 'EmbodiedLaserDetector.write: no examples to record'
         return
     #dataset        = matrix_to_dataset(ut.list_mat_to_mat(self.examples, axis=1), type=self.type)
     inputs  = ut.list_mat_to_mat(self.examples, axis = 1)
     outputs = ut.list_mat_to_mat(self.labels, axis = 1)
     print 'EmbodiedLaserDetector.write: inputs.shape, outputs.shape', inputs.shape, outputs.shape
     dim_reduce_set = rf.LinearDimReduceDataset(inputs, outputs)
     print 'EmbodiedLaserDetector.write: appending examples from disk to dataset'
     n = append_examples_from_file(dim_reduce_set, file=LaserPointerDetector.DEFAULT_DATASET_FILE)
     print 'EmbodiedLaserDetector.write: calculating pca projection vectors'
     dim_reduce_set.set_projection_vectors(dr.pca_vectors(dim_reduce_set.inputs, percent_variance=LaserPointerDetector.PCA_VARIANCE_RETAIN))
     print 'EmbodiedLaserDetector.write: writing...'
     dump_pickle(dim_reduce_set, LaserPointerDetector.DEFAULT_DATASET_FILE)
     print 'EmbodiedLaserDetector: recorded examples to disk.  Total in dataset', n
     self.examples = []
     self.labels   = []
 def write(self):
     if not (len(self.examples) > 0):
         rospy.loginfo('EmbodiedLaserDetector.write: no examples to record')
         return
     inputs  = ut.list_mat_to_mat(self.examples, axis = 1)
     outputs = ut.list_mat_to_mat(self.labels, axis = 1)
     #import pdb
     #pdb.set_trace()
     rospy.loginfo('EmbodiedLaserDetector.write: inputs.shape, outputs.shape ' + str(inputs.shape) + ' ' + str(outputs.shape))
     dim_reduce_set = rf.LinearDimReduceDataset(inputs, outputs)
     rospy.loginfo('EmbodiedLaserDetector.write: appending examples from disk to dataset')
     n = append_examples_from_file(dim_reduce_set, file=self.dataset_file)
     rospy.loginfo('EmbodiedLaserDetector.write: calculating pca projection vectors')
     dim_reduce_set.set_projection_vectors(dr.pca_vectors(dim_reduce_set.inputs, percent_variance=self.left_detector.PCA_VARIANCE_RETAIN))
     rospy.loginfo('EmbodiedLaserDetector.write: writing...')
     ut.dump_pickle(dim_reduce_set, self.dataset_file)
     rospy.loginfo('EmbodiedLaserDetector: recorded examples to disk.  Total in dataset ' + str(n))
     self.examples = []
     self.labels   = []
Example #3
0
 def write(self):
     if not (len(self.examples) > 0):
         print 'EmbodiedLaserDetector.write: no examples to record'
         return
     #dataset        = matrix_to_dataset(ut.list_mat_to_mat(self.examples, axis=1), type=self.type)
     inputs = ut.list_mat_to_mat(self.examples, axis=1)
     outputs = ut.list_mat_to_mat(self.labels, axis=1)
     print 'EmbodiedLaserDetector.write: inputs.shape, outputs.shape', inputs.shape, outputs.shape
     dim_reduce_set = rf.LinearDimReduceDataset(inputs, outputs)
     print 'EmbodiedLaserDetector.write: appending examples from disk to dataset'
     n = append_examples_from_file(
         dim_reduce_set, file=LaserPointerDetector.DEFAULT_DATASET_FILE)
     print 'EmbodiedLaserDetector.write: calculating pca projection vectors'
     dim_reduce_set.set_projection_vectors(
         dr.pca_vectors(
             dim_reduce_set.inputs,
             percent_variance=LaserPointerDetector.PCA_VARIANCE_RETAIN))
     print 'EmbodiedLaserDetector.write: writing...'
     dump_pickle(dim_reduce_set, LaserPointerDetector.DEFAULT_DATASET_FILE)
     print 'EmbodiedLaserDetector: recorded examples to disk.  Total in dataset', n
     self.examples = []
     self.labels = []