[190ca4]: / utils / __pycache__ / callbacks.cpython-37.pyc

Download this file

37 lines (33 with data), 2.6 kB

B

¢—eg
ã@sdZddlZGdd„dƒZdS)z
Callback utils
éNc@s:eZdZdZdd„Zddd„Zddd	„Zd
dœdd
„ZdS)Ú	Callbacksz<"
    Handles all registered callbacks for YOLOv5 Hooks
    cCs8gggggggggggggggggggdœ|_d|_dS)N)Úon_pretrain_routine_startÚon_pretrain_routine_endÚon_train_startÚon_train_epoch_startÚon_train_batch_startÚoptimizer_stepÚon_before_zero_gradÚon_train_batch_endÚon_train_epoch_endÚon_val_startÚon_val_batch_startÚon_val_image_endÚon_val_batch_endÚ
on_val_endÚon_fit_epoch_endÚ
on_model_saveÚon_train_endÚon_params_updateÚteardownF)Ú
_callbacksÚ
stop_training)Úself©rú>/home/iml/Desktop/Talha/YOLOV5_Model/yolov5/utils/callbacks.pyÚ__init__s(
zCallbacks.__init__ÚNcCsR||jks td|›d|j›ƒ‚t|ƒs8td|›dƒ‚|j| ||dœ¡dS)zô
        Register a new action to a callback hook

        Args:
            hook: The callback hook name to register the action to
            name: The name of the action for later reference
            callback: The callback to fire
        zhook 'z' not found in callbacks z
callback 'z' is not callable)ÚnameÚcallbackN)rÚAssertionErrorÚcallableÚappend)rÚhookrrrrrÚregister_action&s	 zCallbacks.register_actioncCs|r|j|S|jS)z–"
        Returns all the registered actions by callback hook

        Args:
            hook: The name of the hook to check, defaults to all
        )r)rr"rrrÚget_registered_actions3sz Callbacks.get_registered_actionsF)ÚthreadcOsf||jks td|›d|j›ƒ‚x@|j|D]2}|rPtj|d||dd ¡q,|d||Žq,WdS)aX
        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: Keyword Arguments to receive from YOLOv5
        zhook 'z' not found in callbacks rT)ÚtargetÚargsÚkwargsÚdaemonN)rrÚ	threadingÚThreadÚstart)rr"r%r'r(ÚloggerrrrÚrun<s
 z
Callbacks.run)rN)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rr#r$r.rrrrr	s


	r)r2r*rrrrrÚ<module>s