fix: stability fix
All checks were successful
Build Worker Base and Application Images / check-base-changes (push) Successful in 10s
Build Worker Base and Application Images / build-base (push) Has been skipped
Build Worker Base and Application Images / build-docker (push) Successful in 2m53s
Build Worker Base and Application Images / deploy-stack (push) Successful in 8s
All checks were successful
Build Worker Base and Application Images / check-base-changes (push) Successful in 10s
Build Worker Base and Application Images / build-base (push) Has been skipped
Build Worker Base and Application Images / build-docker (push) Successful in 2m53s
Build Worker Base and Application Images / deploy-stack (push) Successful in 8s
This commit is contained in:
parent
bfab574058
commit
0cf0bc8b91
3 changed files with 215 additions and 60 deletions
|
@ -51,8 +51,8 @@ class StableCarValidator:
|
|||
|
||||
# Validation thresholds
|
||||
self.min_stable_duration = self.config.get('min_stable_duration', 3.0) # seconds
|
||||
self.min_stable_frames = self.config.get('min_stable_frames', 10)
|
||||
self.position_variance_threshold = self.config.get('position_variance_threshold', 25.0) # pixels
|
||||
self.min_stable_frames = self.config.get('min_stable_frames', 8)
|
||||
self.position_variance_threshold = self.config.get('position_variance_threshold', 40.0) # pixels - adjusted for HD
|
||||
self.min_confidence = self.config.get('min_confidence', 0.7)
|
||||
self.velocity_threshold = self.config.get('velocity_threshold', 5.0) # pixels/frame
|
||||
self.entering_zone_ratio = self.config.get('entering_zone_ratio', 0.3) # 30% of frame
|
||||
|
@ -188,9 +188,9 @@ class StableCarValidator:
|
|||
x_position = vehicle.center[0] / self.frame_width
|
||||
y_position = vehicle.center[1] / self.frame_height
|
||||
|
||||
# Check if vehicle is stable
|
||||
stability = vehicle.calculate_stability()
|
||||
if stability > 0.7 and velocity < self.velocity_threshold:
|
||||
# Check if vehicle is stable using hybrid approach
|
||||
stability_score, stability_reason = vehicle.calculate_hybrid_stability()
|
||||
if stability_score > 0.65 and velocity < self.velocity_threshold:
|
||||
# Check if it's been stable long enough
|
||||
duration = time.time() - vehicle.first_seen
|
||||
if duration > self.min_stable_duration and vehicle.stable_frames >= self.min_stable_frames:
|
||||
|
@ -294,11 +294,15 @@ class StableCarValidator:
|
|||
# All checks passed - vehicle is valid for processing
|
||||
self.last_processed_vehicles[vehicle.track_id] = time.time()
|
||||
|
||||
# Get hybrid stability info for detailed reasoning
|
||||
hybrid_stability, hybrid_reason = vehicle.calculate_hybrid_stability()
|
||||
processing_reason = f"Vehicle is stable and ready for processing (hybrid: {hybrid_reason})"
|
||||
|
||||
return ValidationResult(
|
||||
is_valid=True,
|
||||
state=VehicleState.STABLE,
|
||||
confidence=vehicle.avg_confidence,
|
||||
reason="Vehicle is stable and ready for processing",
|
||||
reason=processing_reason,
|
||||
should_process=True,
|
||||
track_id=vehicle.track_id
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue