MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / run_test

Function run_test

examples/ResNet/load-resnet.py:79–98  ·  view source on GitHub ↗
(params, input)

Source from the content-addressed store, hash-verified

77
78
79def 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
101def name_conversion(caffe_layer_name):

Callers 1

load-resnet.pyFile · 0.70

Calls 8

ILSVRCMetaClass · 0.90
PredictConfigClass · 0.85
SmartInitFunction · 0.85
OfflinePredictorClass · 0.85
augmentMethod · 0.80
get_synset_words_1000Method · 0.80
ModelClass · 0.70
get_inference_augmentorFunction · 0.70

Tested by

no test coverage detected