Try to make it work in Jetson Orin Nano
This commit is contained in:
1 parent
a54a070ca9
commit
7aa5d5eb61
53 files changed
+778
-28
No files matched your search
Regular → Executable
+22
-1
@@ -10,12 +10,14 @@ from chicken_counter.types import MotionState, TrackObservation
|
||||
|
||||
|
||||
class BackwardMotionDetector:
|
||||
def __init__(self, config: MotionConfig, roi: RoiConfig) -> None:
|
||||
def __init__(self, config: MotionConfig, roi: RoiConfig, *, verbose: bool = False) -> None:
|
||||
self.config = config
|
||||
self.roi = roi
|
||||
self.previous_gray: np.ndarray | None = None
|
||||
self.state = MotionState()
|
||||
self._roi_bounds = self._compute_roi_bounds()
|
||||
self.verbose = verbose
|
||||
self._update_count = 0
|
||||
|
||||
def _compute_roi_bounds(self) -> tuple[int, int, int, int]:
|
||||
x_values = [point[0] for point in self.roi.points]
|
||||
@@ -94,6 +96,25 @@ class BackwardMotionDetector:
|
||||
self.state.backward_active = False
|
||||
|
||||
if self.state.consecutive_reverse_frames >= self.config.debounce_frames:
|
||||
was_active = self.state.backward_active
|
||||
self.state.backward_active = True
|
||||
if self.verbose and not was_active:
|
||||
print(
|
||||
f"[motion #{self._update_count}] BACKWARD TRIGGERED! "
|
||||
f"smoothed_speed={self.state.smoothed_speed:.1f} "
|
||||
f"consecutive={self.state.consecutive_reverse_frames}"
|
||||
)
|
||||
|
||||
if self.verbose:
|
||||
self._update_count += 1
|
||||
features_found = len(valid_prev) if points is not None and self.previous_gray is not None else 0
|
||||
print(
|
||||
f"[motion #{self._update_count}] "
|
||||
f"features={features_found} "
|
||||
f"median_speed={median_axis_speed:.1f} "
|
||||
f"smoothed_speed={self.state.smoothed_speed:.1f} "
|
||||
f"consecutive_rev={self.state.consecutive_reverse_frames} "
|
||||
f"backward={self.state.backward_active}"
|
||||
)
|
||||
|
||||
return self.state
|
||||
Reference in new issue
Block a user