§
    ezniƒ  ã                   óì   — d dl mZmZmZ 	 erJ ‚ed         du sJ ‚d dlZd dlmZ d dlmZ d dlm	Z	  e
ed¦  «        sJ ‚n# eef$ r dZY nw xY wddd„Zdd„Zd„ Zd„ Zd„ Zd„ Zd„ Zereeeeedœni ZdS )é    )ÚLOGGERÚSETTINGSÚTESTS_RUNNINGÚclearmlTN)ÚTask)ÚPatchPyTorchModelIO)ÚPatchedMatplotlibÚ__version__úDebug SamplesÚreturnc                 óÀ  — ddl }t          j        ¦   «         x}rÂ| D ]Á}|                     ¦   «         r©|                     d|j        ¦  «        }|r't          |                     ¦   «         d         ¦  «        nd}|                     ¦   «          	                    ||j         
                    |                     ¦   «         d¦  «        t          |¦  «        |¬¦  «         ŒÀdS dS )zÜ
    Log files (images) as debug samples in the ClearML task.

    Args:
        files (list): A list of file paths in PosixPath format.
        title (str): A title that groups together images with the same values.
    r   Nz_batch(\d+)Ú )ÚtitleÚseriesÚ
local_pathÚ	iteration)Úrer   Úcurrent_taskÚexistsÚsearchÚnameÚintÚgroupsÚ
get_loggerÚreport_imageÚreplaceÚgroupÚstr)Úfilesr   r   ÚtaskÚfÚitr   s          úƒ/var/www/html/cool-property-finder/image-detection-backend/venv/lib/python3.11/site-packages/ultralytics/utils/callbacks/clearml.pyÚ_log_debug_samplesr$      së   € ð €I€I€IåÔ Ñ"Ô"Ð"€tð DØð 	Dð 	DˆAØ�xŠx‰zŒzð DØ—Y’Y˜~¨q¬vÑ6Ô6�Ø35Ð<�C §	¢	¡¤¨A¤Ñ/Ô/Ð/¸1�	Ø—’Ñ!Ô!×.Ò.°UØ67´f·n²nÀRÇXÂXÁZÄZÐQSÑ6TÔ6TÝ:=¸a¹&¼&Ø9Bð /ñ Dô Dð DøðDð Dð	Dð 	Dó    c                 óJ  — ddl m} ddlm} |                     |¦  «        }|                     ¦   «         }|                     g d¢ddg g ¬¦  «        }|                     |¦  «         t          j	        ¦   «          
                    ¦   «                              | d|d¬¦  «         dS )	z²
    Log an image as a plot in the plot section of ClearML.

    Args:
        title (str): The title of the plot.
        plot_path (str): The path to the saved image file.
    r   N)r   r   é   r'   FÚauto)ÚframeonÚaspectÚxticksÚyticksr   )r   r   ÚfigureÚreport_interactive)Úmatplotlib.imageÚimageÚmatplotlib.pyplotÚpyplotÚimreadr-   Úadd_axesÚimshowr   r   r   Úreport_matplotlib_figure)r   Ú	plot_pathÚmpimgÚpltÚimgÚfigÚaxs          r#   Ú	_log_plotr=   (   sÁ   € ð %Ð$Ð$Ð$Ð$Ð$Ø#Ð#Ð#Ð#Ð#Ð#à
�,Š,�yÑ
!Ô
!€CØ
�*Š*‰,Œ,€CØ	�Š�l�l�l¨E¸&ÈÐTVˆÑ	WÔ	W€BØ‡I‚Iˆc�N„N€NåÔÑÔ×"Ò"Ñ$Ô$×=Ò=ÀEØEGØEHØQVð >ñ Xô Xð Xð Xð Xr%   c           
      óÄ  — 	 t          j        ¦   «         x}r)t          j        d¦  «         t	          j        d¦  «         nHt          j        | j        j        pd| j        j        dgdddddœ¬¦  «        }t          j
        d¦  «         |                     t          | j        ¦  «        d¬	¦  «         dS # t          $ r"}t          j
        d
