o
    _{j  ã                   @   s   d dl mZ dd„ ZdS )é    )Úsoft_nmsc                 C   sÔ   t | ƒdkrt| ||||ƒ} | | dd…df  ¡ ddd…  } t|d | | ƒ|d  |d  }g }tt|t | ƒƒƒD ]+}	i }
t| |	df ƒ|
d< td| |	df ƒ| td| |	df ƒ| g|
d< | |
¡ q<|S )	a  Post process for temporal proposals generation.

    Args:
        result (np.ndarray): Proposals generated by network.
        video_info (dict): Meta data of video. Required keys are
            'duration_frame', 'duration_second'.
        soft_nms_alpha (float): Alpha value of Gaussian decaying function.
        soft_nms_low_threshold (float): Low threshold for soft nms.
        soft_nms_high_threshold (float): High threshold for soft nms.
        post_process_top_k (int): Top k values to be considered.
        feature_extraction_interval (int): Interval used in feature extraction.

    Returns:
        list[dict]: The updated proposals, e.g.
            [{'score': 0.9, 'segment': [0, 1]},
             {'score': 0.8, 'segment': [0, 2]},
            ...].
    é   NéÿÿÿÿÚduration_frameÚduration_secondÚscorer   Úsegment)Úlenr   ÚargsortÚfloatÚrangeÚminÚmaxÚappend)ÚresultÚ
video_infoÚsoft_nms_alphaÚsoft_nms_low_thresholdÚsoft_nms_high_thresholdÚpost_process_top_kÚfeature_extraction_intervalÚvideo_durationÚproposal_listÚjÚproposal© r   úF/root/disk_3tb/HAC/mmaction/models/localizers/utils/post_processing.pyÚpost_processing   s.   ÿ"
ÿÿýýþr   N)Zmmaction.localizationr   r   r   r   r   r   Ú<module>   s    