Distant Viewing Toolkit for the Analysis of Visual Culture
The Distant Viewing Toolkit is a Python package that facilitates the computational analysis of still and moving images. It takes a video, an image or a directory of images and writes a set of tables about it, each a parquet file: the shots of a video, the faces and heads in each frame, image embeddings, the words spoken, and more. Each table is made by one annotator, and the annotators are listed below.
Version 2 of the toolkit is a rewrite, and nothing written for version 1 runs on it. The tutorial notebooks below were written for version 1.1.0 and install that release.
More information about the toolkit and project is available on the following pages:
- Example analysis using aggregated metadata: "Visual Style in Two Network Era Sitcoms"
- Theory of the project: "Distant Viewing: Analyzing Large Visual Corpora."
- Software Whitepaper: A Python Package for the Analysis of Visual Culture
If you have any trouble using the toolkit, please open a GitHub issue. If you have additional questions or are interested in collaborating, please contact us at tarnold2@richmond.edu and ltilton@richmond.edu.
Install
The toolkit needs Python 3.13, and ffmpeg and ffprobe on the path:
pip install "dvt[all]"
The extras choose which annotators can run. video brings the annotators
that read the picture, face the face annotator and the tracks, yolo the
head detector, and audio the annotators that read the sound. all brings
every one. Without an extra the package is dvt.tools alone, which reads a
media file without a model.
The annotators load their models from one directory, and the models are downloaded once, before anything is annotated:
dvt models fetch
All of them come to about 12 GB. --annotators frames,dino2,face fetches
only what those annotators load, and dvt models check lists which models
are there. The directory is ~/.cache/dvt unless --models or the
environment variable DVT_MODELS names another. MODELS.md says
what the directory holds, where each model comes from and under what terms
it is used.
Use
dvt film.mp4 --out out
Under out/ this leaves annotations/film/ with the tables, audio/ with
the sound taken from the video, frames/film/ with the saved frames and
stems/ with the separated sound. --annotators a,b,c runs only those
named, and --list prints every annotator, what it writes and what it reads.
An image, or a directory of images, is given the same way:
dvt poster.jpg --out out
dvt posters/ --out out
The annotators that read a single picture run over it: dino2, siglip2,
siglip2_base, face and yolo. Their tables have a path column where
those of a video have frame, the images of a directory share one table,
and images.parquet lists the images with their sizes.
The same from Python, where the tables come back as polars data frames by name:
import dvt
tables = dvt.annotate("film.mp4", out="out", annotators=["metadata", "frames", "shots"])
tables["shots"]
With no out nothing is kept but the tables returned, and with no
annotators every one that fits the input runs. models names the model
directory.
Annotators
| Annotator | Writes | What it holds |
|---|---|---|
metadata |
metadata.parquet |
the frame size, the crop, the aspect and the language |
letterbox |
letterbox.parquet |
the black bars around the picture |
chroma |
chroma.parquet |
colour or black and white |
chapters |
chapters.parquet |
the chapters in the file |
subtitles |
subtitles.parquet |
the text subtitles in the file |
frames |
frames.parquet |
one row a frame, with the shot boundary TransNetV2 gives |
shots |
shots.parquet |
the frames cut into shots, and what each shot looks like |
frames_r720 |
frames/ |
frames of each shot saved as images |
dino2 |
dino2.parquet |
DINOv2 embeddings of the sampled frames |
siglip2 |
siglip2.parquet |
SigLIP2 embeddings of the sampled frames |
siglip2_base |
siglip2_base.parquet |
the same from the smaller SigLIP2 model |
face |
face.parquet |
SCRFD face detection and an ArcFace embedding, every frame |
yolo |
yolo.parquet |
the heads detected in every frame |
tracks |
tracks.parquet |
head and face tracks within shots, one embedding a track |
audioseg |
audioseg_intervals.parquet |
the sound separated into stems, and where the speech is |
words |
words.parquet |
the words spoken, each with its time |
praat |
praat.parquet |
phonetic measurement of the speech, frame by frame |
laughter |
laughter.parquet |
laughter heard between lines |
metadata runs first, and the others are checked against what it records.
tracks reads the tables of shots, face and yolo. words, praat and
laughter read the speech that audioseg separates.
audioseg stops unless it has a CUDA device, so words, praat and
laughter need one too. The annotators of the video and face extras
also run on a CPU, more slowly.
Notebooks
The notebooks in this section were written for version 1.1.0 of the toolkit. They install that release and do not run on version 2.
If you are interested in learning more about application of computer vision and the distant viewing toolkit to humanities applications, we offer a self-guided tutorial through the following Google Colab notebooks. These can be run for free by anyone with a Google account:
- Distant Viewing Tutorial 1: Movie Posters and Color Analysis: [colab], [slides], [notebook], [chapter]
- Distant Viewing Tutorial 2: Network-Era Sitcoms and Visual Style: [colab], [slides], [notebook], [chapter]
The Distant Viewing Toolkit is supported by the National Endowment for the Humanities through a Digital Humanities Advancement Grant.
Citation
If you make use of the toolkit in your work, please cite the relevant papers describing the tool and its application to the study of visual culture:
@article{,
title = "Distant Viewing: Analyzing Large Visual Corpora",
author = "Arnold, Taylor B and Tilton, Lauren",
journal = "Digital Scholarship in the Humanities",
year = "2019",
doi = "10.1093/digitalsh/fqz013",
url = "http://dx.doi.org/10.1093/digitalsh/fqz013"
}
@article{,
title = "Visual Style in Two Network Era Sitcoms",
author = "Arnold, Taylor B and Tilton, Lauren and Berke, Annie",
journal = "Cultural Analytics",
year = "2019",
doi = "10.22148/16.043",
url = "http://dx.doi.org/10.22148/16.043"
}
License
The toolkit is released under the MIT license; see LICENSE. The models the annotators load, and one of the libraries that run them, have terms of their own, and MODELS.md gives them model by model. Two matter to anyone whose use is not research or not open source:
- The
faceannotator loads the insightfacebuffalo_lmodels. The insightface code is under the MIT license, but its authors make the models "available for non-commercial research purposes only". - The
yoloannotator runs on ultralytics, which is under the AGPL-3.0 license unless a license is bought from Ultralytics, and the head detector it loads was trained from an ultralytics model and is under the AGPL-3.0 too. ultralytics is installed only by theyoloandallextras.
The aligners that time the words of French, German, Spanish and Italian speech are under CC BY-NC 4.0.
Contributing
Contributions, including bug fixes and new features, to the toolkit are welcome. When contributing to this repository, please first discuss the change you wish to make via a GitHub issue or email with the maintainers of this repository before making a change. Small bug fixes can be given directly as pull requests.
Metadata
Release files for dvt 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dvt-2.0.1.tar.gz | 354.8 kB | Without provenance | Details for dvt-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dvt-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for dvt-2.0.1-py3-none-any.whl |
Total release size: 479.2 kB
Release files / dvt-2.0.1.tar.gz
| Download URL | dvt-2.0.1.tar.gz |
|---|---|
| Size | 354.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9b93d62c5edd784664173156b919880eb5d46f7469c3574b92c1514403b8202
|
|
BLAKE2b-256 checksum How to use checksums |
dee33530179952bfc9e111f0f198b8b3a7bbb1bcc256b652ff4cbe3ec487b14e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / dvt-2.0.1-py3-none-any.whl
| Download URL | dvt-2.0.1-py3-none-any.whl |
|---|---|
| Size | 124.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f7fe7d3a1dedd3de0c63e0f2f89374617323e27b6c44e5c406a5d7a6160ff217
|
|
BLAKE2b-256 checksum How to use checksums |
6ae4abb61654b1cf2264da3b7d77415ca8e3f2ec3d5d03bff6211aa88ccbd79e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for dvt 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.