|› �¦  «         Y d}~dS d}~ww xY w)zURuns at start of pretraining routine; initializes and connects/ logs task to ClearML.NÚYOLOv8TF)ÚpytorchÚ
matplotlib)Úproject_nameÚ	task_nameÚtagsÚ
output_uriÚreuse_last_task_idÚauto_connect_frameworksz‰ClearML Initialized a new task. If you want to run remotely, please add clearml-init and connect your arguments before initializing YOLO.ÚGeneral)r   uV   WARNING âš ï¸� ClearML installed but not initialized correctly, not logging this run. )r   r   r   Úupdate_current_taskr	   ÚinitÚargsÚprojectr   r   ÚwarningÚconnectÚvarsÚ	Exception)Útrainerr    Úes      r#   Úon_pretrain_routine_startrS   >   s  € ðuÝÔ$Ñ&Ô&Ð&ˆ4ð 	kõ  Ô3°DÑ9Ô9Ð9ÝÔ1°$Ñ7Ô7Ð7Ð7å”9¨'¬,Ô*>Ð*JÀ(Ø'.¤|Ô'8Ø#+ *Ø(,Ø05à,1Ø/4ð66ð 66ð7ñ 7ô 7ˆDõ ŒNð jñ kô kð kà�Š•T˜'œ,Ñ'Ô'¨iˆÑ8Ô8Ð8Ð8Ð8øÝð uð uð uÝŒÐsÐpqÐsÐsÑtÔtÐtÐtÐtÐtÐtÐtÐtøøøøðuøøøs   ‚B/B3 Â3
CÂ=CÃCc                 ó  — t          j        ¦   «         x}ró| j        dk    r5t          t	          | j                             d¦  «        ¦  «        d¦  «         |                      | j        d¬¦  «         	                    ¦   «         D ]5\  }}| 
                    ¦   «                              d||| j        ¬¦  «         Œ6| j         	                    ¦   «         D ]7\  }}| 
                    ¦   «                              d||| j        ¬¦  «         Œ6dS dS )	z]Logs debug samples for the first epoch of YOLO training and report current training progress.r'   ztrain_batch*.jpgÚMosaicÚtrain)Úprefix©r   ÚlrN)r   r   Úepochr$   ÚsortedÚsave_dirÚglobÚlabel_loss_itemsÚtlossÚitemsr   Úreport_scalarrY   )rQ   r    ÚkÚvs       r#   Úon_train_epoch_endrd   V   s  € åÔ Ñ"Ô"Ð"€tð QàŒ=˜AÒÐÝ�v gÔ&6×&;Ò&;Ð<NÑ&OÔ&OÑPÔPÐRZÑ[Ô[Ð[à×,Ò,¨W¬]À7Ð,ÑKÔK×QÒQÑSÔSð 	Tð 	T‰DˆAˆqØ�OŠOÑÔ×+Ò+¨G°Q¸ÀWÄ]Ð+ÑSÔSÐSÐSØ”J×$Ò$Ñ&Ô&ð 	Qð 	Q‰DˆAˆqØ�OŠOÑÔ×+Ò+¨D°!°QÀ'Ä-Ð+ÑPÔPÐPÐPðQð Qð	Qð 	Qr%   c                 óø  — t          j        ¦   «         x}rà|                     ¦   «                              dd| j        | j        ¬¦  «         | j                             ¦   «         D ]5\  }}|                     ¦   «                              d||| j        ¬¦  «         Œ6| j        dk    rSddlm	}  || ¦  «                             ¦   «         D ]1\  }}|                     ¦   «          
                    ||¦  «         Œ.dS dS dS )z;Reports model information to logger at the end of an epoch.z
