Ë
    »dæj  ã                   ó¤   — d Z ddlZddlmZmZ ddlZddlmZ ddl	m
Z
 ej                   G d„ d«      «       Zej                   G d„ d	«      «       Zy)
zEmbeddings data class.é    N)ÚListÚOptional)Úembedding_result_c)Údoc_controlsc                   óX   — e Zd ZU dZej
                  ed<   dZee	   ed<   dZ
ee   ed<   y)Ú	Embeddingaš  Embedding result for a given embedder head.

  Attributes:
    embedding: The actual embedding, either floating-point or scalar-quantized.
    head_index: The index of the embedder head that produced this embedding.
      This is useful for multi-head models.
    head_name: The name of the embedder head, which is the corresponding tensor
      metadata name (if any). This is useful for multi-head models.
  Ú	embeddingNÚ
head_indexÚ	head_name)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnpÚndarrayÚ__annotations__r
   r   Úintr   Ústr© ó    ú€/root/repos/pocs/video-evals/.venv/lib/python3.12/site-packages/mediapipe/tasks/python/components/containers/embedding_result.pyr   r      s/   … ñð �Z‰ZÓØ"€*ˆh�s‰mÓ"Ø!€)ˆX�c‰]Ô!r   r   c                   ó‚   — e Zd ZU dZee   ed<   dZee	   ed<   e
ej                  dej                  dd fd„«       «       Zy)ÚEmbeddingResulta%  Embedding results for a given embedder model.

  Attributes:
    embeddings: A list of `Embedding` objects.
    timestamp_ms: The optional timestamp (in milliseconds) of the start of the
      chunk of data corresponding to these results. This is only used for
      embedding extraction on time series (e.g. audio embedding). In these use
      cases, the amount of data to process might exceed the maximum size that
      the model can process: to solve this, the input data is split into
      multiple chunks starting at different timestamps.
  Ú
embeddingsNÚtimestamp_msÚc_resultÚreturnc                 ó†  — g }t        |j                  «      D �]   }|j                  |   }d}|j                  r=t	        |j                  d|j
                   «      }t        j                  |t        ¬«      }|j                  rGt	        |j                  d|j
                   «      }t        j                  |t        j                  ¬«      }t        ||j                  |j                  r|j                  j                  d«      nd¬«      }|j                  |«       �Œ |j                   r|j"                  nd}t%        ||¬«      S )z9Converts a C EmbeddingResult to a Python EmbeddingResult.N)Údtypezutf-8)r	   r
   r   )r   r   )ÚrangeÚembeddings_countr   Úfloat_embeddingÚlistÚvalues_countr   ÚarrayÚfloatÚquantized_embeddingÚuint8r   r
   r   ÚdecodeÚappendÚhas_timestamp_msr   r   )	Úclsr   Úpython_embeddingsÚiÚc_embeddingr	   Úembedding_arrayÚpython_embeddingr   s	            r   Úfrom_ctypeszEmbeddingResult.from_ctypes;   s*  € ð ÐÜ�8×,Ñ,Ó-ó 1ˆØ×'Ñ'¨Ñ*€kØ€iØ	×	$Ò	$ÜØ×'Ñ'Ð(B¨+×*BÑ*BÐCó
ˆô —H‘H˜_´EÔ:ˆ	Ø	×	(Ò	(ÜØ×+Ñ+Ð,F¨k×.FÑ.FÐGó
ˆô —H‘H˜_´B·H±HÔ=ˆ	ä"ØØ ×+Ñ+ð ×&Ò&ð ×#Ñ#×*Ñ*¨7Ô3àôÐð ×ÑÐ/Ö0ð/1ð0 -5×,EÒ,E�8×(Ò(È4€LÜØ$°<ôð r   )r   r   r   r   r   r   r   r   r   r   Úclassmethodr   Údo_not_generate_docsr   ÚEmbeddingResultCr2   r   r   r   r   r   *   sW   … ñ
ð �9‰oÓØ $€,�˜‘Ó$àØ×$Ñ$ð Ø'×8Ñ8ð àò ó %ó ñ r   r   )r   ÚdataclassesÚtypingr   r   Únumpyr   Ú,mediapipe.tasks.python.components.containersr   Ú1mediapipe.tasks.python.core.optional_dependenciesr   Ú	dataclassr   r   r   r   r   ú<module>r<      sW   ðñ ã ß !ã å KÝ Jð ×Ñ÷"ð "ó ð"ð  ×Ñ÷2ð 2ó ñ2r   