How hinmq21/object-detection-app works
High-Level Architecture Components
a. Client (Web Browser)
• UI built with HTML/CSS/JS (template/index.html, static/js and static/css).
• Upload form and model-selector dropdown.
b. Flask Application Server
• Entry point: app.py
• Configuration: config.py
• Blueprints:
• main_routes.py serves HTML pages and status polling endpoints
• api_routes.py handles image upload and result retrieval
c. Task Processing
• tasks/task_manager.py uses ThreadPoolExecutor for asynchronous jobs
• detection tasks are queued, status tracked in memory or lightweight store
d. Model Management
• models/model_manager.py loads, caches, and provides YOLO models on demand
e. Image & Detection Utilities
• utils/image_utils.py pre-processes (resize, format conversion)
f. Storage
• static/uploads (or configured folder) holds original and processed images
g. External Dependencies
• Ultralytics YOLO (model files auto-downloaded)
• OpenCV, Pillow, NumPy
Important Architectural Patterns
• Blueprint separation (main vs. API routes)
• Asynchronous, non-blocking processing with ThreadPoolExecutor
• Lazy loading and caching of heavyweight models
• Modular utilities to isolate image I/O and detection logic