o
    Vh
                     @   s:   d dl Z d dlmZ d dlmZ dgZG dd deZdS )    N)DetectionValidator)opsNASValidatorc                       s    e Zd ZdZ fddZ  ZS )r   a  
    Ultralytics YOLO NAS Validator for object detection.

    Extends `DetectionValidator` from the Ultralytics models package and is designed to post-process the raw predictions
    generated by YOLO NAS models. It performs non-maximum suppression to remove overlapping and low-confidence boxes,
    ultimately producing the final detections.

    Attributes:
        args (Namespace): Namespace containing various configurations for post-processing, such as confidence and IoU
            thresholds.
        lb (torch.Tensor): Optional tensor for multilabel NMS.

    Examples:
        >>> from ultralytics import NAS
        >>> model = NAS("yolo_nas_s")
        >>> validator = model.validator
        Assumes that raw_preds are available
        >>> final_preds = validator.postprocess(raw_preds)

    Notes:
        This class is generally not instantiated directly but is used internally within the `NAS` class.
    c                    s@   t |d d }t||d d fdddd}t |S )z4Apply Non-maximum suppression to prediction outputs.r         )r   	xyxy2xywhtorchcatpermutesuperpostprocess)selfpreds_inboxespreds	__class__ N/var/www/vscode/kcb/lib/python3.10/site-packages/ultralytics/models/nas/val.pyr   #   s   "zNASValidator.postprocess)__name__
__module____qualname____doc__r   __classcell__r   r   r   r   r      s    )r	   ultralytics.models.yolo.detectr   ultralytics.utilsr   __all__r   r   r   r   r   <module>   s
   