utils/cv2: use rsplit in cv2_load_image so Windows drive-letter paths work#27
Open
narr2atnarrable wants to merge 1 commit into
Open
Conversation
… work
The 'vid://<path>:<frame_id>' scheme is split on ':' to recover the
filename and frame index. On Windows, paths contain a drive-letter colon
(e.g. 'vid://C:/Users/.../clip.mp4:0'), so a plain .split(':') yields 3+
pieces and the unpack raises ValueError.
rsplit(':', 1) cleaves only the trailing ':<frame_id>' and leaves the
rest of the path intact, so the same code works on POSIX and Windows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cv2_load_imageintracklab/utils/cv2.pyparses avid://<path>:<frame_id>URI withstr.split(":"). On Windows, paths contain a drive-letter colon (e.g.C:/Users/.../clip.mp4), so the URIvid://C:/Users/me/clip.mp4:0splits into three pieces and the tuple unpack raisesValueError.Using
rsplit(":", 1)cleaves only the trailing:<frame_id>and leaves the rest of the path intact. It works identically on POSIX (no change in behaviour) and fixes Windows.Reproduction (POSIX shell, same bug a Windows user hits)
Any Windows user loading frames through the
vid://scheme (ExternalVideo wrapper,dataset=videoconfigs, the video reader path in image-level pipelines) hits it:Change
One line in
tracklab/utils/cv2.py:Risk
None on POSIX —
rsplit(":", 1)on a single-colon string returns the same 2-tuple assplit(":"). The only behavioural change is that multi-colon strings now parse as "everything up to the last colon is the path, the tail is the frame id", which is the intended semantics.Context
Encountered while running
sn-gamestateon a workstation pair (Linux + Windows) for a Blackwell-GPU compatibility sweep. Filing alongside a sibling PR toSoccerNet/sn-gamestatefor a related pandas-2.iloc[0]fix; both were needed to get the pipeline end-to-end on a mixed-OS setup.