(self, model_name, session_options=None)
| 123 | self.lp_lip_array = self.face_editors.lp_lip_array |
| 124 | |
| 125 | def load_model(self, model_name, session_options=None): |
| 126 | with self.model_lock: |
| 127 | self.main_window.model_loading_signal.emit() |
| 128 | # QApplication.processEvents() |
| 129 | # if not is_file_exists(self.models_path[model_name]): |
| 130 | # download_file(model_name, self.models_path[model_name], self.models_data[model_name]['hash'], self.models_data[model_name]['url']) |
| 131 | if session_options is None: |
| 132 | model_instance = onnxruntime.InferenceSession(self.models_path[model_name], providers=self.providers) |
| 133 | else: |
| 134 | model_instance = onnxruntime.InferenceSession(self.models_path[model_name], sess_options=session_options, providers=self.providers) |
| 135 | |
| 136 | # Check if another thread has already loaded an instance for this model, if yes then delete the current one and return that instead |
| 137 | if self.models[model_name]: |
| 138 | del model_instance |
| 139 | gc.collect() |
| 140 | return self.models[model_name] |
| 141 | self.main_window.model_loaded_signal.emit() |
| 142 | |
| 143 | return model_instance |
| 144 | |
| 145 | def load_dfm_model(self, dfm_model): |
| 146 | with self.model_lock: |
no outgoing calls
no test coverage detected