Wrapper to initialize text detection model. This model includes contructing and weight loading. Parameters ---------- model_config : dict Configuration dictionary. weight_path : str Path to trained weight. Returns
(self, model_config, weight_path)
| 174 | self.model = Configurable.construct_class_from_config(config).structure.builder.build(self.device) |
| 175 | |
| 176 | def initialize_model(self, model_config, weight_path): |
| 177 | ''' |
| 178 | Wrapper to initialize text detection model. This model includes contructing |
| 179 | and weight loading. |
| 180 | |
| 181 | Parameters |
| 182 | ---------- |
| 183 | model_config : dict |
| 184 | Configuration dictionary. |
| 185 | weight_path : str |
| 186 | Path to trained weight. |
| 187 | |
| 188 | Returns |
| 189 | ------- |
| 190 | None. |
| 191 | ''' |
| 192 | self.construct_model(model_config) |
| 193 | self.load_weight(weight_path) |
| 194 | if isinstance(self.model.model, torch.nn.DataParallel) and self.device == 'cpu': |
| 195 | self.model.model = self.model.model.module.to(self.device) |
| 196 | |
| 197 | def get_cv2_image(self, image): |
| 198 | ''' |
no test coverage detected