o
    ߥiL                     @   s~   d dl Z d dlmZmZmZmZ d dlZd dlmZ d dl	m
Z
 d dlmZ d dlmZ ejejejdG dd	 d	e
ZdS )
    N)AnyDictOptionalUnion)Models)
TorchModel)MODELS)Tasks)module_namec                       s*   e Zd Zdef fddZdd Z  ZS )HRNetCrowdCounting	model_dirc                    sd   t  j|fi | ddlm} tj|d}|dd|d}|tj	tj|ddd	 || _
d S )
N   )HighResolutionNetz$average_clip_domain_center_54.97.npzg      ?r   )attn_weight
fix_domaindomain_center_modelzDCANet_final.pthcpu)map_location)super__init__hrnet_aspp_relur   ospathjoinload_state_dicttorchloadmodel)selfr   kwargsHRNet_aspp_relur   net	__class__ `/home/ubuntu/.local/lib/python3.10/site-packages/modelscope/models/cv/crowd_counting/cc_model.pyr      s"   
zHRNetCrowdCounting.__init__c                 C   s
   |  |S )N)r   )r   inputsr$   r$   r%   forward#   s   
zHRNetCrowdCounting.forward)__name__
__module____qualname__strr   r'   __classcell__r$   r$   r"   r%   r      s    r   )r   typingr   r   r   r   r   modelscope.metainfor   'modelscope.models.base.base_torch_modelr   modelscope.models.builderr   modelscope.utils.constantr	   register_modulecrowd_countingr   r$   r$   r$   r%   <module>   s   