Add AI Models database schema and management UI#4499
Draft
Conversation
- Created db/AI_Models.sql with 5 tables for AI management - Created db/coco_dataset.sql with COCO dataset pre-population - Added UI views for AI Datasets, Models, and Object Classes - Added modal editors and JavaScript handlers for each component - Added backend action handlers for CRUD operations - Integrated new tabs into options.php and menu system Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com>
- Integrated AI Datasets, Models, and Classes handlers into options.js - Removed separate JS files to follow ZoneMinder pattern - Added dataset filter functionality for AI Classes tab Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com>
- Improved jQuery selector efficiency in dataset filter - Use subquery for DatasetId to be more resilient to insertion order Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add database schema and user interfaces for AI detection management
Add AI Models database schema and management UI
Dec 22, 2025
connortechnology
added a commit
to connortechnology/ZoneMinder
that referenced
this pull request
Feb 15, 2026
Add infrastructure for managing AI object detection models, datasets,
and classes in ZoneMinder.
Database schema (db/AI_Models.sql):
- AI_Datasets: Dataset registry (COCO, ImageNet, etc.)
- AI_Models: Model implementations with framework support
- AI_Object_Classes: Object classes indexed by dataset
- AI_Detection_Settings: Per-monitor detection configuration
- AI_Detections: Detection results with bounding boxes
Pre-populated data (db/coco_dataset.sql):
- COCO 2017 dataset with all 80 object classes
- Default detection settings for person and vehicles
Web UI in Options menu:
- AI Datasets tab: Manage datasets
- AI Models tab: Manage models with framework selection
- AI Classes tab: Manage object classes with dataset filtering
- Modal editors for CRUD operations
- Action handlers with canEdit('System') permission checks
Based on PR ZoneMinder#4499.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Implements database schema and admin UI for managing AI object detection models, datasets, and classes in ZoneMinder. Separates concerns between AI datasets (COCO, ImageNet), model implementations (YOLOv8, SSD), and object classes, with per-monitor detection settings.
Database Schema
Five interconnected tables in
db/AI_Models.sql:Pre-populated COCO 2017 dataset with 80 object classes in
db/coco_dataset.sql. Default detection settings enabled for person (60% threshold) and vehicles (50% threshold).UI Implementation
Three new tabs in Options menu following existing Storage/Servers patterns:
Modal editors for CRUD operations, backend action handlers in
web/includes/actions/, JavaScript consolidated in existingoptions.js.Architecture
Foreign keys enforce referential integrity.
INSERT IGNOREfor idempotency. Uses subqueries instead of hardcoded IDs for resilience.All UI components follow ZoneMinder conventions:
canEdit('System')permission checks,makeLink()clickable rows, Bootstrap styling, CSRF protection, helper functions (dbQuery(),validHtmlStr(),getFormChanges()).Original prompt
Overview
REVISION: Updated architecture with proper separation between AI Models, Datasets, and Object Classes
Add comprehensive database schema and user interfaces for managing AI object detection in ZoneMinder. This includes proper separation between AI model implementations, datasets (like COCO), object classes, detection settings per monitor, and detection results.
Database Schema Changes
Create new SQL file
db/AI_Models.sqlwith the following tables:1. AI_Datasets Table
Stores AI datasets (COCO, ImageNet, custom datasets):
2. AI_Models Table
Stores AI model implementations (YOLOv8, SSD, etc.):
3. AI_Object_Classes Table
Stores object classes from datasets:
4. AI_Detection_Settings Table
Stores detection settings per monitor and object class (MonitorId NULL = default):
5. AI_Detections Table
Stores actual detection results:
COCO Dataset Pre-population
Create
db/coco_dataset.sql: