Add database schema and UI for AI object detection management #4496
+348
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds infrastructure for managing AI object detection models, classes, and settings in ZoneMinder. Provides database tables for storing models, object classes, detection settings per monitor, and detection results, along with a web UI for managing object classes.
Database Schema (
db/AI_Models.sql)Four new tables with foreign key constraints:
Web UI
Options → AI tab for managing AI_Object_Classes:
_options_ai_classes.php) - Table with model name, class name, class index, bulk deleteai_class.php) - Form for add/edit with model dropdownai_class.php) - Save/delete withcanEdit('System')permission checksai_classes.js,options.js) - Modal handling and validationExample usage flow:
Security
validCardinal()/validInt()sanitizationvalidHtmlStr()Integration
Follows existing patterns from Storage/Servers tabs.
Original prompt
Overview
Add database schema and user interface for managing AI object detection capabilities in ZoneMinder. This includes tables for AI models, object classes, detection settings per monitor, and actual detection results.
Database Schema Changes
Create new SQL file
db/AI_Models.sqlwith the following tables:1. AI_Models Table
Stores AI models being used for detection:
2. AI_Object_Classes Table
Stores object classes that can be detected by each model:
3. AI_Detection_Settings Table
Stores detection settings per monitor and object class (MonitorId can be NULL for defaults):
4. AI_Detections Table
Stores actual detection results:
UI Implementation
1. Create AI Classes Management UI
Create
web/skins/classic/views/_options_ai_classes.php:2. Create AI Class Editor Modal
Create
web/skins/classic/views/ai_class.php:3. Create JavaScript Handler
Create
web/skins/classic/views/js/ai_classes.js:4. Create Backend Action Handler
Create
web/includes/actions/ai_class.php:5. Update Options Page
Modify
web/skins/classic/views/options.phparound line 142:6. Register AI Tab in Submenu
Modify
web/skins/classic/includes/functions.phparound line 984:Add
'ai'to the$categoryDisplayOrderarray inbuildSubMenuOptions: