coco/coco.sql
2020-03-04 22:24:49 +01:00

45 lines
1 KiB
SQL

BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "segments" (
"id" INTEGER UNIQUE,
"annotation_id" INTEGER,
"points" TEXT,
PRIMARY KEY("id")
) WITHOUT ROWID;
CREATE TABLE IF NOT EXISTS "categories" (
"id" INTEGER UNIQUE,
"supercategory" TEXT,
"name" TEXT UNIQUE,
PRIMARY KEY("id")
) WITHOUT ROWID;
CREATE TABLE IF NOT EXISTS "images" (
"id" INTEGER UNIQUE,
"flickr_url" TEXT,
"coco_url" TEXT,
"width" FLOAT,
"height" FLOAT,
"date_captured" DATETIME,
PRIMARY KEY("id","id")
) WITHOUT ROWID;
CREATE TABLE IF NOT EXISTS "annotations" (
"id" INTEGER UNIQUE,
"image_id" INTEGER,
"category_id" INTEGER,
"iscrowd" BOOL,
"area" FLOAT,
"bbox_top" FLOAT,
"bbox_left" FLOAT,
"bbox_width" FLOAT,
"bbox_height" FLOAT,
"zerkine_moments" TEXT DEFAULT NULL,
PRIMARY KEY("id")
) WITHOUT ROWID;
CREATE INDEX IF NOT EXISTS "segments_annotation" ON "segments" (
"annotation_id"
);
CREATE INDEX IF NOT EXISTS "annotations_image" ON "annotations" (
"image_id"
);
CREATE INDEX IF NOT EXISTS "annotations_category" ON "annotations" (
"category_id"
);
COMMIT;