This repository contains two Python scripts to extract video-level features from MP4 files using Qwen multimodal (vision-language) models:
- qwen-feature-vision-extraction.py
- Uses
Qwen2.5-VL-7B-Instruct
- Uses
- extract-feature-with-text-alignment.py
- Uses
Qwen2-VL-2B-Instruct
- Uses
Both scripts process videos in two classes—plausible and implausible—and produce an HDF5 file containing feature vectors and class labels.
- Python 3.8 or higher
- CUDA-enabled GPU (recommended)
- PyTorch
- transformers
- bitsandbytes
- tqdm
- h5py
- numpy
You also need the helper module qwen_vl_utils in your PYTHONPATH.
-
Clone this repository:
git clone https://github.com/your-username/qwen-video-feature-extraction.git cd qwen-video-feature-extraction -
Create a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install --upgrade pip pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117 pip install transformers bitsandbytes tqdm h5py numpy
-
Ensure
qwen_vl_utils.pyis accessible (either in the project root or installed as a package).