
    9i                     >    S SK Jr  SSKJr  SSKJr   " S S\5      rg)	   )logging   )BaseTrainer   )MODELSc                   6    \ rS rSrSr\rS rS rS\	4S jr
Srg)	
DetTrainer   zObject Detection Model Trainerc                    SU R                   ;   a  U R                   R                  OSnSU R                   R                  ;   a  U R                   R                  S   OSnU R                   R                  U R                  R
                  SUUS9  g)zupdate dataset settingsmetricCOCOdata_fieldsNCOCODetDataset)r   r   )
pdx_configr   TrainDatasetupdate_datasetglobal_configdataset_dir)selfr   r   s      h/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/paddlex/modules/object_detection/trainer.py_update_datasetDetTrainer._update_dataset   s    +3t+F''F  < << OO((7 	 	&&**#	 	' 	
    c                    U R                   R                  (       a/  U R                  R                  U R                   R                  5        U R                   R                  (       a/  U R                  R                  U R                   R                  5        U R                  5         U R                   R                  b/  U R                  R                  U R                   R                  5        U R                   R                  (       aI  U R                   R                  S:w  a/  U R                  R                  U R                   R                  5        U R                   R                  b/  U R                  R                  U R                   R                  5        U R                   R                  b/  U R                  R                  U R                   R                  5        U R                   R                  bF  U R                  R!                  U R                   R                  5        U R                   R                  nOU R                  R#                  5       nU R                   R$                  b/  U R                  R'                  U R                   R$                  5        U R(                  R*                  b/  U R                  R-                  U R(                  R*                  5        SU R(                  R.                  ;   a5  [1        [3        US-  5      S5      n U R                  R5                  U5        gg! [6         a1    [8        R:                  " SU R(                  R.                   S35         gf = f)zupdate training configN PicoDet
   r   z
The model(z1) don't support to update_static_assigner_epochs!)train_configlog_intervalr   update_log_intervaleval_intervalupdate_eval_intervalr   num_classesupdate_num_classpretrain_weight_pathupdate_pretrained_weights
batch_sizeupdate_batch_sizelearning_rateupdate_learning_rateepochs_itersupdate_epochsget_epochs_iterswarmup_stepsupdate_warmup_stepsr   outputupdate_save_dirmodelmaxintupdate_static_assigner_epochs	Exceptionr   info)r   r+   assigner_epochss      r   update_configDetTrainer.update_config*   sn   ))OO//0A0A0N0NO**OO001B1B1P1PQ((4OO,,T->->-J-JK22!!66"<OO55!!66 ''3OO--d.?.?.J.JK**6OO001B1B1P1PQ))5OO))$*;*;*H*HI,,99L??;;=L))5OO//0A0A0N0NO$$0OO++D,>,>,E,EF**000!#lR&7"8!<O==oN 1   !3!3!9!9 ::kls   L. .8M)(M)returnc                 :   SU R                  5       0nU R                  R                  b3  U R                  R                  S:w  a  U R                  R                  US'   U R                  R                  SS5      US'   U R                  R                  SS5      US'   U$ )zkget key-value arguments of model training function

Returns:
    dict: the arguments of training function.
devicer   resume_pathdy2stFampOFF)
get_devicer   r>   get)r   
train_argss     r   get_train_kwargsDetTrainer.get_train_kwargsS   s      12
))5!!--3(,(9(9(E(EJ}%"//33GUC
7 --11%?
5r    N)__name__
__module____qualname____firstlineno____doc__r   entitiesr   r9   dictrE   __static_attributes__rG   r   r   r	   r	      s!    (H
 'R$ r   r	   N)utilsr   baser   
model_listr   r	   rG   r   r   <module>rS      s       M Mr   