
    uj                        d dl mZmZmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZmZmZ  ed          Z G d de          Zi e	j        ej        ge	j        ej        ge	j        ej        ge	j        ej        ge	j        ej        ge	j        ej        ge	j        ej        ge	j        ej        ge	j        ej        ge	j        ej        ge	j         ej!        ge	j"        ej#        ge	j$        ej%        ge	j&        ej'        ge	j(        ej)        ge	j*        ej)        ge	j+        ej,        ge	j-        ej.        ge	j/        ej0        ge	j1        ej2        ge	j3        ej4        ge	j5        ej6        ge	j7        ej8        ge	j9        ej)        ge	j:        ej;        ge	j<        ej=        ge	j>        ej?        gi
Z@ed	fd
eeAef         deAdeBfdZCd	S )    )DictMappingUnion)Metrics)
ConfigDict)Tasks)Registrybuild_from_cfgdefault_groupmetricsc                       e 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dZdZdZdZdZdZ dZ!d Z"d!Z#d"S )#
MetricKeysaccuracyf1z	binary-f1zmacro-f1zmicro-f1	precisionrecallpsnrssimlpipsniqeavg_lossfscorefidzbleu-1zbleu-4zrouge-1zrouge-lnedmAPinbatch_t2i_recall_at_1cropping_ratiodistortion_valuestability_scorepplplccsrccrmsemrrndcgARcolorfulnesskendall_tau_correlationN)$__name__
__module____qualname__ACCURACYF1	Binary_F1Macro_F1Micro_F1	PRECISIONRECALLPSNRSSIMLPIPSNIQEAVERAGE_LOSSFScoreFIDBLEU_1BLEU_4ROUGE_1ROUGE_LNEDr   BatchAccCROPPING_RATIODISTORTION_VALUESTABILITY_SCOREPPLPLCCSRCCRMSEMRRNDCGr&   ColorfulnessKendall_Tau_Correlation     j/lsinfo/ai/hellotax_ai/data_center/backend/venv/lib/python3.11/site-packages/modelscope/metrics/builder.pyr   r      s        H	BIHHIFDDEDLF
CFFGG
C
C(H%N)'O
CDDD
CD	B!L7rL   r   N
metric_cfgfielddefault_argsc                     t          | t                    rd| v sJ nt          d| i          } t          | t          ||          S )a/   Build metric given metric_name and field.

    Args:
        metric_name (str | dict): The metric name or metric config dict.
        field (str, optional):  The field of this metric, default value: 'default' for all fields.
        default_args (dict, optional): Default initialization arguments.
    type)	group_keyrP   )
isinstancer   r   r
   METRICS)rN   rO   rP   s      rM   build_metricrV   T   s`     *g&& 6##### 455
Gu<I I I IrL   )Dtypingr   r   r   modelscope.metainfor   modelscope.utils.configr   modelscope.utils.constantr   modelscope.utils.registryr	   r
   r   rU   objectr   image_segmentationimage_ins_seg_coco_metricsentence_similarityseq_cls_metricnlisentiment_classificationtoken_classificationtoken_cls_metrictext_generationtext_gen_metricchattext_classificationimage_denoisingimage_denoise_metricimage_deblurringvideo_super_resolutionvideo_super_resolution_metricimage_color_enhancementimage_color_enhance_metricimage_portrait_enhancement!image_portrait_enhancement_metricvideo_summarizationvideo_summarization_metricimage_captioningr   visual_question_answeringmovie_scene_segmentationmovie_scene_segmentation_metricimage_inpaintingimage_inpainting_metric#referring_video_object_segmentation*referring_video_object_segmentation_metricvideo_frame_interpolation video_frame_interpolation_metricvideo_stabilizationvideo_stabilization_metric$image_quality_assessment_degradation+image_quality_assessment_degradation_metricimage_quality_assessment_mos#image_quality_assessment_mos_metricbad_image_detectingocr_recognitionocr_recognition_metricefficient_diffusion_tuningloss_metrictranslation_evaluationtranslation_evaluation_metrictask_default_metricsstrdictrV   rK   rL   rM   <module>r      s   ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' . . . . . . + + + + + + M M M M M M M M M M
(9

!8 !8 !8 !8 !8 !8 !8 !8H!	w@A!	 67! 
I&'! 
"W%;$<	!
 
!9 :! 
G34! 
J()! 
 67! 
G89! 
W9:! 
 7#H"I! 
!G$F#G! 
$./! 
 BC!  
W-.!!" 
#g&6%7#!$ 
"W%L$M%!& 
W<=	-78	#-.	 BC	.89	&01	 01	G:;	$w':&;	 7#H"IA! ! J ,&*I IU39- II#I I I I I IrL   