(self)
| 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 | |
| 133 | if __name__ == '__main__': |
no test coverage detected