Generation

code to explanationSat, 12 Nov 2022

json_path = YOEOPathGetter.get_tvm_json_file_path(model_directory) params_path = YOEOPathGetter.get_tvm_params_file_path(model_directory) binary_path = YOEOPathGetter.get_tvm_so_file_path(model_directory) logger.debug(f"Loading files...\n\t{binary_path}\n\t{params_path}\n\t{json_path}") binary_lib = tvm.runtime.load_module(binary_path) loaded_params = bytearray(open(params_path, "rb").read()) loaded_json = open(json_path).read() device = self._select_device() logger.debug(f"Creating network on device '{device}'...") self._model = graph_executor.create(loaded_json, binary_lib, device) self._model.load_params(loaded_params) input_shape_dict, _ = self._model.get_input_info() self._input_layer_shape = input_shape_dict.get('InputLayer') height, width = self._input_layer_shape[2], self._input_layer_shape[3] self._img_preprocessor: utils.IImagePreProcessor = utils.DefaultImagePreProcessor((height, width)) self._det_postprocessor: utils.IDetectionPostProcessor = utils.DefaultDetectionPostProcessor( image_preprocessor=self._img_preprocessor, output_img_size=self._input_layer_shape[2], conf_thresh=config["yoeo_conf_threshold"], nms_thresh=config["yoeo_nms_threshold"]) self._seg_postprocessor: utils.ISegmentationPostProcessor = utils.DefaultSegmentationPostProcessor( self._img_preprocessor )

The image is passed through different functions in order to resize it and perform preprocessing on it.

Questions about programming?Chat with your personal AI assistant