a
    yf                     @   sD   d dl mZ d dlmZ ddlmZ ddlmZ G dd deZdS )	    )Path)Model   )FastSAMPredictor)FastSAMValidatorc                       s<   e Zd ZdZd fdd	Zd fdd	Zed	d
 Z  ZS )FastSAMz
    FastSAM model interface.

    Example:
        ```python
        from ultralytics import FastSAM

        model = FastSAM("last.pt")
        results = model.predict("ultralytics/assets/bus.jpg")
        ```
    FastSAM-x.ptc                    s:   t |dkrd}t|jdvs&J dt j|dd dS )zSCall the __init__ method of the parent class (YOLO) with the updated default model.z
FastSAM.ptr   >   z.ymlz.yamlz/FastSAM models only support pre-trained models.segment)modeltaskN)strr   suffixsuper__init__)selfr
   	__class__ \/var/www/html/django/DPS/env/lib/python3.9/site-packages/ultralytics/models/fastsam/model.pyr      s    zFastSAM.__init__FNc           	         s*   t ||||d}t j||fd|i|S )a  
        Perform segmentation prediction on image or video source.

        Supports prompted segmentation with bounding boxes, points, labels, and texts.

        Args:
            source (str | PIL.Image | numpy.ndarray): Input source.
            stream (bool): Enable real-time streaming.
            bboxes (list): Bounding box coordinates for prompted segmentation.
            points (list): Points for prompted segmentation.
            labels (list): Labels for prompted segmentation.
            texts (list): Texts for prompted segmentation.
            **kwargs (Any): Additional keyword arguments.

        Returns:
            (list): Model predictions.
        )bboxespointslabelstextsprompts)dictr   predict)	r   sourcestreamr   r   r   r   kwargsr   r   r   r   r      s    zFastSAM.predictc                 C   s   dt tdiS )z[Returns a dictionary mapping segment task to corresponding predictor and validator classes.r	   )Z	predictor	validator)r   r   )r   r   r   r   task_map4   s    zFastSAM.task_map)r   )FNNNN)	__name__
__module____qualname____doc__r   r   propertyr    __classcell__r   r   r   r   r      s
   r   N)	pathlibr   Zultralytics.engine.modelr   r   r   valr   r   r   r   r   r   <module>   s   