Loop through the registered actions and fire all callbacks on main thread Args: hook: The name of the hook to check, defaults to all args: Arguments to receive from YOLOv5 thread: (boolean) Run callbacks in daemon thread kwargs: Keywo
(self, hook, *args, thread=False, **kwargs)
| 58 | return self._callbacks[hook] if hook else self._callbacks |
| 59 | |
| 60 | def run(self, hook, *args, thread=False, **kwargs): |
| 61 | """ |
| 62 | Loop through the registered actions and fire all callbacks on main thread |
| 63 | |
| 64 | Args: |
| 65 | hook: The name of the hook to check, defaults to all |
| 66 | args: Arguments to receive from YOLOv5 |
| 67 | thread: (boolean) Run callbacks in daemon thread |
| 68 | kwargs: Keyword Arguments to receive from YOLOv5 |
| 69 | """ |
| 70 | |
| 71 | assert hook in self._callbacks, f"hook '{hook}' not found in callbacks {self._callbacks}" |
| 72 | for logger in self._callbacks[hook]: |
| 73 | if thread: |
| 74 | threading.Thread(target=logger['callback'], args=args, kwargs=kwargs, daemon=True).start() |
| 75 | else: |
| 76 | logger['callback'](*args, **kwargs) |
no outgoing calls
no test coverage detected