a
    yf                     @   sb  d Z ddlmZ ddlmZ dd Zdd Zdd	 Zd
d Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zd d! Zd"d# Zd$d% Zd&d' Zd(d) Zd*d+ Zd,d- Zd.d/ Zd0d1 Zd2d3 Zd4d5 Zegegegege	ge
gegegegegegegegegegegegegegegegegegegegd6Zd7d8 Zd9d: Z d;S )<zBase callbacks.    )defaultdict)deepcopyc                 C   s   dS )z-Called before the pretraining routine starts.N Ztrainerr   r   \/var/www/html/django/DPS/env/lib/python3.9/site-packages/ultralytics/utils/callbacks/base.pyon_pretrain_routine_start
   s    r   c                 C   s   dS )z*Called after the pretraining routine ends.Nr   r   r   r   r   on_pretrain_routine_end   s    r   c                 C   s   dS )z Called when the training starts.Nr   r   r   r   r   on_train_start   s    r	   c                 C   s   dS )z+Called at the start of each training epoch.Nr   r   r   r   r   on_train_epoch_start   s    r
   c                 C   s   dS )z+Called at the start of each training batch.Nr   r   r   r   r   on_train_batch_start   s    r   c                 C   s   dS )z'Called when the optimizer takes a step.Nr   r   r   r   r   optimizer_step#   s    r   c                 C   s   dS )z,Called before the gradients are set to zero.Nr   r   r   r   r   on_before_zero_grad(   s    r   c                 C   s   dS )z)Called at the end of each training batch.Nr   r   r   r   r   on_train_batch_end-   s    r   c                 C   s   dS )z)Called at the end of each training epoch.Nr   r   r   r   r   on_train_epoch_end2   s    r   c                 C   s   dS )z2Called at the end of each fit epoch (train + val).Nr   r   r   r   r   on_fit_epoch_end7   s    r   c                 C   s   dS )zCalled when the model is saved.Nr   r   r   r   r   on_model_save<   s    r   c                 C   s   dS )zCalled when the training ends.Nr   r   r   r   r   on_train_endA   s    r   c                 C   s   dS )z-Called when the model parameters are updated.Nr   r   r   r   r   on_params_updateF   s    r   c                 C   s   dS )z3Called during the teardown of the training process.Nr   r   r   r   r   teardownK   s    r   c                 C   s   dS )z"Called when the validation starts.Nr   	validatorr   r   r   on_val_startS   s    r   c                 C   s   dS )z-Called at the start of each validation batch.Nr   r   r   r   r   on_val_batch_startX   s    r   c                 C   s   dS )z+Called at the end of each validation batch.Nr   r   r   r   r   on_val_batch_end]   s    r   c                 C   s   dS )z Called when the validation ends.Nr   r   r   r   r   
on_val_endb   s    r   c                 C   s   dS )z"Called when the prediction starts.Nr   Z	predictorr   r   r   on_predict_startj   s    r   c                 C   s   dS )z-Called at the start of each prediction batch.Nr   r   r   r   r   on_predict_batch_starto   s    r   c                 C   s   dS )z+Called at the end of each prediction batch.Nr   r   r   r   r   on_predict_batch_endt   s    r   c                 C   s   dS )z8Called after the post-processing of the prediction ends.Nr   r   r   r   r   on_predict_postprocess_endy   s    r   c                 C   s   dS )z Called when the prediction ends.Nr   r   r   r   r   on_predict_end~   s    r    c                 C   s   dS )z$Called when the model export starts.Nr   Zexporterr   r   r   on_export_start   s    r"   c                 C   s   dS )z"Called when the model export ends.Nr   r!   r   r   r   on_export_end   s    r#   )r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r"   r#   c                   C   s   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   r   get_default_callbacks   s    r&   c              
   C   s   ddl m} |g}d| jjv rd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}
 ||||||||	|
g |D ]4}| D ]&\}}|| j| vr| j| | qqdS )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.
       )	callbacksZTrainerN)Zhubr(   	__class____name__ZclearmlcometZdvcZmlflowZneptuneZraytuneZtensorboardwbextenditemsappend)instanceZhub_cbZcallbacks_listZclear_cbZcomet_cbZdvc_cbZ	mlflow_cbZ
neptune_cbZtune_cbZtb_cbZwb_cbr(   kvr   r   r   add_integration_callbacks   s     	r3   N)!__doc__collectionsr   copyr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r"   r#   r%   r&   r3   r   r   r   r   <module>   sn   !
