o
    rqi                     @   s  d dl mZmZ d dlmZmZ d dlmZmZm	Z	 d dl
Zd dlZd dlmZ G dd deZi ejeejejejee ejeejeejee ejejejejejeej ejeejejejejej ejej!eej ej"eej ej#ejej$ei ej%ej&ej'eej(dej)eej ej*d	ej+d
ej,eej ej-d
ej.eej/ejej0ejej1ejej2ee ej3ejej4eej5eej6eji ej7eej ej8ejej9eej:ejej;ejej<ejej=ejej>ejej?ejej@eejAeejBee ejCeejDeejEeejFeejGeejHeIejJeIejKeeI ejLeeI ejMeej ejNejejOejejPeejQeej i	ZRi ejddiejdddidejdddidejddiejddiejdddidejdddidejdddidejddddiddejddiejdddidejdddidej dddidej!ddddiddej"ddddiddej#dddidej$ddii ej%dddidej'ddiej(dddej)dddddej*dddej+dddej,dddddej-dddej.ddiej/dddidej0dddidej1dddidej2dddidej3dddidej4ddiej5ddiej6dddidi ej7ddddiddej8dddidej9ddiej:dddidej;dddidej<dddidej?dddidej@ddiejAddiejBdddidejCddiejDddiejEddiejFddiejGddiejHddiejJddiejKdddidejLdddidejMddddiddejNdddidejOdddidejPddiejQddddiddiZSi ejTejej(ej3gejUej%gejVej%gejWej%ejgejXej%ej$gejYej%ejej)ejej#gejZej$gej[ej$gej\ej$gej]ej0ej3gej^ejejejgej_ejejejgej`ejejejgejaejgejbejej gejcejejgejdejejgi ejeejejgejfejejgejgej(ejejejgejhejejgejiej0gejjejejejgejkej(gejlejejgejmejejejgejnejejejgejoejejejgejpejejejgejqej(gejrejejej gejsejejej ejej@gejtej gejuej(gi ejvej(gejwej(gejxej(gejyejgejze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jej(gejej(gejejej(gejej(gejej(gejej(gejej(gi ejej(gejej(gejej(gejej(gejej*gejej*gejej*gejej'gejej'gejej'gejej*gejej'gejej(gejejejgejejejgejejgejejejejgi ejejejGej*gejejejgejej'gejej'gejej'gejej'gejej'gejej'gejej'gejejejgejejejGgejejejejGgejejejgejejejgejej0gejej:gejej;ej=ej<ej>ej?gi ejej*gejej(gejej gejej gejejHejLejJejKgejejejgejej'gejej ejGej*gejej ej*gejejejgejejejgejejejgejejejgejejejgejej2gejej4gejej'gi ejej'gejej'gejej'gejej'gejej3ejgejejgejej$gejej5ejEgejej$gejej$gejej$gejej$gejej3gejej'gejej'gejej$gejej$gi ejejgejejejgejej$gejej$gejejej$ej6gejej$gejej$gejej+gejej+gejej+gejej,gejej-gejejBgejejgejejgejZej$gejejejgi ejej)gejej-gejej0ej3gejej0ej3ejgejej0ej3ejgejej$gejej$gejej$gejej$gejejejgejejGejejejgejej'gejej0gejej'gejej'gejejejejgejej'ejgi ejej gejej(gejejgejej gejejej*gejejejgejejejgejej$gejej'gejej'gejejejPgejej*gejej(gejej(gejej(gejej)gejejQgejej'giZG dd deZdS )    )OrderedDict
namedtuple)	dataclassfields)DictListTupleN)Tasksc                   @   s  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"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1d0Z2d1Z3d2Z4d3Z5d4Z6d5Z7d6Z8d7Z9d8Z:d9Z;d:Z<d;Z=d<Z>d=Z?d>Z@d?ZAd@ZBdAS )B
OutputKeysZlossZlogitsZscoresZscorelabellabelsZ	input_idsZ	label_posZposescaptionZboxesZ	keypointsmasksZdepthsZdepths_colorZflowsZflows_colorZnormalsZnormals_colorZlayouttextZpolygonsoutputZ
output_imgZoutput_imgsZoutput_videoZ
output_pcmZoutput_pcm_listZ
output_wavZ
output_objZoutput_meshZimg_embeddingZspk_embeddingZspo_listZtext_embeddingtranslationresponseZ
predictionZpredictionsZprobabilitiesZdialog_statesvideo_embeddingZphrase_prototypeZobject_prototypeZsentence_prototypeZevent_prototypeZtextvideo_simuuidwordZkws_listZ
sql_stringZ	sql_queryhistoryZquery_resultZ
timestampsZshot_numZ	scene_numZscene_meta_listZshot_meta_listmatchesZpcd12Zpcd12_alignZtboundsZMViewsN)C__name__
__module____qualname__LOSSLOGITSSCORESSCORELABELLABELS	INPUT_IDS	LABEL_POSPOSESCAPTIONBOXES	KEYPOINTSMASKSDEPTHSDEPTHS_COLORZFLOWSZFLOWS_COLORZNORMALSZNORMALS_COLORLAYOUTTEXTPOLYGONSOUTPUT
OUTPUT_IMGOUTPUT_IMGSOUTPUT_VIDEO
OUTPUT_PCMOUTPUT_PCM_LIST
OUTPUT_WAV
OUTPUT_OBJOUTPUT_MESHIMG_EMBEDDINGSPK_EMBEDDINGSPO_LISTTEXT_EMBEDDINGTRANSLATIONRESPONSE
PREDICTIONPREDICTIONSPROBABILITIESDIALOG_STATESVIDEO_EMBEDDINGPHRASE_PROTOTYPEOBJECT_PROTOTYPESENTENCE_PROTOTYPEEVENT_PROTOTYPETEXTVIDEO_SIMUUIDWORDKWS_LIST
SQL_STRING	SQL_QUERYHISTORYQUERY_RESULT
TIMESTAMPSSHOT_NUM	SCENE_NUMSCENE_META_LISTSHOT_META_LISTMATCHESPCD12PCD12_ALIGNTBOUNDSMV_IMGS rW   rW   a/home/app/PaddleOCR-VL/.venv_paddleocr/lib/python3.10/site-packages/modelscope/outputs/outputs.pyr
      s    r
   imagebytesZpcmtypenumberarray)r[   itemsstringobjectzThe base64 encoded image.)r[   descriptionzThe base64 encoded video.zThe base64 encoded PCM.zThe base64 encoded WAV.integerc                       s\   e Zd Zdd Zdd Z fddZ fddZ fd	d
Zdd Zdd Z	dd Z
  ZS )ModelOutputBasec                 C   s   |    d| _d S )NT)reconstruct	post_initselfrW   rW   rX   __post_init__z  s   
zModelOutputBase.__post_init__c                 C   s2   |    t|  D ]\}}| t| | q
d S N)clear	enumeratekeysappendgetattr)rg   idxkeyrW   rW   rX   rd   ~  s   zModelOutputBase.reconstructc                    sJ   t |trt| |rt| |S nt |ttfrt |S td| d)Nz	No Index z found in the dataclass.)	
isinstancestrhasattrrn   intslicesuper__getitem__
IndexError)rg   item	__class__rW   rX   rw     s   


zModelOutputBase.__getitem__c                    s   t |trN|dd t| D v rE||  vr#t || |   d S tt| |t|krCt || t 	|  
|| d S d S t || d S t |trit 	|| |  | }t || d S d S )Nc                 S   s   g | ]}|j qS rW   )name.0frW   rW   rX   
<listcomp>  s    z/ModelOutputBase.__setitem__.<locals>.<listcomp>)rq   rr   r   rl   rv   __setattr__rd   idrn   __setitem__indexrt   )rg   rp   valueZkey_namerz   rW   rX   r     s   

zModelOutputBase.__setitem__c                    s&   t | ddr| ||S t ||S )Nre   F)rn   r   rv   r   )rg   rp   r   rz   rW   rX   r     s   zModelOutputBase.__setattr__c                    s    fddt  D S )Nc                    s"   g | ]}t  |jd ur|jqS ri   )rn   r|   r}   rf   rW   rX   r     s    z(ModelOutputBase.keys.<locals>.<listcomp>)r   rf   rW   rf   rX   rl     s   
zModelOutputBase.keysc                 C   s   |    S ri   )to_dictr^   rf   rW   rW   rX   r^     s   zModelOutputBase.itemsc                 C   s&   t  }|  D ]	}t| |||< q|S ri   )r   rl   rn   )rg   r   rp   rW   rW   rX   r     s   zModelOutputBase.to_dict)r   r   r   rh   rd   rw   r   r   rl   r^   r   __classcell__rW   rW   rz   rX   rc   x  s    rc   )collectionsr   r   dataclassesr   r   typingr   r   r   numpynpZtorchZmodelscope.utils.constantr	   r`   r
   r   floatr   Zndarrayr   r   r   rr   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r]   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rt   rO   rP   rQ   rR   rS   rT   rU   rV   ZOutputTypesZOutputTypeSchemaZtask_templateZocr_detectionZtable_recognitionZlineless_table_recognitionZlicense_plate_detectionZcard_detection_correctionZocr_recognitionZsudokuZtext2sqlZdocument_vl_embeddingZface_2d_keypointsZface_detectionZcard_detectionZcontent_checkZimage_driving_perceptionZface_livenessZface_quality_assessmentZfacial_expression_recognitionZgeneral_recognitionZface_processing_baseZface_attribute_recognitionZface_recognitionZhuman_detectionZface_image_generationZimage_classificationZimage_object_detectionZ domain_specific_object_detectionZopen_vocabulary_detectionZvideo_object_detectionZobject_detection_3dZimage_segmentationZvideo_panoptic_segmentationZsemantic_segmentationZportrait_mattingZuniversal_mattingZimage_deblurringZimage_face_fusionZimage_quality_assessment_mosZskin_retouchingZimage_super_resolutionZimage_super_resolution_pasdZimage_colorizationZimage_color_enhancementZimage_denoisingZimage_editingZimage_portrait_enhancementZcrowd_countingZimage_inpaintingZimage_paintbyexampleZcontrollable_image_generationZimage_to_image_generationZimage_to_image_translationZimage_style_transferZimage_portrait_stylizationZimage_body_reshapingZvideo_frame_interpolationZvideo_super_resolutionZvideo_deinterlaceZnerf_recon_accZnerf_recon_vq_compressionZsurface_recon_commonZvideo_colorizationZimage_control_3d_portraitZ self_supervised_depth_completionZ$image_quality_assessment_degradationZlive_categoryZaction_recognitionZbody_2d_keypointsZbody_3d_keypointsZ pedestrian_attribute_recognitionZface_reconstructionZhuman3d_renderZhuman3d_animationZhead_reconstructionZtext_to_headZhuman_reconstructionZtext_texture_generationZhand_2d_keypointsZvideo_single_object_trackingZvideo_multi_object_trackingZvideo_categoryZproduct_retrieval_embeddingr   Ztext_video_retrievalZvideo_stabilizationZvirtual_try_onZtext_driven_segmentationZshop_segmentationZmovie_scene_segmentationZhuman_wholebody_keypointZvideo_summarizationZ#referring_video_object_segmentationZvideo_human_mattingZtext_classificationZsentence_similarityZnliZsentiment_classificationZzero_shot_classificationZrelation_extractionr   Zword_segmentationZnamed_entity_recognitionZpart_of_speechZtext_error_correctionZword_alignmentZsentence_embeddingZtext_rankingZtext_generationZchatZfid_dialogueZtext_summarizationZtext2text_generationZ	fill_maskZfeature_extractionZtask_oriented_conversationZtable_question_answeringZauto_speech_recognitionZinverse_text_processingZspeaker_verificationZ&speaker_diarization_dialogue_detectionZspeech_language_recognitionpunctuationZ3speaker_diarization_semantic_speaker_turn_detectionZlanguage_score_predictionZspeech_timestampZspeech_signal_processZacoustic_echo_cancellationZacoustic_noise_suppressionZspeech_separationZtext_to_speechZkeyword_spottingZimage_captioningZvideo_captioningZvisual_groundingZtext_to_image_synthesisZmulti_modal_embeddingZ generative_multi_modal_embeddingZmulti_modal_similarityZvisual_question_answeringZvideo_question_answeringZmultimodal_dialogueZvisual_entailmentZaction_detectionZfaq_question_answeringZimage_reid_personZvideo_inpaintingZhand_staticZface_human_hand_detectionZface_emotionZproduct_segmentationZimage_skychangeZtranslation_evaluationZvideo_object_segmentationZmotion_generationZbad_image_detectingZvision_efficient_tuningZ!document_grounded_dialog_generateZdocument_grounded_dialog_rerankZ"document_grounded_dialog_retrievalZvideo_temporal_groundingZtext_to_video_synthesisZtext_to_360panorama_imageZimage_try_onZhuman_image_generationZimage_view_transformZimage_to_3dZsiamese_uieZTASK_OUTPUTSlistrc   rW   rW   rW   rX   <module>   s  C

	
 !"#$%&'()*+,-.
/012345

@
"(14:@FOX^agjnuy}   	          $  *  -  0  6  ?  E  H  N  T  Z  `  c  f  l  o  r  u  x  {  ~   	    1





 
5H[
bqx 
  	      
!  .  
5  <  H  J  L  f  
m  w       
    
%    
&    
'    
(    
,    
0    
1    
2    
3    
4    
5    
6    
7    8    
9    
:    
;    
?    
@    
A    
B    
C    
G    
H    
I    
J    
K    
L    
M    
N    
O    V    _    
e    y           !      
6      
7      
8      
I      
[      
e      
m      |               !        *        1        
7        
=        S        
[        
a        
h        
o                             
)          2          ;          D          K          R          Y          `          
h          
n          
w           
            
            
	            
                        
            
                        
#            
)            
/            
5            
E             
              
              
              
              
                             
#              
'              /              
>              
N              
T              
U              
V              
W              
]              
j              
r              
x              
y                               
                
                                "                ,                
2                
6                
:                
@                F                N                
^                
d                
i                
n                t                {                 
                  
	                  
                  
                                                       '                  
(                  
)                  
*                  +                  
,                  
-                  
3                  
8                  
=                  
>                  
?                  C