in source/neo/eval.py [0:0]
def __init__(self,
test_image_path,
raw_model_params_full_path,
raw_model_symbol_full_path,
neo_optimized_model_root_dir,
short_size=416):
"""
constructor of sagemaker neo evaluator
:param test_image_path: full path of test image with RGB channels
:param raw_model_params_full_path: full path of original object detector model's parameters
:param raw_model_symbol_full_path: full path of original object detector model's symbol
:param neo_optimized_model_root_dir: the directory of Sagemaker Neo optimized model, the .so,
.params, .json, manifest, .meta files are stored in this directory,
all these files are compiled and generated by Sagemaker Neo
:param short_size: resized short size of object detector's input, default value is 416, the longer side
will be resized according to image's original width/height ratio
"""
# load test image
self._test_image_path = test_image_path
self._test_image_base64 = self.get_base64_encoding(full_path=self._test_image_path)
# mxnet model without Sagemaker neo optimization
self._raw_model_params_full_path = raw_model_params_full_path
self._raw_model_symbol_full_path = raw_model_symbol_full_path
# optimized model root directory with Sagemaker neo
self._neo_optimized_model_root_dir = neo_optimized_model_root_dir
self._short_size = short_size
self._height, self._width, self._channels = -1, -1, -1
# load detector model (without Sagemaker neo optimization)
self._human_body_detector_without_neo_optimization = gluon.nn.SymbolBlock.imports(
symbol_file=self._raw_model_symbol_full_path,
input_names=['data'],
param_file=self._raw_model_params_full_path,
ctx=mx.gpu()
)
# load Sagemaker neo optimized model
self._human_body_detector_with_neo_optimization = dlr.DLRModel(self._neo_optimized_model_root_dir, 'gpu', 0)