Epoch Time)r   r   Úvaluer   ÚvalrX   r   )Úmodel_info_for_loggersN)r   r   r   ra   Ú
epoch_timerZ   Úmetricsr`   Úultralytics.utils.torch_utilsrh   Úreport_single_value)rQ   r    rb   rc   rh   s        r#   Úon_fit_epoch_endrm   c   s+  € åÔ Ñ"Ô"Ð"€tð <à�ŠÑÔ×'Ò'¨lØ/;Ø.5Ô.@Ø29´-ð 	(ñ 	Aô 	Að 	Að ”O×)Ò)Ñ+Ô+ð 	Rð 	R‰DˆAˆqØ�OŠOÑÔ×+Ò+¨E°1°aÀ7Ä=Ð+ÑQÔQÐQÐQØŒ=˜AÒÐØLÐLÐLÐLÐLÐLØ.Ð.¨wÑ7Ô7×=Ò=Ñ?Ô?ð <ð <‘��1Ø—’Ñ!Ô!×5Ò5°a¸Ñ;Ô;Ð;Ð;ð<ð <ð Ðð<ð <r%   c                 óš   — t          j        ¦   «         r7t          t          | j                             d¦  «        ¦  «        d¦  «         dS dS )z9Logs validation results including labels and predictions.zval*.jpgÚ
ValidationN)r   r   r$   r[   r\   r]   )Ú	validators    r#   Ú
on_val_endrq   s   sO   € åÔÑÔð Vå�6 )Ô"4×"9Ò"9¸*Ñ"EÔ"EÑFÔFÈÑUÔUÐUÐUÐUðVð Vr%   c                 ó´  ‡ — t          j        ¦   «         x}rÁdddgd„ dD ¦   «         ¢}ˆ fd„|D ¦   «         }|D ]}t          |j        |¬¦  «         Œ‰ j        j        j                             ¦   «         D ]-\  }}|                     ¦   «          	                    ||¦  «         Œ.| 
                    t          ‰ j        ¦  «        ‰ j        j        d¬	¦  «         d
S d
S )z5Logs final model and its name on training completion.zresults.pngzconfusion_matrix.pngzconfusion_matrix_normalized.pngc              3   ó    K  — | ]	}|› d �V — Œ
dS )z
_curve.pngN© )Ú.0Úxs     r#   ú	<genexpr>zon_train_end.<locals>.<genexpr>€   s+   è è € Ð?Ð? 1�ÐÐÐÐ?Ð?Ð?Ð?Ð?Ð?r%   )ÚF1ÚPRÚPÚRc                 ó\   •— g | ](}‰j         |z                       ¦   «         ¯‰j         |z  ‘Œ)S rt   )r\   r   )ru   r!   rQ   s     €r#   ú
<listcomp>z on_train_end.<locals>.<listcomp>�   s:   ø€ ÐZÐZÐZ¨A¸7Ô;KÈaÑ;O×:WÒ:WÑ:YÔ:YÐZ�'Ô" QÑ&ÐZÐZÐZr%   )r   r7   F)Ú
model_pathÚ
model_nameÚauto_delete_fileN)r   r   r=   Ústemrp   rj   Úresults_dictr`   r   rl   Úupdate_output_modelr   ÚbestrK   r   )rQ   r    r   r!   rb   rc   s   `     r#   Úon_train_endr…   z   s  ø€ åÔ Ñ"Ô"Ð"€tð uð Ð1Ð3TðAà?Ð?Ð(>Ð?Ñ?Ô?ðAˆð [ÐZÐZÐZ°ÐZÑZÔZˆØð 	1ð 	1ˆAÝ˜AœF¨aÐ0Ñ0Ô0Ð0Ð0àÔ%Ô-Ô:×@Ò@ÑBÔBð 	8ð 	8‰DˆAˆqØ�OŠOÑÔ×1Ò1°!°QÑ7Ô7Ð7Ð7à× Ò ­C°´Ñ,=Ô,=È'Ì,ÔJ[ÐnsÐ ÑtÔtÐtÐtÐtðuð ur%   )rS   rd   rm   rq   r…   )r   )r   N)Úultralytics.utilsr   r   r   r   r   Ú'clearml.binding.frameworks.pytorch_bindr   Úclearml.binding.matplotlib_bindr	   ÚhasattrÚImportErrorÚAssertionErrorr$   r=   rS   rd   rm   rq   r…   Ú	callbacksrt   r%   r#   ú<module>r�      s’  ðð >Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =ðØÐÐÐØ�IÔ $Ð&Ð&Ð&Ð&Ø€N€N€NØÐÐÐÐÐØKÐKÐKÐKÐKÐKØAÐAÐAÐAÐAÐAàˆ7�7˜MÑ*Ô*Ð*Ð*Ð*Ð*øà�^Ð$ð ð ð Ø€G€G€GðøøøðDð Dð Dð Dð Dð*Xð Xð Xð Xð,uð uð uð0
Qð 
Qð 
Qð<ð <ð <ð Vð Vð Vðuð uð uð, &-ð5Ø!:Ø,Ø(ØØ ð"ð "ð "ð
 35ð 
€	€	s   Œ4A Á	AÁA