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

Function run_test

examples/CaffeModels/load-cpm.py:97–111  ·  view source on GitHub ↗
(model_path, img_file)

Source from the content-addressed store, hash-verified

95
96
97def run_test(model_path, img_file):
98 predict_func = OfflinePredictor(PredictConfig(
99 input_signature=[tf.TensorSpec((None, 368, 368, 3), tf.float32, 'input')],
100 tower_func=CPM,
101 session_init=SmartInit(model_path),
102 input_names=['input'],
103 output_names=['resized_map']
104 ))
105
106 im = cv2.imread(img_file, cv2.IMREAD_COLOR).astype('float32')
107 im = cv2.resize(im, (368, 368))
108 out = predict_func(im[None, :, :, :])[0][0]
109 hm = out[:, :, :14].sum(axis=2)
110 viz = colorize(im, hm)
111 cv2.imwrite("output.jpg", viz)
112
113
114if __name__ == '__main__':

Callers 1

load-cpm.pyFile · 0.70

Calls 5

OfflinePredictorClass · 0.85
PredictConfigClass · 0.85
SmartInitFunction · 0.85
colorizeFunction · 0.85
sumMethod · 0.80

Tested by

no test coverage detected