xclip base patch32 16 frames

Providermicrosoft
Categoryvideo-classification
Licensemit
Downloads172
Stars0

Overview

The xclip-base-patch32 model is a specialized video classification tool designed to extend CLIP's visual-language capabilities into the temporal dimension. By leveraging a modified Transformer architecture, it processes sequences of 16 frames to capture motion and action dynamics that static image models miss. For developers, this means an efficient way to implement zero-shot video labeling or action recognition without needing massive labeled datasets for every new category. It integrates easily into PyTorch-based pipelines and serves as a lightweight alternative for real-time video analysis where latency is a concern, offering a strong balance between computational overhead and semantic understanding of video content.

Highlights

  • Zero-shot video classification using visual-language alignment
  • Processes 16-frame sequences for temporal action recognition
  • Lightweight Patch32 architecture optimizes inference speed
  • MIT licensed for flexible commercial and research integration

Usage

Install
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# Load model with transformers
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("microsoft/xclip-base-patch32-16-frames")
tokenizer = AutoTokenizer.from_pretrained("microsoft/xclip-base-patch32-16-frames")

Hugging Face Download

We recommend downloading the model via the Hugging Face CLI or Hub SDK.

Guidance:Before downloading, install huggingface_hub with:

Guidance
pip install -U huggingface_hub

CLI Download

Download the full repository

Download the full repository
huggingface-cli download microsoft/xclip-base-patch32-16-frames

Download a single file to a local folder (e.g. config.json into ./dir)

Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download microsoft/xclip-base-patch32-16-frames config.json --local-dir ./dir

See the official docs for more CLI options

SDK Download

SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('microsoft/xclip-base-patch32-16-frames')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://huggingface.co/microsoft/xclip-base-patch32-16-frames

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/microsoft/xclip-base-patch32-16-frames

Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.

PyTorch / Transformers Usage

Install Transformers

Install Transformers
pip install -U transformers torch

Load the model and run inference

Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('microsoft/xclip-base-patch32-16-frames')
tokenizer = AutoTokenizer.from_pretrained('microsoft/xclip-base-patch32-16-frames')

Model Download

We recommend downloading the model via the ModelScope CLI or SDK.

Guidance:Before downloading, install ModelScope with:

Guidance
pip install modelscope

CLI Download

Download the full repository

Download the full repository
modelscope download --model microsoft/xclip-base-patch32-16-frames

Download a single file to a local folder (e.g. README.md into ./dir)

Download a single file to a local folder (e.g. README.md into ./dir)
modelscope download --model microsoft/xclip-base-patch32-16-frames README.md --local_dir ./dir

See the docs for more CLI options

SDK Download

SDK Download
# 模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('microsoft/xclip-base-patch32-16-frames')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://www.modelscope.cn/microsoft/xclip-base-patch32-16-frames.git

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/microsoft/xclip-base-patch32-16-frames.git

ModelScope 模型页直接下载模型文件;无需将模型文件放在本站服务器。

Notebook Quickstart

Install the ModelScope library

Install the ModelScope library
pip install "modelscope[audio,cv,nlp,multi-modal,science]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

Load the model and run inference

Load the model and run inference
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

p = pipeline('text-generation', 'microsoft/xclip-base-patch32-16-frames')

Full Documentation

来源: HuggingFace

---
language: en
license: mit
tags:

  • vision

  • video-classification

model-index:
  • name: nielsr/xclip-base-patch32-16-frames

results:
- task:
type: video-classification
dataset:
name: Kinetics 400
type: kinetics-400
metrics:
- type: top-1 accuracy
value: 81.1
- type: top-5 accuracy
value: 95.5
---

X-CLIP (base-sized model)

X-CLIP model (base-sized, patch resolution of 32) trained fully-supervised on Kinetics-400. It was introduced in the paper Expanding Language-Image Pretrained Models for General Video Recognition by Ni et al. and first released in this repository.

This model was trained using 16 frames per video, at a resolution of 224x224.

Disclaimer: The team releasing X-CLIP did not write a model card for this model so this model card has been written by the Hugging Face team.

Model description

X-CLIP is a minimal extension of CLIP for general video-language understanding. The model is trained in a contrastive way on (video, text) pairs.

!X-CLIP architecture

This allows the model to be used for tasks like zero-shot, few-shot or fully supervised video classification and video-text retrieval.

Intended uses & limitations

You can use the raw model for determining how well text goes with a given video. See the model hub to look for
fine-tuned versions on a task that interests you.

How to use

For code examples, we refer to the documentation.

Training data

This model was trained on Kinetics-400.

Preprocessing

The exact details of preprocessing during training can be found here.

The exact details of preprocessing during validation can be found here.

During validation, one resizes the shorter edge of each frame, after which center cropping is performed to a fixed-size resolution (like 224x224). Next, frames are normalized across the RGB channels with the ImageNet mean and standard deviation.

Evaluation results

This model achieves a top-1 accuracy of 81.1% and a top-5 accuracy of 95.5%.

Join our Telegram