Skip to main content

Python-first computer vision library with C++ bindings for speed.

Project description

NextCV

Python's ease, C++'s speed. Finally.

License: Apache-2.0 Python 3.8+ C++17 Build Status


For those who want the full story, read the docs. For everyone else, here's the gist.


What is this? 🤔

It's a computer vision library. You write Python, because you're not a masochist. But when your code inevitably becomes a bottleneck, you need speed. That's where this library can help.

The philosophy is simple:

Write Python. When it's slow, make it fast with C++.


Does it actually work? 🚀

Yes. Here's a Non-Maximum Suppression (NMS) benchmark. We pitted our C++ implementation against a standard NumPy version.

import time
import numpy as np
from nextcv.postprocessing import nms_cpp, nms_np

# A respectable amount of data
N = 10000
rng = np.random.default_rng(42)
bboxes = rng.uniform(0, 100, (N, 4)).astype(np.float32)
scores = rng.uniform(0.1, 1, N).astype(np.float32)

# Time the C++ version
start_time = time.perf_counter()
result_cpp = nms_cpp(bboxes, scores, 0.5)
cpp_time = time.perf_counter() - start_time

# Time the NumPy version
start_time = time.perf_counter()
result_np = nms_np(bboxes, scores, 0.5)
np_time = time.perf_counter() - start_time

print("NMS Timing Comparison:")
print(f"   Dataset: {len(bboxes)} bounding boxes")
print(f"   nms_cpp(): {len(result_cpp)} boxes kept in {cpp_time * 1000:.2f}ms")
print(f"   nms_np(): {len(result_np)} boxes kept in {np_time * 1000:.2f}ms")

Fingers' crossed, the C++ version is significantly faster. 🎯


How do I use it? 🛠️

Prerequisites

# Ubuntu/Debian
sudo apt-get install libeigen3-dev cmake

# MacOS
brew install eigen cmake

Installation 📦

# traditional pip
pip install git+https://github.com/kevinconka/nextcv.git

# uv if you know what's good for you
uv add git+https://github.com/kevinconka/nextcv.git

Check it's working ✅

uv run python -c "import nextcv; print(nextcv.__version__)"

Building from source 🔨

This project uses a dual-configuration approach to support both modern development and legacy compatibility:

  • Modern builds (Python 3.9+): Uses scikit-build-core with pyproject.toml
  • Legacy builds (Python 3.6...3.8): Uses scikit-build with pyproject.legacy.toml + setup.py

For development:

# create a virtual environment
python -m venv .venv
source .venv/bin/activate
pip install -e .

# or let uv handle it for you
uv sync

For legacy builds (Python 3.6...3.8):

# Copy legacy config and build
cp pyproject.legacy.toml pyproject.toml
pip install -e .

Contributing 🤝

If you think you can make this better, feel free. Just don't break anything.

  1. Fork it.

  2. Create a branch. (git checkout -b my-brilliant-idea)

  3. Install UV (if you don't have it yet).

    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  4. Install C++ tools.

    # macOS
    brew install clang-format llvm
    # Add LLVM to PATH (add to ~/.zshrc or ~/.bash_profile)
    echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.zshrc
    
    # Ubuntu/Debian
    sudo apt-get install clang-format clang-tidy
    
  5. Set up the environment.

    uv sync
    uvx pre-commit install
    
  6. Write code. And tests. Don't forget the tests.

  7. Run the checks.

    uv run pytest
    uvx pre-commit run --all-files
    
  8. Open a pull request. Make it a good one.


That's it. Now you know. 🎉

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

nextcv-1.0.0.tar.gz (212.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

nextcv-1.0.0-cp311-cp311-manylinux_2_39_x86_64.whl (186.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

nextcv-1.0.0-cp311-cp311-macosx_15_0_arm64.whl (156.8 kB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

Details for the file nextcv-1.0.0.tar.gz.

File metadata

  • Download URL: nextcv-1.0.0.tar.gz
  • Upload date:
  • Size: 212.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for nextcv-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cc9019ef438c7cca559f8855b3794f8cec3261e9c8a2bc7abab508a19700aac7
MD5 e4a1ab7dc934664fd34420ac1f991267
BLAKE2b-256 37cfe408f9a1f2cc8c844737684531506feae03050dcca62253372678ecee122

See more details on using hashes here.

File details

Details for the file nextcv-1.0.0-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

  • Download URL: nextcv-1.0.0-cp311-cp311-manylinux_2_39_x86_64.whl
  • Upload date:
  • Size: 186.9 kB
  • Tags: CPython 3.11, manylinux: glibc 2.39+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for nextcv-1.0.0-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 e804da3f42edb6d8f222e7169352adf0dbe2a371320e3c02c23a184de91860c5
MD5 01ee15bc1443431144fd8f9497a5f937
BLAKE2b-256 844985572dc77eaa11ff52156ca429fc4537fe39c2962fd103da0db747ef3833

See more details on using hashes here.

File details

Details for the file nextcv-1.0.0-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

  • Download URL: nextcv-1.0.0-cp311-cp311-macosx_15_0_arm64.whl
  • Upload date:
  • Size: 156.8 kB
  • Tags: CPython 3.11, macOS 15.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for nextcv-1.0.0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 67f8f75bc874362487d4dbc0aacbb21b3127c79804eb1d50a5af480bbd19d60c
MD5 dba5e8332a77c5fd51d1bdf8491d4417
BLAKE2b-256 171df2cc0b43953b9e44d3acf34d1ef412073cbf952514297b7d37c683a7f8aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page