mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-12-05 07:12:34 -05:00
remove half-baked object detection schema
I want to release schema version 6 now, with the fully developed pieces.
This commit is contained in:
@@ -271,12 +271,6 @@ pub(crate) fn delete_recordings(tx: &rusqlite::Transaction, sample_file_dir_id:
|
||||
:start <= composite_id and
|
||||
composite_id < :end
|
||||
"#)?;
|
||||
let mut del_detection = tx.prepare_cached(r#"
|
||||
delete from recording_object_detection
|
||||
where
|
||||
:start <= composite_id and
|
||||
composite_id < :end
|
||||
"#)?;
|
||||
let mut del_main = tx.prepare_cached(r#"
|
||||
delete from recording
|
||||
where
|
||||
@@ -300,9 +294,6 @@ pub(crate) fn delete_recordings(tx: &rusqlite::Transaction, sample_file_dir_id:
|
||||
if n_integrity > n { // fewer is okay; recording_integrity is optional.
|
||||
bail!("inserted {} garbage rows but deleted {} recording_integrity rows!", n, n_integrity);
|
||||
}
|
||||
// Any number of object detection rows is okay, as there can be zero or more models per
|
||||
// recording.
|
||||
del_detection.execute_named(p)?;
|
||||
let n_main = del_main.execute_named(p)?;
|
||||
if n_main != n {
|
||||
bail!("inserted {} garbage rows but deleted {} recording rows!", n, n_main);
|
||||
|
||||
@@ -519,45 +519,5 @@ create table signal_change (
|
||||
changes blob not null
|
||||
);
|
||||
|
||||
create table object_detection_model (
|
||||
id integer primary key,
|
||||
uuid blob unique not null check (length(uuid) = 16),
|
||||
name text not null,
|
||||
|
||||
-- The actual model and label mappings, in a tbd protocol buffer message
|
||||
-- format.
|
||||
data blob
|
||||
);
|
||||
|
||||
-- An entry for every supported label in any model. (E.g., there is one row
|
||||
-- for "person" even if there are many models that support detecting people.)
|
||||
create table object_detection_label (
|
||||
id integer primary key,
|
||||
uuid blob unique not null check (length(uuid) = 16),
|
||||
name text unique not null,
|
||||
color text
|
||||
);
|
||||
|
||||
create table recording_object_detection (
|
||||
composite_id integer not null references recording (composite_id),
|
||||
model_id integer not null references object_detection_model (id),
|
||||
|
||||
-- repeated:
|
||||
-- * frame delta unsigned varint
|
||||
-- * label unsigned varint
|
||||
-- * xmin, xmax, ymin, ymax as fixed 8-bit numbers
|
||||
-- (any value from knowing xmin <= xmax, ymin <= ymax?
|
||||
-- probably not a whole byte anyway.)
|
||||
-- although 256/300 or 256/320 is not super clean. awkward.
|
||||
-- * score/probability/whatever-it's-called as fixed 8-bit number
|
||||
-- linear scale?
|
||||
frame_data blob not null,
|
||||
|
||||
-- Operations are almost always done on a bounded set of recordings, so
|
||||
-- and perhaps on all models. Use composite_id as the prefix of the primary
|
||||
-- key to make these efficient.
|
||||
primary key (composite_id, model_id)
|
||||
);
|
||||
|
||||
insert into version (id, unix_time, notes)
|
||||
values (6, cast(strftime('%s', 'now') as int), 'db creation');
|
||||
|
||||
@@ -328,27 +328,6 @@ pub fn run(_args: &super::Args, tx: &rusqlite::Transaction) -> Result<(), Error>
|
||||
revocation_reason_detail = 'Blake2b->Blake3 upgrade'
|
||||
where
|
||||
revocation_reason is null;
|
||||
|
||||
create table object_detection_model (
|
||||
id integer primary key,
|
||||
uuid blob unique not null check (length(uuid) = 16),
|
||||
name text not null,
|
||||
data blob
|
||||
);
|
||||
|
||||
create table object_detection_label (
|
||||
id integer primary key,
|
||||
uuid blob unique not null check (length(uuid) = 16),
|
||||
name text unique not null,
|
||||
color text
|
||||
);
|
||||
|
||||
create table recording_object_detection (
|
||||
composite_id integer not null references recording (composite_id),
|
||||
model_id integer not null references object_detection_model (id),
|
||||
frame_data blob not null,
|
||||
primary key (composite_id, model_id)
|
||||
);
|
||||
"#)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user