(params, input)
| 77 | |
| 78 | |
| 79 | def run_test(params, input): |
| 80 | pred_config = PredictConfig( |
| 81 | model=Model(), |
| 82 | session_init=SmartInit(params), |
| 83 | input_names=['input'], |
| 84 | output_names=['prob'] |
| 85 | ) |
| 86 | predict_func = OfflinePredictor(pred_config) |
| 87 | |
| 88 | prepro = imgaug.AugmentorList(get_inference_augmentor()) |
| 89 | im = cv2.imread(input).astype('float32') |
| 90 | im = prepro.augment(im) |
| 91 | im = np.reshape(im, (1, 224, 224, 3)) |
| 92 | outputs = predict_func(im) |
| 93 | prob = outputs[0] |
| 94 | |
| 95 | ret = prob[0].argsort()[-10:][::-1] |
| 96 | print(ret) |
| 97 | meta = ILSVRCMeta().get_synset_words_1000() |
| 98 | print([meta[k] for k in ret]) |
| 99 | |
| 100 | |
| 101 | def name_conversion(caffe_layer_name): |
no test coverage detected