Skip to content

Fix ByteTrack on modern Python/numpy: numpy-only cython_bbox, lapx install alternative, numpy>=1.24 aliases - #467

Open
H12Y10 wants to merge 4 commits into
FoundationVision:mainfrom
H12Y10:modern-python-numpy-compat
Open

H12Y10 wants to merge 4 commits into
FoundationVision:mainfrom
H12Y10:modern-python-numpy-compat

Conversation

@H12Y10

@H12Y10 H12Y10 commented Oct 7, 2026 •

Copy link
Copy Markdown

This PR supersedes #430 (which covers only the np.float fix) and completes a full
modern-Python compatibility chain for yolox/tracker, following up on #466 where the
three blockers are consolidated. It covers (1) the numpy>=1.24 alias removal, (2) the
C++ toolchain requirement, and (3) the lap wheel gap.

Changes

  1. np.float removed in numpy >= 1.24 (matching.py, byte_tracker.py)
    Replace the removed alias so the tracker no longer raises
    AttributeError: module 'numpy' has no attribute 'float' on the first update().
    (Supersedes Removed deprecated np.float #430.)

  2. C++ toolchain required by cython_bbox (cython_bbox_numpy.py, matching.py)
    matching.py uses exactly one function from cython_bbox (bbox_overlaps). This adds a
    pure-numpy implementation with the same semantics (including the original +1 pixel
    width/height convention) and imports it as a fallback through try/except ImportError,
    so inference-only use of yolox/tracker no longer requires MSVC / CppExtension - a
    common failure on Windows and on slim CI images. Behaviour is unchanged whenever
    cython_bbox is installed.

  3. lap has no wheel on some platforms (README)
    Documented that on platforms where lap has no prebuilt wheel, the lapx distribution
    ships a module named lap (same lapjv API), so pip install lapx satisfies the
    existing import with no code change. No code path is modified for this item.

Verification

  • The numpy alias restore and the pure-numpy bbox_overlaps shim are used in production in
    a downstream monocular AEB/FCW pipeline, covered by 41 zero-data regression tests (pytest collect) and CI
    on Ubuntu/Windows x Python 3.10/3.12: https://github.com/H12Y10/mono-aeb
  • The numpy implementation was checked against the shim used there on randomized box sets -
    identical IoU matrices, including the +1 pixel convention and zero-overlap cases.
  • For the lap note: pip install lapx was verified to install a module named lap
    (import lapx fails as expected), and lapjv assignment results were identical to lap
    on the cost matrices we validated (same total cost, same x/y assignment).

License

Same MIT as the repository; the changes are minimal and do not alter tracking behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant