Skip to content

Commit

Permalink
Change adaptive_ratio to 255.0 instead of threshold+1 when handling
Browse files Browse the repository at this point in the history
division by zero (#153).
  • Loading branch information
Breakthrough committed Feb 21, 2021
1 parent 3281aa2 commit d12c4d7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scenedetect/detectors/adaptive_content_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ def post_process(self, _):
if not denominator_is_zero:
adaptive_ratio = self.get_content_val(frame_num) / denominator
elif denominator_is_zero and self.get_content_val(frame_num) >= self.min_delta_hsv:
# if we would have divided by zero, set adaptive_ratio above the threshold
adaptive_ratio = adaptive_threshold + 1
# if we would have divided by zero, set adaptive_ratio to the max (255.0)
adaptive_ratio = 255.0
else:
# avoid dividing by zero by setting con_val_ratio to zero if content_val
# is still very low
adaptive_ratio = 0
adaptive_ratio = 0.0

self.stats_manager.set_metrics(
frame_num, {self._adaptive_ratio_key: adaptive_ratio})
Expand Down

0 comments on commit d12c4d7

Please sign in to comment.