Easily compute clip embeddings from video frames
Project description
clip-video-encode
Easily compute clip embeddings from video frames (mp4 or youtube links)
Install
Using pip:
pip install clip-video-encode
Or build from source:
python setup.py install
Usage
NAME
clip-video-encode - Encode frames using CLIP image encoder
SYNOPSIS
clip-video-encode SRC <flags>
DESCRIPTION
Input:
src:
str: path to mp4 file
str: youtube link
str: path to txt file with multiple mp4's or youtube links
list: list with multiple mp4's or youtube links
dest:
str: directory where to save embeddings to
None: dest = src + .npy
take_every_nth:
int: only take every nth frame
Output:
None
POSITIONAL ARGUMENTS
SRC
FLAGS
--dest=DEST
Type: Optional[]
Default: None
--take_every_nth=TAKE_EVERY_NTH
Default: 1
API
This module exposes a single function clip_video_encode
which takes the same arguments as the command line tool:
import glob
from clip_video_encode import clip_video_encode
VIDS = glob.glob("some/path/my_videos/*.mp4")
EMBEDDING_DIR = "some/path/my_embeddings"
take_every_5 = 5
clip_video_encode(VIDS, EMBEDDING_DIR, take_every_5)
Who is using clip-video-encode?
- CLIP-Kinetics700 - The Kinetics700 dataset (700GB) can be compressed to ~8GB using clip-video-encode at 1 FPS
For development
Either locally, or in gitpod (do export PIP_USER=false
there)
Setup a virtualenv:
python3 -m venv .env
source .env/bin/activate
pip install -e .
to run tests:
pip install -r requirements-test.txt
then
make lint
make test
You can use make black
to reformat the code
python -m pytest -x -s -v tests -k "dummy"
to run a specific test
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for clip_video_encode-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a933512653a1596fd7fd3aff614de0c6c0e173fbe999b4d4eceb953bc2d5e0ea |
|
MD5 | 139c7a8073e6adfd4e4177dcb16179b7 |
|
BLAKE2b-256 | 64354ae95e37ebc6b61da0b317c0475116183704becd1ed87c0de1cd17aaf562 |