Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 import util as ut
00031 import processor
00032
00033
00034 class classifier(object):
00035 '''
00036 classdocs
00037 '''
00038
00039 processor = None
00040 features = 'all'
00041
00042 def __init__(self, processor, features):
00043 '''
00044 Constructor
00045 '''
00046 self.processor = processor
00047 self.features = features
00048
00049
00050 def train(self):
00051 return None
00052
00053
00054 def test(self, feature_data = None):
00055 return None
00056
00057
00058 def test_results(self, dict, labels):
00059 current_set_size = dict['set_size']
00060 count_correct = 0
00061 count_clutter_correct = 0
00062 count_surface_correct = 0
00063 count_clutter = 0
00064 count_surface = 0
00065 count = 0
00066 for index in dict['point_indices']:
00067 label = labels[index]
00068
00069 if label == dict['labels'][count]:
00070 count_correct += 1
00071
00072 if dict['labels'][count] == processor.LABEL_CLUTTER:
00073 count_clutter += 1
00074 if label == dict['labels'][count]:
00075 count_clutter_correct += 1
00076 if dict['labels'][count] == processor.LABEL_SURFACE:
00077 count_surface += 1
00078 if label == dict['labels'][count]:
00079 count_surface_correct += 1
00080
00081 count += 1
00082
00083 print ut.getTime(), '##########################################'
00084 print ut.getTime(), '####tested on ', self.features, '###########################'
00085 print ut.getTime(), '==================================='
00086 print ut.getTime(), 'percent in total: surface:',(float(count_surface)/float(current_set_size)*100), '%, clutter:',(float(count_clutter)/float(current_set_size)*100),'%'
00087 print ut.getTime(), '#points surface:',count_surface,'clutter:',count_clutter
00088 print ut.getTime(), '#points correct: surface:',count_surface_correct,'clutter:',count_clutter_correct
00089 if count_surface > 0:
00090 percent_surface_correct = float(count_surface_correct)/float(count_surface) * 100
00091 else:
00092 percent_surface_correct = 100
00093 if count_clutter > 0:
00094 percent_clutter_correct = float(count_clutter_correct)/float(count_clutter) * 100
00095 else:
00096 percent_clutter_correct = 100
00097 print ut.getTime(), '#percent correct: surface:',percent_surface_correct,'clutter:',percent_clutter_correct
00098 print ut.getTime(), '==================================='
00099 print ut.getTime(), '##########################################'
00100 testresults = (count_surface, count_clutter,count_surface_correct, count_clutter_correct, percent_surface_correct, percent_clutter_correct)
00101
00102 return testresults
00103
00104
00105
00106 def get_filename(self):
00107 return self.processor.config.path+'/classifier_'+self.features+'_'+self.processor.feature_type+'_k'+str(self.processor.feature_neighborhood)+'_r'+str(self.processor.feature_radius)+'.XML'
00108
00109 def save(self):
00110 return None
00111
00112
00113 def load(self):
00114 return None
00115
00116
clutter_segmentation
Author(s): Jason Okerman, Martin Schuster, Advisors: Prof. Charlie Kemp and Jim Regh, Lab: Healthcare Robotics Lab at Georgia Tech
autogenerated on Wed Nov 27 2013 12:07:15