You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
detect-adaptive --frame-window and save-images -n/-s/-H/-W crash with a traceback on out of range values #609
Some options take any integer or number, and a value outside what the code accepts ends in a Python traceback instead of a usage error. This is the same problem #604 fixed for -k/--kernel-size, for these options:
Option
Value
Result
detect-adaptive -f/--frame-window
0, -3
ValueError: window_width must be at least 1.
save-images -n/--num-images
0, -1
ValueError: num_images must be greater than 0
save-images -s/--scale
-1
cv2.error from cv2.resize
save-images -H/--height, -W/--width
-5
AssertionError
The config file has the same problem: frame-window = 0 under [detect-adaptive] or num-images = 0 under [save-images] loads without an error and then crashes the same way. These keys are plain values in CONFIG_MAP, while similar options (min-images, max-images, compression) use RangeValue and _click_range.
Command
scenedetect -i tests/resources/goldeneye.mp4 time -e 1 detect-adaptive -f 0
scenedetect -i tests/resources/goldeneye.mp4 time -e 1 detect-content save-images -n 0
Output
File ".../scenedetect/detectors/adaptive_detector.py", line 70, in __init__
raise ValueError("window_width must be at least 1.")
ValueError: window_width must be at least 1.
Expected a usage error, for example:
Error: Invalid value for '--frame-window' / '-f': 0 is not in the range x>=1.
I have a fix that makes these keys RangeValues (frame-window and num-images >= 1, scale, height and width >= 0, since 0 already means "not set") and uses _click_range for the CLI options. Happy to open a PR.
Activity