o
    ϯiY                  	   @   sh   d dl mZ d dlmZ d dlmZ d dlmZ 	 dZde diZ			dd
e
de
dedejfddZdS )    )AnyN)create_r2plus1d)load_state_dict_from_urlz>https://dl.fbaipublicfiles.com/pytorchvideo/model_zoo/kineticsr2plus1d_r50z/R2PLUS1D_16x4_R50.pythFT
pretrainedprogresskwargsreturnc                 K   sB   t dddi|}| rtd }t||dd}|d }|| |S )	a  

    R(2+1)D model architecture from [1] with pretrained weights based on 16x4 setting
    on the Kinetics dataset. Model with pretrained weights has top1 accuracy of 76.01.
    (trained on 8*8 GPUs)

    [1] "A closer look at spatiotemporal convolutions for action recognition"
        Du Tran, Heng Wang, Lorenzo Torresani, Jamie Ray, Yann LeCun, Manohar Paluri. CVPR 2018.
        https://arxiv.org/abs/1711.11248

    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/resnet.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.
    dropout_rateg      ?r   cpu)r   map_locationmodel_stateN )r   checkpoint_pathsr   load_state_dict)r   r   r   modelpath
checkpoint
state_dictr   r   T/home/ubuntu/.local/lib/python3.10/site-packages/pytorchvideo/models/hub/r2plus1d.pyr      s   
)FT)typingr   torch.nnnnpytorchvideo.models.r2plus1dr   	torch.hubr   root_dirr   boolModuler   r   r   r   r   <module>   s$   
