Refactor: Phase 7: Dead Code Removal & Optimization

This commit is contained in:
ziesorx 2025-09-12 16:15:37 +07:00
parent accefde8a1
commit af34f4fd08
13 changed files with 2654 additions and 2609 deletions

View file

@ -12,7 +12,7 @@ import json
import os
import logging
import threading
from typing import Dict, Any, Optional, Union, List
from typing import Dict, Any, Optional, List
from pathlib import Path
from dataclasses import dataclass, field
from abc import ABC, abstractmethod

View file

@ -4,21 +4,18 @@ Detection orchestrator module.
This module provides the main orchestration classes that coordinate between
all the different components for the detection workflow.
"""
import asyncio
import json
import logging
import time
import traceback
from typing import Dict, Any, Optional, List, Callable
from typing import Dict, Any, Optional, List
from fastapi import WebSocket
from websockets.exceptions import ConnectionClosedError, WebSocketDisconnect
from .config import config
from .constants import HEARTBEAT_INTERVAL
from .exceptions import DetectionError, OrchestrationError
from ..communication.websocket_handler import WebSocketHandler
from ..communication.message_processor import MessageProcessor, MessageType
from ..communication.message_processor import MessageProcessor
from ..communication.response_formatter import ResponseFormatter
from ..streams.stream_manager import StreamManager
from ..models.model_manager import ModelManager

View file

@ -15,8 +15,8 @@ from ..core.constants import (
LIGHTWEIGHT_DETECTION_MIN_BBOX_AREA_RATIO,
DEFAULT_MIN_CONFIDENCE
)
from ..core.exceptions import ValidationError, create_detection_error
from ..detection.detection_result import LightweightDetectionResult, BoundingBox
from ..core.exceptions import create_detection_error
from ..detection.detection_result import LightweightDetectionResult
logger = logging.getLogger(__name__)

View file

@ -9,10 +9,8 @@ import time
import logging
from typing import Dict, List, Any, Optional, Tuple, Set
from dataclasses import dataclass, field
from datetime import datetime
from ..core.constants import SESSION_TIMEOUT_SECONDS
from ..core.exceptions import TrackingError, create_detection_error
logger = logging.getLogger(__name__)

View file

@ -5,15 +5,12 @@ This module provides the main detection functionality combining YOLO object dete
with BoT-SORT tracking for stable track validation.
"""
import cv2
import logging
from typing import Dict, List, Any, Optional, Tuple, Set
from dataclasses import dataclass, field
from datetime import datetime
from ..core.constants import DEFAULT_STABILITY_THRESHOLD, DEFAULT_MIN_CONFIDENCE
from ..core.exceptions import DetectionError, create_detection_error
from ..detection.detection_result import DetectionResult, BoundingBox, DetectionSession
logger = logging.getLogger(__name__)