MCPcopy Create free account
hub / github.com/Topdu/OpenOCR / _init_torch_model

Method _init_torch_model

tools/infer_det.py:238–250  ·  view source on GitHub ↗
(self, config, numId=0)

Source from the content-addressed store, hash-verified

236 global_config)
237
238 def _init_torch_model(self, config, numId=0):
239
240 from opendet.modeling import build_model as build_det_model
241 from tools.utils.ckpt import load_ckpt
242
243 # build model
244 self.model = build_det_model(config['Architecture'])
245 self.model.eval()
246 load_ckpt(self.model, config)
247 if config['Architecture']['algorithm'] == 'DB_mobile':
248 replace_batchnorm(self.model.backbone)
249 self.device = set_device(config['Global']['device'], numId=numId)
250 self.model.to(device=self.device)
251
252 def _inference_onnx(self, images):
253 # ONNX输入需要为numpy数组

Callers 1

__init__Method · 0.95

Calls 4

load_ckptFunction · 0.90
replace_batchnormFunction · 0.85
set_deviceFunction · 0.70
evalMethod · 0.45

Tested by

no test coverage detected