
    {-j                     F    d dl mZ d dlZddlmZmZ  G d de          ZdS )    )DictN   )BaseCVResult	JsonMixinc                   p    e Zd ZdZdeeej        f         fdZdeeef         fdZ	deeef         fdZ
dS )SealRecognitionResultzSeal Recognition Resultreturnc                 T   i }| d         }t          |          dk    r|j        d         |d<   | d         }|d         r |j        di | d         j         t          t          | d                             D ]/}| d         |         }|d         }|j        }d	| }|d
         ||<   0|S )Nlayout_det_resr   resmodel_settingsuse_doc_preprocessordoc_preprocessor_resseal_res_listseal_region_idseal_res_regionocr_res_img )lenimgupdaterange)	selfres_img_dictr   r   snoseal_resr   sub_seal_res_dictkeys	            s/var/www/html/banglarbhumi/venv/lib/python3.11/site-packages/paddlex/inference/pipelines/seal_recognition/result.py_to_imgzSealRecognitionResult._to_img   s    ./~""-;-?-FL)*./01 	DLCC$'=">"BCCCT/23344 	A 	ACO,S1H%&67N (4N44C 1- @L    c                    i }| d         |d<   | d         |d<   | d         d         r| d         j         d         |d<   t          | d                   dk    r| d         j         d         |d<   g |d<   t          t          | d                             D ]6}| d         |         }|d                             |j         d                    7t	          j        |g|R i |S )	ax  Converts the instance's attributes to a dictionary and then to a string.

        Args:
            *args: Additional positional arguments passed to the base class method.
            **kwargs: Additional keyword arguments passed to the base class method.

        Returns:
            Dict[str, str]: A dictionary with the instance's attributes converted to strings.
        
input_pathr   r   r   r   r   r   r   )strr   r   appendr   _to_strr   argskwargsdatar   r   s         r   r&   zSealRecognitionResult._to_str+   s
    !,/\!%&6!7 !"89 	S+/0F+G+KE+RD'(t$%&&**%)*:%;%?%FD!" "_T/23344 	> 	>CO,S1H!((e)<==== 7777777r!   c                    i }| d         |d<   | d         |d<   | d         |d<   | d         d         r| d         j         d         |d<   t          | d                   dk    r| d         j         d         |d<   g |d	<   t          t          | d	                             D ]6}| d	         |         }|d	                             |j         d                    7t	          j        |g|R i |S )
a[  
        Converts the object's data to a JSON dictionary.

        Args:
            *args: Positional arguments passed to the JsonMixin._to_json method.
            **kwargs: Keyword arguments passed to the JsonMixin._to_json method.

        Returns:
            Dict[str, str]: A dictionary containing the object's data in JSON format.
        r#   
page_indexr   r   r   r   r   r   r   )jsonr   r   r%   r   _to_jsonr'   s         r   r.   zSealRecognitionResult._to_jsonB   s    !,/\!,/\!%&6!7 !"89 	T+/0F+G+LU+SD'(t$%&&**%)*:%;%@%GD!" "_T/23344 	? 	?CO,S1H!((u)=>>>>!$8888888r!   N)__name__
__module____qualname____doc__r   r$   npndarrayr    r&   r.   r   r!   r   r   r      s        !!c2:o.    $8$sCx. 8 8 8 8.94S> 9 9 9 9 9 9r!   r   )typingr   numpyr3   common.resultr   r   r   r   r!   r   <module>r8      s{              4 4 4 4 4 4 4 4C9 C9 C9 C9 C9L C9 C9 C9 C9 C9r!   