I need you to write a complete Python application for an AI-based Network Video Recorder…
- User
I need you to write a complete Python application for an AI-based Network Video Recorder (NVR) designed to run on a Jetson Orin Nano 8GB using DeepStream 7.1. The application should perform the following tasks:
Core Functionality:
Real-time Video Input: Support multiple dynamic RTSP camera sources (initially configurable via a config file, aiming for web-based dynamic management later).
Object Detection: Utilize YOLOv9 for primary object detection to identify "person" and "vehicle" classes in the video streams.
Object Tracking: Implement robust object tracking to maintain unique IDs for detected persons and vehicles across frames.
Face Recognition: Integrate a secondary inference engine (SGIE) using a model like MobileFaceNet to generate face embeddings for detected faces. Compare these embeddings against a database of known faces and store embeddings for new faces.
License Plate Recognition (LPR): Integrate an NVIDIA LPR model as an SGIE to recognize license plates of detected vehicles.
Database Storage: Use SQLite to store the following information persistently:
People: person_id, name (initially "Unknown"), face_embedding, face_image_path, created_at, updated_at, is_known (boolean).
Vehicles: vehicle_id, license_plate (initially NULL), vehicle_image_path, created_at, updated_at, is_known (boolean).
Detections: detection_id, detection_type ('person' or 'vehicle'), object_id (foreign key to people or vehicles), timestamp, image_path, frame_number, source_id, is_new_detection (boolean).
Vehicle Sightings: sighting_id, vehicle_id (foreign key to vehicles), first_seen_at, last_seen_at, event_active (boolean - for lingering vehicle detection).
MQTT Alerting: Send MQTT alerts to a homeowner for:
Detection of an "unknown person" (new face not recognized in the database).
Detection of a "lingering unknown vehicle" (a vehicle that remains stationary in the scene for more than 5 minutes without associated person activity).
Web Interface (Flask Application): 8. User Interface: Create a modern and beautiful web interface using Flask to:
- Display lists of "unknown people" and "unknown vehicles" detected by the system.
- Show cropped images and basic information for unknown individuals and vehicles.
- Provide a "Mark as Known" button/action in the UI to allow users to manually classify people and vehicles as known.
Application Qualities: 9. Robustness and Error Handling: Implement excellent error handling to ensure the application is stable and reliable in real-world conditions. 10. Performance: Optimize the application for performant operation on the Jetson Orin Nano 8GB, ensuring smooth video processing and inference. 11. Extensibility: Design the application with a modular and extensible architecture to allow for future feature additions and modifications. 12. Security Focus: Consider security best practices in the design and implementation, especially regarding configuration management and potential web interface security (though initial focus is on functionality). 13. Code Quality: Produce clean, well-commented, and maintainable Python code.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.