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

Function apply

examples/basics/export-model.py:126–137  ·  view source on GitHub ↗

Run inference from a training model checkpoint.

(model_path)

Source from the content-addressed store, hash-verified

124
125
126def apply(model_path):
127 """Run inference from a training model checkpoint. """
128 pred_config = PredictConfig(
129 session_init=SmartInit(model_path),
130 model=Model(),
131 input_names=['input_img'],
132 output_names=['prediction_img'])
133
134 pred = OfflinePredictor(pred_config)
135 img = cv2.imread('lena.png')
136 prediction = pred([img])[0]
137 cv2.imwrite('applied_default.jpg', prediction[0])
138
139
140def apply_inference_graph(model_path):

Callers 1

export-model.pyFile · 0.70

Calls 4

PredictConfigClass · 0.85
SmartInitFunction · 0.85
OfflinePredictorClass · 0.85
ModelClass · 0.70

Tested by

no test coverage detected