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.1.tar.gz (212.7 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.1-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.1-cp311-cp311-macosx_11_0_arm64.whl (161.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: nextcv-1.0.1.tar.gz
  • Upload date:
  • Size: 212.7 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.1.tar.gz
Algorithm Hash digest
SHA256 e5cfd1f7cfafc31d38dcfdf1bc6ed4f47833cfcb946bae5baca5bc63877c8e37
MD5 7088ecb9e6553e50cb2e2048d214f3f1
BLAKE2b-256 59e4e73b902a32eb8a80a557abd6853c59c7b563acc7f547cb6a0a726145d796

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nextcv-1.0.1-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.1-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 075444ca8f3332a1e48614baef49fecdb8d6e1b9f8a7fd451f9a03b92fd0f29b
MD5 14aebb007c0da313a4e42f347c223e65
BLAKE2b-256 37a01eec2de07915f33ee44bb4e30182a49b48c74e89417b1f2c40d3af85f085

See more details on using hashes here.

File details

Details for the file nextcv-1.0.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

  • Download URL: nextcv-1.0.1-cp311-cp311-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 161.0 kB
  • Tags: CPython 3.11, macOS 11.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.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0cfb09018d1181874b8c9bb2ef17d42393e21a9f7a6ffe02a5082b707fb7180e
MD5 eedaad8b452d0ca8c4d1755b0cb66fa1
BLAKE2b-256 18bbfe7fd5f7b777ad2df33d3c55912fdf82328aebf2a97af93d945fec6b8f4b

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