MCPcopy Create free account
hub / github.com/FreeformRobotics/OTS / test

Method test

main.py:108–130  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

106 return object_feature
107
108 def test(self):
109 pbar = tqdm(total=len(self.test_data))
110 for batch_data in self.test_data:
111 batch_data = batch_data[0]
112 # segSize = (batch_data['img_ori'].shape[0], batch_data['img_ori'].shape[1])
113 segSize = (256, 256)
114 img_resized_list = batch_data['img_data']
115 true_label = batch_data['info'].split('/')[-2]
116 object_feature = self.get_object_feature(segSize, img_resized_list, batch_data)
117 object_feature = self.obj_model(object_feature)
118 logit = self.classifier(object_feature)
119 pred_label = classify_step(logit, self.classes)
120
121 if pred_label == true_label:
122 self.correct += 1
123 self.count += 1
124
125 pbar.update(1)
126
127 acc = 100 * self.correct / float(self.count)
128 logging.info('Accuracy is {:2.2f}%, sample number is {}'.format(acc, self.count))
129
130 return "Finished!"
131
132
133if __name__ == '__main__':

Callers 1

main.pyFile · 0.80

Calls 3

get_object_featureMethod · 0.95
classify_stepFunction · 0.85
updateMethod · 0.80

Tested by

no test coverage detected