tscv-vision
tscv-vision is a NumPy-first Python package for computer-vision feature
engineering of one-dimensional time series. It converts signals into image
representations, extracts classical image descriptors, and scales the workflow
to long signals with sliding-window processing.
The project is designed for research, reproducible feature extraction, and lightweight production pipelines where the core dependency footprint should stay small.
Highlights
- Time-series imaging encoders: Gramian Angular Field, Gramian Angular Difference Field, recurrence plots, spectrograms, and additional registry encoders.
- Classical feature extractors: intensity statistics, normalized histograms, gradient histograms, Local Binary Patterns, and batch extraction.
- Sliding-window pipelines for long 1D or multichannel signals.
- CLI for
.npyinputs with metadata-rich.npzoutputs. - Optional extras for analytics, GPU acceleration, neural integrations, MLOps, and domain adapters.
- Release-ready packaging with PyPI Trusted Publishing and Zenodo metadata.
Installation
Install the core package:
pip install tscv-vision
Install optional extras only when needed:
| Extra | Command | Purpose |
|---|---|---|
cli |
pip install "tscv-vision[cli]" |
YAML configuration files |
analytics |
pip install "tscv-vision[analytics]" |
SHAP, LIME, UMAP, plotting, wavelets |
domains |
pip install "tscv-vision[domains]" |
Domain adapters backed by scikit-learn |
gpu |
pip install "tscv-vision[gpu]" |
CuPy-accelerated encoder paths |
mlops |
pip install "tscv-vision[mlops]" |
FastAPI, Prometheus, Feast integrations |
torch |
pip install "tscv-vision[torch]" |
Torch-based neural components |
For local development:
git clone https://github.com/DiogoRibeiro7/tscv-vision.git
cd tscv-vision
poetry install
Quick Start
import numpy as np
from tscv_vision import encoders, features, sliding
x = np.sin(np.linspace(0, 4 * np.pi, 128))
# Encode a series as a 2D image.
img = encoders.gaf(x)
print(img.shape) # (128, 128)
# Extract a feature vector from one image.
vec = features.extract_feature_vector(img, bins=32)
print(vec.shape)
# Extract a stacked feature matrix from multiple images.
batch = features.extract_batch(np.stack([img, img]), bins=32)
print(batch.shape)
# Encode overlapping windows and keep their start indices.
images, starts = sliding.encode_sliding(x, encoder="gaf", size=64, hop=32)
print(images.shape, starts)
# Extract sliding-window feature vectors directly.
matrix, starts = sliding.features_for_sliding(x, encoder="gaf", size=64, hop=32)
print(matrix.shape, starts)
Command Line
Generate sample data:
python samples/generate.py
Extract features from one signal:
tscv-features \
--encoders gaf \
--input samples/sine.npy \
--output out.npz \
--features all \
--bins 32
Run a sliding-window, multi-encoder pipeline:
tscv-features \
--encoders gaf,spec \
--fusion concat \
--sliding \
--win-len 128 \
--hop 64 \
--input samples/sine.npy \
--output out_sliding.npz \
--save-images \
--save-meta
The output .npz contains feature arrays plus JSON metadata. Sliding runs can
include window_starts, win_len, hop, and encoded image stacks.
Feature Surface
Encoders
| Encoder | Function or name | Output |
|---|---|---|
| GAF | encoders.gaf(x, method="summation") or gaf |
(N, N) |
| GADF | encoders.gaf(x, method="difference") or gadf |
(N, N) |
| Recurrence plot | encoders.recurrence_plot(x) or rp |
(N, N) |
| Spectrogram | encoders.spectrogram(x) or spec |
(F, T) |
| Continuous wavelet | cwt |
(scales, N) |
Feature Extractors
| Function | Description |
|---|---|
features.intensity_stats(img) |
mean, std, min, max, skewness, kurtosis |
features.histogram(img, bins=32) |
normalized intensity histogram |
features.gradient_histogram(img, bins=16) |
Sobel-like gradient magnitude histogram |
features.lbp(img, radius=1) |
Local Binary Pattern histogram |
features.extract_feature_vector(img, bins=32) |
unified feature vector |
features.extract_batch(images, bins=32) |
stacked feature matrix |
Documentation
- API reference
- Deployment guide
- Performance guide
- Release checklist
- Test matrix
- Troubleshooting
- Roadmap
Development
The project uses Poetry, Ruff, mypy, pytest, and pre-commit.
poetry install
poetry run pre-commit run --all-files
poetry run ruff check .
poetry run mypy src
poetry run pytest -q
Build and check distribution artifacts:
python -m build
python -m twine check dist/*
The default package build is pure Python. To opt into building the optional Cython extension locally, set:
TSCV_BUILD_EXT=1 python -m build
See CONTRIBUTING.md for contribution workflow, coding standards, and pull request expectations.
Releases, PyPI, and Zenodo
Tagged releases are published to PyPI through GitHub Actions using PyPI Trusted Publishing with OpenID Connect. No PyPI API token is stored in the repository.
Zenodo archiving is configured through .zenodo.json. After the repository is enabled in Zenodo's GitHub integration, each GitHub Release can be archived with a version DOI. Add the DOI badge here after the first archive is created.
Citation
If you use tscv-vision in academic work, cite the archived Zenodo release
once available, or use the metadata in CITATION.cff.
Diogo Ribeiro. tscv-vision: Computer-vision feature engineering for 1D time series.
https://github.com/DiogoRibeiro7/tscv-vision
Support and Security
- General questions and usage problems: open a GitHub Discussion or issue.
- Bug reports and feature requests: use the issue templates.
- Security concerns: follow SECURITY.md.
Maintainer
- Diogo Ribeiro
- School of Media Arts and Design, Polytechnic of Porto, Portugal
- GitHub: @DiogoRibeiro7
- ORCID: 0009-0001-2022-7072
- Email: dfr@esmad.ipp.pt
License
tscv-vision is distributed under the MIT License.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tscv_vision-0.1.1.tar.gz.
File metadata
- Download URL: tscv_vision-0.1.1.tar.gz
- Upload date:
- Size: 172.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
101c6ee73efd5cf94c767552a0962bc70fd2bc0e3b07e8784c3776319aad54fb
|
|
| MD5 |
bf9f2d69778e37729c91d8a5e32d3641
|
|
| BLAKE2b-256 |
522a66b1853927c8c81d872b926df119b0a4c17626baba62b4ffaa433d5dda97
|
Provenance
The following attestation bundles were made for tscv_vision-0.1.1.tar.gz:
Publisher:
publish.yml on DiogoRibeiro7/tscv-vision
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tscv_vision-0.1.1.tar.gz -
Subject digest:
101c6ee73efd5cf94c767552a0962bc70fd2bc0e3b07e8784c3776319aad54fb - Sigstore transparency entry: 2412864139
- Sigstore integration time:
-
Permalink:
DiogoRibeiro7/tscv-vision@96c493cff4cf517d7bca642763b1e20a0fd042b8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/DiogoRibeiro7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@96c493cff4cf517d7bca642763b1e20a0fd042b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tscv_vision-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tscv_vision-0.1.1-py3-none-any.whl
- Upload date:
- Size: 84.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd365eba2783fa9f1356a313ef6a44caf4a91e456d16f5f3ec68cb189cacf673
|
|
| MD5 |
f0afde274a7b5b25c67b902938b34563
|
|
| BLAKE2b-256 |
35c920f841c1e17a2c1cbb87b9fab53a0337ea5e259f5cf3e395ee252497e7bd
|
Provenance
The following attestation bundles were made for tscv_vision-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on DiogoRibeiro7/tscv-vision
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tscv_vision-0.1.1-py3-none-any.whl -
Subject digest:
dd365eba2783fa9f1356a313ef6a44caf4a91e456d16f5f3ec68cb189cacf673 - Sigstore transparency entry: 2412864307
- Sigstore integration time:
-
Permalink:
DiogoRibeiro7/tscv-vision@96c493cff4cf517d7bca642763b1e20a0fd042b8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/DiogoRibeiro7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@96c493cff4cf517d7bca642763b1e20a0fd042b8 -
Trigger Event:
push
-
Statement type: