o
    ϯi                     @   s   d dl mZmZ d dlmZ d dlmZ d dlmZ dZ	e	 de	 de	 de	 d	d
Z
			ddededee dedejf
ddZ		ddedefddZ		ddedefddZ		ddedefddZ		ddedefddZdS )    )AnyOptionalN)
create_x3d)load_state_dict_from_urlz>https://dl.fbaipublicfiles.com/pytorchvideo/model_zoo/kineticsz/X3D_XS.pythz/X3D_S.pythz/X3D_M.pythz/X3D_L.pyth)x3d_xsx3d_sx3d_mx3d_lFT
pretrainedprogresscheckpoint_pathkwargsreturnc                 K   s>   t di |}| r|d urt||dd}|d }|| |S )Ncpu)r   map_locationmodel_state )r   r   load_state_dict)r
   r   r   r   model
checkpoint
state_dictr   r   O/home/ubuntu/.local/lib/python3.10/site-packages/pytorchvideo/models/hub/x3d.py_x3d   s   
r   c                 K      t d| |td ddd|S )a  
    X3D-XS model architecture [1] trained on the Kinetics dataset.
    Model with pretrained weights has top1 accuracy of 69.12.

    [1] Christoph Feichtenhofer, "X3D: Expanding Architectures for
    Efficient Video Recognition." https://arxiv.org/abs/2004.04730

    Args:
        pretrained (bool): If True, returns a model pre-trained on the Kinetics dataset
        progress (bool): If True, displays a progress bar of the download to stderr
        kwargs: use these to modify any of the other model settings. All the
            options are defined in pytorchvideo/models/x3d.py

    NOTE: to use the pretrained model, do not modify the model configuration
    via the kwargs. Only modify settings via kwargs to initialize a new model
    without pretrained weights.
    r         r
   r   r   input_clip_lengthinput_crop_sizeNr   r   checkpoint_pathsr
   r   r   r   r   r   r   $      r   c                 K   r   )a  
    X3D-XS model architecture [1] trained on the Kinetics dataset.
    Model with pretrained weights has top1 accuracy of 73.33.

    [1] Christoph Feichtenhofer, "X3D: Expanding Architectures for
    Efficient Video Recognition." https://arxiv.org/abs/2004.04730

    Args:
        pretrained (bool): If True, returns a model pre-trained on the Kinetics dataset
        progress (bool): If True, displays a progress bar of the download to stderr
        kwargs: use these to modify any of the other model settings. All the
            options are defined in pytorchvideo/models/x3d.py

    NOTE: to use the pretrained model, do not modify the model configuration
    via the kwargs. Only modify settings via kwargs to initialize a new model
    without pretrained weights.
    r      r   r   Nr   r   r!   r   r   r   r   D   r"   r   c                 K   r   )a  
    X3D-XS model architecture [1] trained on the Kinetics dataset.
    Model with pretrained weights has top1 accuracy of 75.94.

    [1] Christoph Feichtenhofer, "X3D: Expanding Architectures for
    Efficient Video Recognition." https://arxiv.org/abs/2004.04730

    Args:
        pretrained (bool): If True, returns a model pre-trained on the Kinetics dataset
        progress (bool): If True, displays a progress bar of the download to stderr
        kwargs: use these to modify any of the other model settings. All the
            options are defined in pytorchvideo/models/x3d.py

    NOTE: to use the pretrained model, do not modify the model configuration
    via the kwargs. Only modify settings via kwargs to initialize a new model
    without pretrained weights.
    r         r   Nr   r   r!   r   r   r   r   d   r"   r   c              	   K   s    t d| |td dddd|S )a  
    X3D-XS model architecture [1] trained on the Kinetics dataset.
    Model with pretrained weights has top1 accuracy of 77.44.

    [1] Christoph Feichtenhofer, "X3D: Expanding Architectures for
    Efficient Video Recognition." https://arxiv.org/abs/2004.04730

    Args:
        pretrained (bool): If True, returns a model pre-trained on the Kinetics dataset
        progress (bool): If True, displays a progress bar of the download to stderr
        kwargs: use these to modify any of the other model settings. All the
            options are defined in pytorchvideo/models/x3d.py

    NOTE: to use the pretrained model, do not modify the model configuration
    via the kwargs. Only modify settings via kwargs to initialize a new model
    without pretrained weights.
    r	   r$   i8  g      @)r
   r   r   r   r   depth_factorNr   r   r!   r   r   r   r	      s   r	   )FTN)FT)typingr   r   torch.nnnnpytorchvideo.models.x3dr   	torch.hubr   root_dirr    boolstrModuler   r   r   r   r	   r   r   r   r   <module>   sh   	

!
!
!