
    FPh              
       t   d Z ddlmZ ddlmZ d Zd Zd Zd Zd Z	d	 Z
d
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zi degdegdegd egd!e	gd"e
gd#egd$egd%egd&egd'egd(egd)egd*egd+egd,egd-egegegegegegegegegd.Zd/ Zd0 Z y1)2zBase callbacks.    )defaultdict)deepcopyc                      y)z-Called before the pretraining routine starts.N trainers    kC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\ultralytics/utils/callbacks/base.pyon_pretrain_routine_startr
   
           c                      y)z*Called after the pretraining routine ends.Nr   r   s    r	   on_pretrain_routine_endr      r   r   c                      y)z Called when the training starts.Nr   r   s    r	   on_train_startr      r   r   c                      y)z+Called at the start of each training epoch.Nr   r   s    r	   on_train_epoch_startr      r   r   c                      y)z+Called at the start of each training batch.Nr   r   s    r	   on_train_batch_startr      r   r   c                      y)z'Called when the optimizer takes a step.Nr   r   s    r	   optimizer_stepr   #   r   r   c                      y)z,Called before the gradients are set to zero.Nr   r   s    r	   on_before_zero_gradr   (   r   r   c                      y)z)Called at the end of each training batch.Nr   r   s    r	   on_train_batch_endr   -   r   r   c                      y)z)Called at the end of each training epoch.Nr   r   s    r	   on_train_epoch_endr   2   r   r   c                      y)z2Called at the end of each fit epoch (train + val).Nr   r   s    r	   on_fit_epoch_endr   7   r   r   c                      y)zCalled when the model is saved.Nr   r   s    r	   on_model_saver    <   r   r   c                      y)zCalled when the training ends.Nr   r   s    r	   on_train_endr"   A   r   r   c                      y)z-Called when the model parameters are updated.Nr   r   s    r	   on_params_updater$   F   r   r   c                      y)z3Called during the teardown of the training process.Nr   r   s    r	   teardownr&   K   r   r   c                      y)z"Called when the validation starts.Nr   	validators    r	   on_val_startr*   S   r   r   c                      y)z-Called at the start of each validation batch.Nr   r(   s    r	   on_val_batch_startr,   X   r   r   c                      y)z+Called at the end of each validation batch.Nr   r(   s    r	   on_val_batch_endr.   ]   r   r   c                      y)z Called when the validation ends.Nr   r(   s    r	   
on_val_endr0   b   r   r   c                      y)z"Called when the prediction starts.Nr   	predictors    r	   on_predict_startr4   j   r   r   c                      y)z-Called at the start of each prediction batch.Nr   r2   s    r	   on_predict_batch_startr6   o   r   r   c                      y)z+Called at the end of each prediction batch.Nr   r2   s    r	   on_predict_batch_endr8   t   r   r   c                      y)z8Called after the post-processing of the prediction ends.Nr   r2   s    r	   on_predict_postprocess_endr:   y   r   r   c                      y)z Called when the prediction ends.Nr   r2   s    r	   on_predict_endr<   ~   r   r   c                      y)z$Called when the model export starts.Nr   exporters    r	   on_export_startr@      r   r   c                      y)z"Called when the model export ends.Nr   r>   s    r	   on_export_endrB      r   r   r
   r   r   r   r   r   r   r   r   r   r    r"   r$   r&   r*   r,   r.   )r0   r4   r6   r:   r8   r<   r@   rB   c                  <    t        t        t        t                    S )z
    Return a copy of the default_callbacks dictionary with lists as default values.

    Returns:
        (defaultdict): A defaultdict with keys from default_callbacks and empty lists as default values.
    )r   listr   default_callbacksr   r   r	   get_default_callbacksrF      s     tX&7899r   c           
      v   ddl m} |g}d| j                  j                  v rIddlm} ddlm} ddlm} ddlm} ddlm} ddl	m} ddl
m}	 ddlm}
 |j                  |||||||	|
g       |D ]J  }|j                         D ]5  \  }}|| j                  |   vs| j                  |   j                  |       7 L y)z
    Add integration callbacks from various sources to the instance's callbacks.

    Args:
        instance (Trainer, Predictor, Validator, Exporter): An object with a 'callbacks' attribute that is a dictionary
            of callback lists.
       )	callbacksTrainerN)hubrI   	__class____name__clearmlcometdvcmlflowneptuneraytunetensorboardwbextenditemsappend)instancehub_cbcallbacks_listclear_cbcomet_cbdvc_cb	mlflow_cb
neptune_cbtune_cbtb_cbwb_cbrI   kvs                 r	   add_integration_callbacksrf      s     )XN H&&///20,2413*x69jRY[`bghi $	OO%DAq**1--""1%,,Q/ & $r   N)!__doc__collectionsr   copyr   r
   r   r   r   r   r   r   r   r   r   r    r"   r$   r&   r*   r,   r.   r0   r4   r6   r8   r:   r<   r@   rB   rE   rF   rf   r   r   r	   <module>rj      s    # 
	
	
	
	
	
	
	
	
	
	
	
	
	
		
	
	
		
	
	
	
		
	
 &";!< &  78 & ~&	 &
 12 & 12 & ~& & /0 & -. & -. & )* & m_ & \N & )* & 
 &$ \N% && -.' &( )*) &* , **56#=">12%& ((#_A & F:0r   