o
    ॵ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
OutputKeyslosslogitsscoresscorelabellabels	input_ids	label_posposescaptionboxes	keypointsmasksdepthsdepths_colorflowsflows_colornormals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MViewsN)C__name__
__module____qualname__LOSSLOGITSSCORESSCORELABELLABELS	INPUT_IDS	LABEL_POSPOSESCAPTIONBOXES	KEYPOINTSMASKSDEPTHSDEPTHS_COLORFLOWSFLOWS_COLORNORMALS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 r   r   N/home/ubuntu/.local/lib/python3.10/site-packages/modelscope/outputs/outputs.pyr
      s    r
   imagebytes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selfr   r   r   __post_init__z  s   
zModelOutputBase.__post_init__c                 C   s2   |    t|  D ]\}}| t| | q
d S N)clear	enumeratekeysappendgetattr)r   idxkeyr   r   r   r   ~  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hasattrr   intslicesuper__getitem__
IndexError)r   item	__class__r   r   r     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 r   )name.0fr   r   r   
<listcomp>  s    z/ModelOutputBase.__setitem__.<locals>.<listcomp>)r   r   r   r   r   __setattr__r   idr   __setitem__indexr   )r   r   valuekey_namer   r   r   r     s   

zModelOutputBase.__setitem__c                    s&   t | ddr| ||S t ||S )Nr   F)r   r   r   r   )r   r   r   r   r   r   r     s   zModelOutputBase.__setattr__c                    s    fddt  D S )Nc                    s"   g | ]}t  |jd ur|jqS r   )r   r   r   r   r   r   r     s    z(ModelOutputBase.keys.<locals>.<listcomp>)r   r   r   r   r   r     s   
zModelOutputBase.keysc                 C   s   |    S r   )to_dictr   r   r   r   r   r     s   zModelOutputBase.itemsc                 C   s&   t  }|  D ]	}t| |||< q|S r   )r   r   r   )r   r!   r   r   r   r   r     s   zModelOutputBase.to_dict)rK   rL   rM   r   r   r   r   r   r   r   r   __classcell__r   r   r   r   r   x  s    r   )collectionsr   r   dataclassesr   r   typingr   r   r   numpynptorchmodelscope.utils.constantr	   r   r
   rN   floatrO   ndarrayrP   rQ   rR   r   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   ra   rb   rc   r   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   r|   r}   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   OutputTypesOutputTypeSchematask_templateocr_detectiontable_recognitionlineless_table_recognitionlicense_plate_detectioncard_detection_correctionocr_recognitionsudokutext2sqldocument_vl_embeddingface_2d_keypointsface_detectioncard_detectioncontent_checkimage_driving_perceptionface_livenessface_quality_assessmentfacial_expression_recognitiongeneral_recognitionface_processing_baseface_attribute_recognitionface_recognitionhuman_detectionface_image_generationimage_classificationimage_object_detection domain_specific_object_detectionopen_vocabulary_detectionvideo_object_detectionobject_detection_3dimage_segmentationvideo_panoptic_segmentationsemantic_segmentationportrait_mattinguniversal_mattingimage_deblurringimage_face_fusionimage_quality_assessment_mosskin_retouchingimage_super_resolutionimage_super_resolution_pasdimage_colorizationimage_color_enhancementimage_denoisingimage_editingimage_portrait_enhancementcrowd_countingimage_inpaintingimage_paintbyexamplecontrollable_image_generationimage_to_image_generationimage_to_image_translationimage_style_transferimage_portrait_stylizationimage_body_reshapingvideo_frame_interpolationvideo_super_resolutionvideo_deinterlacenerf_recon_accnerf_recon_vq_compressionsurface_recon_commonvideo_colorizationimage_control_3d_portrait self_supervised_depth_completion$image_quality_assessment_degradationlive_categoryaction_recognitionbody_2d_keypointsbody_3d_keypoints pedestrian_attribute_recognitionface_reconstructionhuman3d_renderhuman3d_animationhead_reconstructiontext_to_headhuman_reconstructiontext_texture_generationhand_2d_keypointsvideo_single_object_trackingvideo_multi_object_trackingvideo_categoryproduct_retrieval_embeddingr4   text_video_retrievalvideo_stabilizationvirtual_try_ontext_driven_segmentationshop_segmentationmovie_scene_segmentationhuman_wholebody_keypointvideo_summarization#referring_video_object_segmentationvideo_human_mattingtext_classificationsentence_similaritynlisentiment_classificationzero_shot_classificationrelation_extractionr.   word_segmentationnamed_entity_recognitionpart_of_speechtext_error_correctionword_alignmentsentence_embeddingtext_rankingtext_generationchatfid_dialoguetext_summarizationtext2text_generation	fill_maskfeature_extractiontask_oriented_conversationtable_question_answeringauto_speech_recognitioninverse_text_processingspeaker_verification&speaker_diarization_dialogue_detectionspeech_language_recognitionpunctuation3speaker_diarization_semantic_speaker_turn_detectionlanguage_score_predictionspeech_timestampspeech_signal_processacoustic_echo_cancellationacoustic_noise_suppressionspeech_separationtext_to_speechkeyword_spottingimage_captioningvideo_captioningvisual_groundingtext_to_image_synthesismulti_modal_embedding generative_multi_modal_embeddingmulti_modal_similarityvisual_question_answeringvideo_question_answeringmultimodal_dialoguevisual_entailmentaction_detectionfaq_question_answeringimage_reid_personvideo_inpaintinghand_staticface_human_hand_detectionface_emotionproduct_segmentationimage_skychangetranslation_evaluationvideo_object_segmentationmotion_generationbad_image_detectingvision_efficient_tuning!document_grounded_dialog_generatedocument_grounded_dialog_rerank"document_grounded_dialog_retrievalvideo_temporal_groundingtext_to_video_synthesistext_to_360panorama_imageimage_try_onhuman_image_generationimage_view_transformimage_to_3dsiamese_uieTASK_OUTPUTSlistr   r   r   r   r   <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