forked from jimmyyhwu/ddsm-visual-primitives
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.sql
More file actions
105 lines (94 loc) · 2.69 KB
/
Copy pathinit.sql
File metadata and controls
105 lines (94 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
CREATE TABLE IF NOT EXISTS doctor (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS class (
id INTEGER PRIMARY KEY,
description TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS net (
id TEXT PRIMARY KEY,
net TEXT NOT NULL,
filename TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS unit_annotation (
unit_id INTEGER NOT NULL,
net_id TEXT NOT NULL,
doctor_id INTEGER NOT NULL,
threshold REAL,
descriptions TEXT,
shows_concept INTEGER,
FOREIGN KEY(net_id) REFERENCES net(id),
FOREIGN KEY(doctor_id) REFERENCES doctor(id),
PRIMARY KEY(unit_id, net_id, doctor_id)
);
CREATE TABLE IF NOT EXISTS image (
id INTEGER PRIMARY KEY,
image_path TEXT NOT NULL,
ground_truth INTEGER NOT NULL,
split TEXT NOT NULL,
FOREIGN KEY(ground_truth) REFERENCES class(id)
);
CREATE TABLE IF NOT EXISTS image_unit_activation (
net_id TEXT NOT NULL,
image_id INTEGER NOT NULL,
unit_id INTEGER NOT NULL,
class_id INTEGER NOT NULL,
activation REAL NOT NULL,
rank INTEGER NOT NULL,
FOREIGN KEY(net_id) REFERENCES net(id),
FOREIGN KEY(image_id) REFERENCES image(id),
FOREIGN KEY(class_id) REFERENCES class(id),
PRIMARY KEY(net_id, image_id, unit_id, class_id)
);
CREATE TABLE IF NOT EXISTS image_classification (
net_id TEXT NOT NULL,
image_id INTEGER NOT NULL,
class_id INTEGER NOT NULL,
FOREIGN KEY(net_id) REFERENCES net(id),
FOREIGN KEY(image_id) REFERENCES image(id),
FOREIGN KEY(class_id) REFERENCES class(id),
PRIMARY KEY(net_id, image_id)
);
CREATE TABLE IF NOT EXISTS patch_classification (
net_id TEXT NOT NULL,
patch_filename TEXT NOT NULL,
class_id INTEGER NOT NULL,
FOREIGN KEY(net_id) REFERENCES net(id),
FOREIGN KEY(class_id) REFERENCES class(id),
PRIMARY KEY(net_id, patch_filename)
);
CREATE TABLE IF NOT EXISTS patch_unit_activation (
net_id TEXT NOT NULL,
patch_filename TEXT NOT NULL,
unit_id INTEGER NOT NULL,
class_id INTEGER NOT NULL,
activation REAL NOT NULL,
rank INTEGER NOT NULL,
ground_truth INTEGER NOT NULL,
FOREIGN KEY(net_id) REFERENCES net(id),
FOREIGN KEY(class_id) REFERENCES class(id),
FOREIGN KEY(ground_truth) REFERENCES class(id),
PRIMARY KEY(net_id, patch_filename, unit_id, class_id)
);
CREATE TABLE IF NOT EXISTS unit_class_influence (
net_id TEXT NOT NULL,
unit_id INTEGER NOT NULL,
class_id INTEGER NOT NULL,
influence REAL NOT NULL,
appearances_in_top_units INTEGER NOT NULL,
FOREIGN KEY(net_id) REFERENCES net(id),
FOREIGN KEY(class_id) REFERENCES class(id),
PRIMARY KEY(net_id, unit_id, class_id)
);
CREATE INDEX patch_unit_activation_unit_ids ON patch_unit_activation (unit_id);
INSERT INTO class (
id,
description
) VALUES (
0, "normal"
), (
1, "benign"
), (
2, "cancer"
);