(self, context)
| 16 | class MMtrackHandler(BaseHandler): |
| 17 | |
| 18 | def initialize(self, context): |
| 19 | properties = context.system_properties |
| 20 | self.map_location = 'cuda' if torch.cuda.is_available() else 'cpu' |
| 21 | self.device = torch.device(self.map_location + ':' + |
| 22 | str(properties.get('gpu_id')) if torch.cuda. |
| 23 | is_available() else self.map_location) |
| 24 | self.manifest = context.manifest |
| 25 | |
| 26 | model_dir = properties.get('model_dir') |
| 27 | serialized_file = self.manifest['model']['serializedFile'] |
| 28 | checkpoint = os.path.join(model_dir, serialized_file) |
| 29 | self.config_file = os.path.join(model_dir, 'config.py') |
| 30 | |
| 31 | self.model = init_model(self.config_file, checkpoint, self.device) |
| 32 | self.score_thr = 0.5 |
| 33 | self.initialized = True |
| 34 | |
| 35 | def preprocess(self, data): |
| 36 | videos = [] |
nothing calls this directly
no test coverage detected