Alex Cabrera commited on
Commit
8bc0b6a
1 Parent(s): 158d3c7

initial commit

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .dockerignore +1 -0
  2. .zeno_cache/EMBEDDINGIMAGENET1K_V1.pickle +3 -0
  3. .zeno_cache/EMBEDDINGIMAGENET1K_V2.pickle +3 -0
  4. .zeno_cache/EMBEDDINGresnet+clip.pickle +3 -0
  5. .zeno_cache/OUTPUTIMAGENET1K_V1.pickle +3 -0
  6. .zeno_cache/OUTPUTIMAGENET1K_V2.pickle +3 -0
  7. .zeno_cache/OUTPUTresnet+clip.pickle +3 -0
  8. .zeno_cache/POSTDISTILLcorrectIMAGENET1K_V1.pickle +3 -0
  9. .zeno_cache/POSTDISTILLcorrectIMAGENET1K_V2.pickle +3 -0
  10. .zeno_cache/POSTDISTILLoutput_labelIMAGENET1K_V1.pickle +3 -0
  11. .zeno_cache/POSTDISTILLoutput_labelIMAGENET1K_V2.pickle +3 -0
  12. .zeno_cache/PREDISTILLblue_border_count.pickle +3 -0
  13. .zeno_cache/PREDISTILLborder_brightness.pickle +3 -0
  14. .zeno_cache/PREDISTILLbrightness.pickle +3 -0
  15. .zeno_cache/PREDISTILLred_count.pickle +3 -0
  16. .zeno_cache/folders.pickle +3 -0
  17. .zeno_cache/reports.pickle +3 -0
  18. .zeno_cache/slices.pickle +3 -0
  19. .zeno_cache/view.mjs +776 -0
  20. Dockerfile +22 -0
  21. README.md +1 -0
  22. __pycache__/brightness.cpython-38.pyc +0 -0
  23. __pycache__/color.cpython-38.pyc +0 -0
  24. __pycache__/inference.cpython-38.pyc +0 -0
  25. __pycache__/loading.cpython-38.pyc +0 -0
  26. __pycache__/metrics.cpython-38.pyc +0 -0
  27. brightness.py +44 -0
  28. color.py +51 -0
  29. config.toml +11 -0
  30. imagenette/.DS_Store +0 -0
  31. imagenette/val/.DS_Store +0 -0
  32. imagenette/val/n01440764/ILSVRC2012_val_00009111.JPEG +0 -0
  33. imagenette/val/n01440764/ILSVRC2012_val_00009191.JPEG +0 -0
  34. imagenette/val/n01440764/ILSVRC2012_val_00017472.JPEG +0 -0
  35. imagenette/val/n01440764/ILSVRC2012_val_00017700.JPEG +0 -0
  36. imagenette/val/n01440764/ILSVRC2012_val_00021740.JPEG +0 -0
  37. imagenette/val/n01440764/ILSVRC2012_val_00029930.JPEG +0 -0
  38. imagenette/val/n01440764/ILSVRC2012_val_00030740.JPEG +0 -0
  39. imagenette/val/n01440764/ILSVRC2012_val_00037861.JPEG +0 -0
  40. imagenette/val/n01440764/ILSVRC2012_val_00045880.JPEG +0 -0
  41. imagenette/val/n01440764/ILSVRC2012_val_00046252.JPEG +0 -0
  42. imagenette/val/n01440764/n01440764_10040.JPEG +0 -0
  43. imagenette/val/n01440764/n01440764_10042.JPEG +0 -0
  44. imagenette/val/n01440764/n01440764_10110.JPEG +0 -0
  45. imagenette/val/n01440764/n01440764_10120.JPEG +0 -0
  46. imagenette/val/n01440764/n01440764_10150.JPEG +0 -0
  47. imagenette/val/n01440764/n01440764_10162.JPEG +0 -0
  48. imagenette/val/n01440764/n01440764_10211.JPEG +0 -0
  49. imagenette/val/n01440764/n01440764_10251.JPEG +0 -0
  50. imagenette/val/n01440764/n01440764_10281.JPEG +0 -0
.dockerignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .git
.zeno_cache/EMBEDDINGIMAGENET1K_V1.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8e0f69f152f195cc60e2967c00cde6b17a718412285ac5f215b544e27bcefee9
3
+ size 32459378
.zeno_cache/EMBEDDINGIMAGENET1K_V2.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96863b62f3d9ff89f195d8e9342943df694682f0026c9120b4f27d47f2bb6810
3
+ size 32459378
.zeno_cache/EMBEDDINGresnet+clip.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9d66f744de0b18b789b09e80a3114a532e237d70ae5a7783fd16e78c60172b0
3
+ size 1762825
.zeno_cache/OUTPUTIMAGENET1K_V1.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:af2452401beb86800c4331c61ae01702b9a797b638acb46ce214dbda6d1baa7d
3
+ size 185742
.zeno_cache/OUTPUTIMAGENET1K_V2.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:929dc46aa2c0dea6466fccf1fbda55b42c11a48c20782b90089015eb698e5e2a
3
+ size 185100
.zeno_cache/OUTPUTresnet+clip.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:87c9f035a1876086a5f0aa4df4498a462f78d18de5323dd64a40fae989254057
3
+ size 183793
.zeno_cache/POSTDISTILLcorrectIMAGENET1K_V1.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56cc4b148a91afe661b1b64b71546d4f929b108b4dd3675cebd6ecde9b540b33
3
+ size 167854
.zeno_cache/POSTDISTILLcorrectIMAGENET1K_V2.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b58173c01dada0075defbbfa081b673693168fd560c2d9bbb8034022bea06f9f
3
+ size 167854
.zeno_cache/POSTDISTILLoutput_labelIMAGENET1K_V1.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6160edcb161d72d057042d5a7432d70669616282cfbc1771bb3d9da662389556
3
+ size 185759
.zeno_cache/POSTDISTILLoutput_labelIMAGENET1K_V2.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be315d03cd6119216109d06a93162857579ee0e96e7e3e41af4629d314afaecf
3
+ size 185117
.zeno_cache/PREDISTILLblue_border_count.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cfcb503e51335ab308c35241a76bbfbc5fbd79b9e34c6c4024cbaf872449a7d6
3
+ size 174191
.zeno_cache/PREDISTILLborder_brightness.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3f6fb0629a3d26cf27b5c0f6b07f46cece9018db312c18e50893f21a50a4e73d
3
+ size 199259
.zeno_cache/PREDISTILLbrightness.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ad728441adc8c7e7d214f029ac7c4e505c40a34800292115736c61572653ad1
3
+ size 199252
.zeno_cache/PREDISTILLred_count.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e6a63cb93322c957969f428adf797b5fa2a73a03ecd4409102e8c1430d7e5cdd
3
+ size 172023
.zeno_cache/folders.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec0a6ccf9debf1c16781445c4b9106080d00478b0559469336db7c7b7b9711c8
3
+ size 5
.zeno_cache/reports.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:51652ef327bf266a3808c96bb7ed28087e097300962a18776b00e82abfe57c56
3
+ size 353
.zeno_cache/slices.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:80f7becfc692f1cb3805bb29f5f8a24f9fead5399f045c7cc265dea7cd48eaa2
3
+ size 846
.zeno_cache/view.mjs ADDED
@@ -0,0 +1,776 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function noop() { }
2
+ function run(fn) {
3
+ return fn();
4
+ }
5
+ function blank_object() {
6
+ return Object.create(null);
7
+ }
8
+ function run_all(fns) {
9
+ fns.forEach(run);
10
+ }
11
+ function is_function(thing) {
12
+ return typeof thing === 'function';
13
+ }
14
+ function safe_not_equal(a, b) {
15
+ return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
16
+ }
17
+ let src_url_equal_anchor;
18
+ function src_url_equal(element_src, url) {
19
+ if (!src_url_equal_anchor) {
20
+ src_url_equal_anchor = document.createElement('a');
21
+ }
22
+ src_url_equal_anchor.href = url;
23
+ return element_src === src_url_equal_anchor.href;
24
+ }
25
+ function is_empty(obj) {
26
+ return Object.keys(obj).length === 0;
27
+ }
28
+
29
+ // Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM
30
+ // at the end of hydration without touching the remaining nodes.
31
+ let is_hydrating = false;
32
+ function start_hydrating() {
33
+ is_hydrating = true;
34
+ }
35
+ function end_hydrating() {
36
+ is_hydrating = false;
37
+ }
38
+ function upper_bound(low, high, key, value) {
39
+ // Return first index of value larger than input value in the range [low, high)
40
+ while (low < high) {
41
+ const mid = low + ((high - low) >> 1);
42
+ if (key(mid) <= value) {
43
+ low = mid + 1;
44
+ }
45
+ else {
46
+ high = mid;
47
+ }
48
+ }
49
+ return low;
50
+ }
51
+ function init_hydrate(target) {
52
+ if (target.hydrate_init)
53
+ return;
54
+ target.hydrate_init = true;
55
+ // We know that all children have claim_order values since the unclaimed have been detached if target is not <head>
56
+ let children = target.childNodes;
57
+ // If target is <head>, there may be children without claim_order
58
+ if (target.nodeName === 'HEAD') {
59
+ const myChildren = [];
60
+ for (let i = 0; i < children.length; i++) {
61
+ const node = children[i];
62
+ if (node.claim_order !== undefined) {
63
+ myChildren.push(node);
64
+ }
65
+ }
66
+ children = myChildren;
67
+ }
68
+ /*
69
+ * Reorder claimed children optimally.
70
+ * We can reorder claimed children optimally by finding the longest subsequence of
71
+ * nodes that are already claimed in order and only moving the rest. The longest
72
+ * subsequence subsequence of nodes that are claimed in order can be found by
73
+ * computing the longest increasing subsequence of .claim_order values.
74
+ *
75
+ * This algorithm is optimal in generating the least amount of reorder operations
76
+ * possible.
77
+ *
78
+ * Proof:
79
+ * We know that, given a set of reordering operations, the nodes that do not move
80
+ * always form an increasing subsequence, since they do not move among each other
81
+ * meaning that they must be already ordered among each other. Thus, the maximal
82
+ * set of nodes that do not move form a longest increasing subsequence.
83
+ */
84
+ // Compute longest increasing subsequence
85
+ // m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j
86
+ const m = new Int32Array(children.length + 1);
87
+ // Predecessor indices + 1
88
+ const p = new Int32Array(children.length);
89
+ m[0] = -1;
90
+ let longest = 0;
91
+ for (let i = 0; i < children.length; i++) {
92
+ const current = children[i].claim_order;
93
+ // Find the largest subsequence length such that it ends in a value less than our current value
94
+ // upper_bound returns first greater value, so we subtract one
95
+ // with fast path for when we are on the current longest subsequence
96
+ const seqLen = ((longest > 0 && children[m[longest]].claim_order <= current) ? longest + 1 : upper_bound(1, longest, idx => children[m[idx]].claim_order, current)) - 1;
97
+ p[i] = m[seqLen] + 1;
98
+ const newLen = seqLen + 1;
99
+ // We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.
100
+ m[newLen] = i;
101
+ longest = Math.max(newLen, longest);
102
+ }
103
+ // The longest increasing subsequence of nodes (initially reversed)
104
+ const lis = [];
105
+ // The rest of the nodes, nodes that will be moved
106
+ const toMove = [];
107
+ let last = children.length - 1;
108
+ for (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {
109
+ lis.push(children[cur - 1]);
110
+ for (; last >= cur; last--) {
111
+ toMove.push(children[last]);
112
+ }
113
+ last--;
114
+ }
115
+ for (; last >= 0; last--) {
116
+ toMove.push(children[last]);
117
+ }
118
+ lis.reverse();
119
+ // We sort the nodes being moved to guarantee that their insertion order matches the claim order
120
+ toMove.sort((a, b) => a.claim_order - b.claim_order);
121
+ // Finally, we move the nodes
122
+ for (let i = 0, j = 0; i < toMove.length; i++) {
123
+ while (j < lis.length && toMove[i].claim_order >= lis[j].claim_order) {
124
+ j++;
125
+ }
126
+ const anchor = j < lis.length ? lis[j] : null;
127
+ target.insertBefore(toMove[i], anchor);
128
+ }
129
+ }
130
+ function append(target, node) {
131
+ target.appendChild(node);
132
+ }
133
+ function append_styles(target, style_sheet_id, styles) {
134
+ const append_styles_to = get_root_for_style(target);
135
+ if (!append_styles_to.getElementById(style_sheet_id)) {
136
+ const style = element('style');
137
+ style.id = style_sheet_id;
138
+ style.textContent = styles;
139
+ append_stylesheet(append_styles_to, style);
140
+ }
141
+ }
142
+ function get_root_for_style(node) {
143
+ if (!node)
144
+ return document;
145
+ const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
146
+ if (root && root.host) {
147
+ return root;
148
+ }
149
+ return node.ownerDocument;
150
+ }
151
+ function append_stylesheet(node, style) {
152
+ append(node.head || node, style);
153
+ }
154
+ function append_hydration(target, node) {
155
+ if (is_hydrating) {
156
+ init_hydrate(target);
157
+ if ((target.actual_end_child === undefined) || ((target.actual_end_child !== null) && (target.actual_end_child.parentElement !== target))) {
158
+ target.actual_end_child = target.firstChild;
159
+ }
160
+ // Skip nodes of undefined ordering
161
+ while ((target.actual_end_child !== null) && (target.actual_end_child.claim_order === undefined)) {
162
+ target.actual_end_child = target.actual_end_child.nextSibling;
163
+ }
164
+ if (node !== target.actual_end_child) {
165
+ // We only insert if the ordering of this node should be modified or the parent node is not target
166
+ if (node.claim_order !== undefined || node.parentNode !== target) {
167
+ target.insertBefore(node, target.actual_end_child);
168
+ }
169
+ }
170
+ else {
171
+ target.actual_end_child = node.nextSibling;
172
+ }
173
+ }
174
+ else if (node.parentNode !== target || node.nextSibling !== null) {
175
+ target.appendChild(node);
176
+ }
177
+ }
178
+ function insert_hydration(target, node, anchor) {
179
+ if (is_hydrating && !anchor) {
180
+ append_hydration(target, node);
181
+ }
182
+ else if (node.parentNode !== target || node.nextSibling != anchor) {
183
+ target.insertBefore(node, anchor || null);
184
+ }
185
+ }
186
+ function detach(node) {
187
+ node.parentNode.removeChild(node);
188
+ }
189
+ function element(name) {
190
+ return document.createElement(name);
191
+ }
192
+ function text(data) {
193
+ return document.createTextNode(data);
194
+ }
195
+ function space() {
196
+ return text(' ');
197
+ }
198
+ function attr(node, attribute, value) {
199
+ if (value == null)
200
+ node.removeAttribute(attribute);
201
+ else if (node.getAttribute(attribute) !== value)
202
+ node.setAttribute(attribute, value);
203
+ }
204
+ function children(element) {
205
+ return Array.from(element.childNodes);
206
+ }
207
+ function init_claim_info(nodes) {
208
+ if (nodes.claim_info === undefined) {
209
+ nodes.claim_info = { last_index: 0, total_claimed: 0 };
210
+ }
211
+ }
212
+ function claim_node(nodes, predicate, processNode, createNode, dontUpdateLastIndex = false) {
213
+ // Try to find nodes in an order such that we lengthen the longest increasing subsequence
214
+ init_claim_info(nodes);
215
+ const resultNode = (() => {
216
+ // We first try to find an element after the previous one
217
+ for (let i = nodes.claim_info.last_index; i < nodes.length; i++) {
218
+ const node = nodes[i];
219
+ if (predicate(node)) {
220
+ const replacement = processNode(node);
221
+ if (replacement === undefined) {
222
+ nodes.splice(i, 1);
223
+ }
224
+ else {
225
+ nodes[i] = replacement;
226
+ }
227
+ if (!dontUpdateLastIndex) {
228
+ nodes.claim_info.last_index = i;
229
+ }
230
+ return node;
231
+ }
232
+ }
233
+ // Otherwise, we try to find one before
234
+ // We iterate in reverse so that we don't go too far back
235
+ for (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {
236
+ const node = nodes[i];
237
+ if (predicate(node)) {
238
+ const replacement = processNode(node);
239
+ if (replacement === undefined) {
240
+ nodes.splice(i, 1);
241
+ }
242
+ else {
243
+ nodes[i] = replacement;
244
+ }
245
+ if (!dontUpdateLastIndex) {
246
+ nodes.claim_info.last_index = i;
247
+ }
248
+ else if (replacement === undefined) {
249
+ // Since we spliced before the last_index, we decrease it
250
+ nodes.claim_info.last_index--;
251
+ }
252
+ return node;
253
+ }
254
+ }
255
+ // If we can't find any matching node, we create a new one
256
+ return createNode();
257
+ })();
258
+ resultNode.claim_order = nodes.claim_info.total_claimed;
259
+ nodes.claim_info.total_claimed += 1;
260
+ return resultNode;
261
+ }
262
+ function claim_element_base(nodes, name, attributes, create_element) {
263
+ return claim_node(nodes, (node) => node.nodeName === name, (node) => {
264
+ const remove = [];
265
+ for (let j = 0; j < node.attributes.length; j++) {
266
+ const attribute = node.attributes[j];
267
+ if (!attributes[attribute.name]) {
268
+ remove.push(attribute.name);
269
+ }
270
+ }
271
+ remove.forEach(v => node.removeAttribute(v));
272
+ return undefined;
273
+ }, () => create_element(name));
274
+ }
275
+ function claim_element(nodes, name, attributes) {
276
+ return claim_element_base(nodes, name, attributes, element);
277
+ }
278
+ function claim_text(nodes, data) {
279
+ return claim_node(nodes, (node) => node.nodeType === 3, (node) => {
280
+ const dataStr = '' + data;
281
+ if (node.data.startsWith(dataStr)) {
282
+ if (node.data.length !== dataStr.length) {
283
+ return node.splitText(dataStr.length);
284
+ }
285
+ }
286
+ else {
287
+ node.data = dataStr;
288
+ }
289
+ }, () => text(data), true // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements
290
+ );
291
+ }
292
+ function claim_space(nodes) {
293
+ return claim_text(nodes, ' ');
294
+ }
295
+ function set_data(text, data) {
296
+ data = '' + data;
297
+ if (text.wholeText !== data)
298
+ text.data = data;
299
+ }
300
+ function set_style(node, key, value, important) {
301
+ if (value === null) {
302
+ node.style.removeProperty(key);
303
+ }
304
+ else {
305
+ node.style.setProperty(key, value, important ? 'important' : '');
306
+ }
307
+ }
308
+
309
+ let current_component;
310
+ function set_current_component(component) {
311
+ current_component = component;
312
+ }
313
+
314
+ const dirty_components = [];
315
+ const binding_callbacks = [];
316
+ const render_callbacks = [];
317
+ const flush_callbacks = [];
318
+ const resolved_promise = Promise.resolve();
319
+ let update_scheduled = false;
320
+ function schedule_update() {
321
+ if (!update_scheduled) {
322
+ update_scheduled = true;
323
+ resolved_promise.then(flush);
324
+ }
325
+ }
326
+ function add_render_callback(fn) {
327
+ render_callbacks.push(fn);
328
+ }
329
+ // flush() calls callbacks in this order:
330
+ // 1. All beforeUpdate callbacks, in order: parents before children
331
+ // 2. All bind:this callbacks, in reverse order: children before parents.
332
+ // 3. All afterUpdate callbacks, in order: parents before children. EXCEPT
333
+ // for afterUpdates called during the initial onMount, which are called in
334
+ // reverse order: children before parents.
335
+ // Since callbacks might update component values, which could trigger another
336
+ // call to flush(), the following steps guard against this:
337
+ // 1. During beforeUpdate, any updated components will be added to the
338
+ // dirty_components array and will cause a reentrant call to flush(). Because
339
+ // the flush index is kept outside the function, the reentrant call will pick
340
+ // up where the earlier call left off and go through all dirty components. The
341
+ // current_component value is saved and restored so that the reentrant call will
342
+ // not interfere with the "parent" flush() call.
343
+ // 2. bind:this callbacks cannot trigger new flush() calls.
344
+ // 3. During afterUpdate, any updated components will NOT have their afterUpdate
345
+ // callback called a second time; the seen_callbacks set, outside the flush()
346
+ // function, guarantees this behavior.
347
+ const seen_callbacks = new Set();
348
+ let flushidx = 0; // Do *not* move this inside the flush() function
349
+ function flush() {
350
+ const saved_component = current_component;
351
+ do {
352
+ // first, call beforeUpdate functions
353
+ // and update components
354
+ while (flushidx < dirty_components.length) {
355
+ const component = dirty_components[flushidx];
356
+ flushidx++;
357
+ set_current_component(component);
358
+ update(component.$$);
359
+ }
360
+ set_current_component(null);
361
+ dirty_components.length = 0;
362
+ flushidx = 0;
363
+ while (binding_callbacks.length)
364
+ binding_callbacks.pop()();
365
+ // then, once components are updated, call
366
+ // afterUpdate functions. This may cause
367
+ // subsequent updates...
368
+ for (let i = 0; i < render_callbacks.length; i += 1) {
369
+ const callback = render_callbacks[i];
370
+ if (!seen_callbacks.has(callback)) {
371
+ // ...so guard against infinite loops
372
+ seen_callbacks.add(callback);
373
+ callback();
374
+ }
375
+ }
376
+ render_callbacks.length = 0;
377
+ } while (dirty_components.length);
378
+ while (flush_callbacks.length) {
379
+ flush_callbacks.pop()();
380
+ }
381
+ update_scheduled = false;
382
+ seen_callbacks.clear();
383
+ set_current_component(saved_component);
384
+ }
385
+ function update($$) {
386
+ if ($$.fragment !== null) {
387
+ $$.update();
388
+ run_all($$.before_update);
389
+ const dirty = $$.dirty;
390
+ $$.dirty = [-1];
391
+ $$.fragment && $$.fragment.p($$.ctx, dirty);
392
+ $$.after_update.forEach(add_render_callback);
393
+ }
394
+ }
395
+ const outroing = new Set();
396
+ function transition_in(block, local) {
397
+ if (block && block.i) {
398
+ outroing.delete(block);
399
+ block.i(local);
400
+ }
401
+ }
402
+ function mount_component(component, target, anchor, customElement) {
403
+ const { fragment, on_mount, on_destroy, after_update } = component.$$;
404
+ fragment && fragment.m(target, anchor);
405
+ if (!customElement) {
406
+ // onMount happens before the initial afterUpdate
407
+ add_render_callback(() => {
408
+ const new_on_destroy = on_mount.map(run).filter(is_function);
409
+ if (on_destroy) {
410
+ on_destroy.push(...new_on_destroy);
411
+ }
412
+ else {
413
+ // Edge case - component was destroyed immediately,
414
+ // most likely as a result of a binding initialising
415
+ run_all(new_on_destroy);
416
+ }
417
+ component.$$.on_mount = [];
418
+ });
419
+ }
420
+ after_update.forEach(add_render_callback);
421
+ }
422
+ function destroy_component(component, detaching) {
423
+ const $$ = component.$$;
424
+ if ($$.fragment !== null) {
425
+ run_all($$.on_destroy);
426
+ $$.fragment && $$.fragment.d(detaching);
427
+ // TODO null out other refs, including component.$$ (but need to
428
+ // preserve final state?)
429
+ $$.on_destroy = $$.fragment = null;
430
+ $$.ctx = [];
431
+ }
432
+ }
433
+ function make_dirty(component, i) {
434
+ if (component.$$.dirty[0] === -1) {
435
+ dirty_components.push(component);
436
+ schedule_update();
437
+ component.$$.dirty.fill(0);
438
+ }
439
+ component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
440
+ }
441
+ function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) {
442
+ const parent_component = current_component;
443
+ set_current_component(component);
444
+ const $$ = component.$$ = {
445
+ fragment: null,
446
+ ctx: null,
447
+ // state
448
+ props,
449
+ update: noop,
450
+ not_equal,
451
+ bound: blank_object(),
452
+ // lifecycle
453
+ on_mount: [],
454
+ on_destroy: [],
455
+ on_disconnect: [],
456
+ before_update: [],
457
+ after_update: [],
458
+ context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
459
+ // everything else
460
+ callbacks: blank_object(),
461
+ dirty,
462
+ skip_bound: false,
463
+ root: options.target || parent_component.$$.root
464
+ };
465
+ append_styles && append_styles($$.root);
466
+ let ready = false;
467
+ $$.ctx = instance
468
+ ? instance(component, options.props || {}, (i, ret, ...rest) => {
469
+ const value = rest.length ? rest[0] : ret;
470
+ if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
471
+ if (!$$.skip_bound && $$.bound[i])
472
+ $$.bound[i](value);
473
+ if (ready)
474
+ make_dirty(component, i);
475
+ }
476
+ return ret;
477
+ })
478
+ : [];
479
+ $$.update();
480
+ ready = true;
481
+ run_all($$.before_update);
482
+ // `false` as a special case of no DOM component
483
+ $$.fragment = create_fragment ? create_fragment($$.ctx) : false;
484
+ if (options.target) {
485
+ if (options.hydrate) {
486
+ start_hydrating();
487
+ const nodes = children(options.target);
488
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
489
+ $$.fragment && $$.fragment.l(nodes);
490
+ nodes.forEach(detach);
491
+ }
492
+ else {
493
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
494
+ $$.fragment && $$.fragment.c();
495
+ }
496
+ if (options.intro)
497
+ transition_in(component.$$.fragment);
498
+ mount_component(component, options.target, options.anchor, options.customElement);
499
+ end_hydrating();
500
+ flush();
501
+ }
502
+ set_current_component(parent_component);
503
+ }
504
+ /**
505
+ * Base class for Svelte components. Used when dev=false.
506
+ */
507
+ class SvelteComponent {
508
+ $destroy() {
509
+ destroy_component(this, 1);
510
+ this.$destroy = noop;
511
+ }
512
+ $on(type, callback) {
513
+ const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
514
+ callbacks.push(callback);
515
+ return () => {
516
+ const index = callbacks.indexOf(callback);
517
+ if (index !== -1)
518
+ callbacks.splice(index, 1);
519
+ };
520
+ }
521
+ $set($$props) {
522
+ if (this.$$set && !is_empty($$props)) {
523
+ this.$$.skip_bound = true;
524
+ this.$$set($$props);
525
+ this.$$.skip_bound = false;
526
+ }
527
+ }
528
+ }
529
+
530
+ /* src/InstanceView.svelte generated by Svelte v3.49.0 */
531
+
532
+ function add_css(target) {
533
+ append_styles(target, "svelte-8lajst", ".label.svelte-8lajst{margin-right:5px;font-size:10px;color:rgba(0, 0, 0, 0.5);font-variant:small-caps}.text.svelte-8lajst{display:flex;flex-direction:row}.value.svelte-8lajst{font-size:10px}.box.svelte-8lajst{width:min-content;padding:5px;border:0.5px solid rgb(224, 224, 224)}");
534
+ }
535
+
536
+ // (21:2) {#if modelColumn && entry[modelColumn]}
537
+ function create_if_block(ctx) {
538
+ let div;
539
+ let span0;
540
+ let t0;
541
+ let t1;
542
+ let span1;
543
+ let t2_value = /*entry*/ ctx[0][/*modelColumn*/ ctx[1]] + "";
544
+ let t2;
545
+
546
+ return {
547
+ c() {
548
+ div = element("div");
549
+ span0 = element("span");
550
+ t0 = text("output:");
551
+ t1 = space();
552
+ span1 = element("span");
553
+ t2 = text(t2_value);
554
+ this.h();
555
+ },
556
+ l(nodes) {
557
+ div = claim_element(nodes, "DIV", { class: true });
558
+ var div_nodes = children(div);
559
+ span0 = claim_element(div_nodes, "SPAN", { class: true });
560
+ var span0_nodes = children(span0);
561
+ t0 = claim_text(span0_nodes, "output:");
562
+ span0_nodes.forEach(detach);
563
+ t1 = claim_space(div_nodes);
564
+ span1 = claim_element(div_nodes, "SPAN", { class: true });
565
+ var span1_nodes = children(span1);
566
+ t2 = claim_text(span1_nodes, t2_value);
567
+ span1_nodes.forEach(detach);
568
+ div_nodes.forEach(detach);
569
+ this.h();
570
+ },
571
+ h() {
572
+ attr(span0, "class", "label svelte-8lajst");
573
+ attr(span1, "class", "value svelte-8lajst");
574
+ attr(div, "class", "text svelte-8lajst");
575
+ },
576
+ m(target, anchor) {
577
+ insert_hydration(target, div, anchor);
578
+ append_hydration(div, span0);
579
+ append_hydration(span0, t0);
580
+ append_hydration(div, t1);
581
+ append_hydration(div, span1);
582
+ append_hydration(span1, t2);
583
+ },
584
+ p(ctx, dirty) {
585
+ if (dirty & /*entry, modelColumn*/ 3 && t2_value !== (t2_value = /*entry*/ ctx[0][/*modelColumn*/ ctx[1]] + "")) set_data(t2, t2_value);
586
+ },
587
+ d(detaching) {
588
+ if (detaching) detach(div);
589
+ }
590
+ };
591
+ }
592
+
593
+ function create_fragment(ctx) {
594
+ let div1;
595
+ let img;
596
+ let img_src_value;
597
+ let img_alt_value;
598
+ let t0;
599
+ let br;
600
+ let t1;
601
+ let div0;
602
+ let span0;
603
+ let t2;
604
+ let t3;
605
+ let span1;
606
+ let t4_value = /*entry*/ ctx[0][/*labelColumn*/ ctx[2]] + "";
607
+ let t4;
608
+ let t5;
609
+ let if_block = /*modelColumn*/ ctx[1] && /*entry*/ ctx[0][/*modelColumn*/ ctx[1]] && create_if_block(ctx);
610
+
611
+ return {
612
+ c() {
613
+ div1 = element("div");
614
+ img = element("img");
615
+ t0 = space();
616
+ br = element("br");
617
+ t1 = space();
618
+ div0 = element("div");
619
+ span0 = element("span");
620
+ t2 = text("label:");
621
+ t3 = space();
622
+ span1 = element("span");
623
+ t4 = text(t4_value);
624
+ t5 = space();
625
+ if (if_block) if_block.c();
626
+ this.h();
627
+ },
628
+ l(nodes) {
629
+ div1 = claim_element(nodes, "DIV", { class: true });
630
+ var div1_nodes = children(div1);
631
+ img = claim_element(div1_nodes, "IMG", { src: true, alt: true });
632
+ t0 = claim_space(div1_nodes);
633
+ br = claim_element(div1_nodes, "BR", {});
634
+ t1 = claim_space(div1_nodes);
635
+ div0 = claim_element(div1_nodes, "DIV", { class: true });
636
+ var div0_nodes = children(div0);
637
+ span0 = claim_element(div0_nodes, "SPAN", { class: true });
638
+ var span0_nodes = children(span0);
639
+ t2 = claim_text(span0_nodes, "label:");
640
+ span0_nodes.forEach(detach);
641
+ t3 = claim_space(div0_nodes);
642
+ span1 = claim_element(div0_nodes, "SPAN", { class: true });
643
+ var span1_nodes = children(span1);
644
+ t4 = claim_text(span1_nodes, t4_value);
645
+ span1_nodes.forEach(detach);
646
+ div0_nodes.forEach(detach);
647
+ t5 = claim_space(div1_nodes);
648
+ if (if_block) if_block.l(div1_nodes);
649
+ div1_nodes.forEach(detach);
650
+ this.h();
651
+ },
652
+ h() {
653
+ if (!src_url_equal(img.src, img_src_value = /*entry*/ ctx[0][/*dataColumn*/ ctx[3]])) attr(img, "src", img_src_value);
654
+ attr(img, "alt", img_alt_value = "Image thumbnail for instance " + /*entry*/ ctx[0][/*idColumn*/ ctx[4]]);
655
+ set_style(img, "max-width", `200px`, false);
656
+ attr(span0, "class", "label svelte-8lajst");
657
+ attr(span1, "class", "value svelte-8lajst");
658
+ attr(div0, "class", "text svelte-8lajst");
659
+ attr(div1, "class", "box svelte-8lajst");
660
+ set_style(div1, "background-color", `white`, false);
661
+ },
662
+ m(target, anchor) {
663
+ insert_hydration(target, div1, anchor);
664
+ append_hydration(div1, img);
665
+ append_hydration(div1, t0);
666
+ append_hydration(div1, br);
667
+ append_hydration(div1, t1);
668
+ append_hydration(div1, div0);
669
+ append_hydration(div0, span0);
670
+ append_hydration(span0, t2);
671
+ append_hydration(div0, t3);
672
+ append_hydration(div0, span1);
673
+ append_hydration(span1, t4);
674
+ append_hydration(div1, t5);
675
+ if (if_block) if_block.m(div1, null);
676
+ },
677
+ p(ctx, [dirty]) {
678
+ if (dirty & /*entry, dataColumn*/ 9 && !src_url_equal(img.src, img_src_value = /*entry*/ ctx[0][/*dataColumn*/ ctx[3]])) {
679
+ attr(img, "src", img_src_value);
680
+ }
681
+
682
+ if (dirty & /*entry, idColumn*/ 17 && img_alt_value !== (img_alt_value = "Image thumbnail for instance " + /*entry*/ ctx[0][/*idColumn*/ ctx[4]])) {
683
+ attr(img, "alt", img_alt_value);
684
+ }
685
+
686
+ if (dirty & /*entry, labelColumn*/ 5 && t4_value !== (t4_value = /*entry*/ ctx[0][/*labelColumn*/ ctx[2]] + "")) set_data(t4, t4_value);
687
+
688
+ if (/*modelColumn*/ ctx[1] && /*entry*/ ctx[0][/*modelColumn*/ ctx[1]]) {
689
+ if (if_block) {
690
+ if_block.p(ctx, dirty);
691
+ } else {
692
+ if_block = create_if_block(ctx);
693
+ if_block.c();
694
+ if_block.m(div1, null);
695
+ }
696
+ } else if (if_block) {
697
+ if_block.d(1);
698
+ if_block = null;
699
+ }
700
+ },
701
+ i: noop,
702
+ o: noop,
703
+ d(detaching) {
704
+ if (detaching) detach(div1);
705
+ if (if_block) if_block.d();
706
+ }
707
+ };
708
+ }
709
+
710
+ function instance($$self, $$props, $$invalidate) {
711
+ let { entry } = $$props;
712
+ let { options } = $$props;
713
+ let { modelColumn } = $$props;
714
+ let { labelColumn } = $$props;
715
+ let { dataColumn } = $$props;
716
+ let { idColumn } = $$props;
717
+
718
+ $$self.$$set = $$props => {
719
+ if ('entry' in $$props) $$invalidate(0, entry = $$props.entry);
720
+ if ('options' in $$props) $$invalidate(5, options = $$props.options);
721
+ if ('modelColumn' in $$props) $$invalidate(1, modelColumn = $$props.modelColumn);
722
+ if ('labelColumn' in $$props) $$invalidate(2, labelColumn = $$props.labelColumn);
723
+ if ('dataColumn' in $$props) $$invalidate(3, dataColumn = $$props.dataColumn);
724
+ if ('idColumn' in $$props) $$invalidate(4, idColumn = $$props.idColumn);
725
+ };
726
+
727
+ return [entry, modelColumn, labelColumn, dataColumn, idColumn, options];
728
+ }
729
+
730
+ class InstanceView extends SvelteComponent {
731
+ constructor(options) {
732
+ super();
733
+
734
+ init(
735
+ this,
736
+ options,
737
+ instance,
738
+ create_fragment,
739
+ safe_not_equal,
740
+ {
741
+ entry: 0,
742
+ options: 5,
743
+ modelColumn: 1,
744
+ labelColumn: 2,
745
+ dataColumn: 3,
746
+ idColumn: 4
747
+ },
748
+ add_css
749
+ );
750
+ }
751
+ }
752
+
753
+ function getInstance(
754
+ div,
755
+ options,
756
+ entry,
757
+ modelColumn,
758
+ labelColumn,
759
+ dataColumn,
760
+ idColumn
761
+ ) {
762
+ new InstanceView({
763
+ target: div,
764
+ props: {
765
+ entry: entry,
766
+ options: options,
767
+ modelColumn: modelColumn,
768
+ labelColumn: labelColumn,
769
+ dataColumn: dataColumn,
770
+ idColumn: idColumn,
771
+ },
772
+ hydrate: true,
773
+ });
774
+ }
775
+
776
+ export { getInstance };
Dockerfile ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
+
4
+ FROM python:3.8
5
+
6
+ RUN useradd -m -u 1000 user
7
+ USER user
8
+ # Set home to the user's home directory
9
+ ENV HOME=/home/user \
10
+ PATH=/home/user/.local/bin:$PATH
11
+ WORKDIR $HOME/app
12
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
13
+ COPY --chown=user . $HOME/app
14
+ ADD --chown=user ./.zeno_cache $HOME/app/.zeno_cache
15
+ RUN chown user:user -R $HOME/app
16
+
17
+ COPY ./requirements.txt /code/requirements.txt
18
+
19
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
20
+
21
+
22
+ CMD ["zeno", "config.toml"]
README.md CHANGED
@@ -6,6 +6,7 @@ colorTo: blue
6
  sdk: docker
7
  pinned: false
8
  license: mit
 
9
  ---
10
 
11
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
6
  sdk: docker
7
  pinned: false
8
  license: mit
9
+ fullWidth: true
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
__pycache__/brightness.cpython-38.pyc ADDED
Binary file (1.69 kB). View file
 
__pycache__/color.cpython-38.pyc ADDED
Binary file (2.03 kB). View file
 
__pycache__/inference.cpython-38.pyc ADDED
Binary file (504 Bytes). View file
 
__pycache__/loading.cpython-38.pyc ADDED
Binary file (20.6 kB). View file
 
__pycache__/metrics.cpython-38.pyc ADDED
Binary file (1.13 kB). View file
 
brightness.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ from PIL import Image
4
+ from zeno import distill
5
+
6
+
7
+ def get_brightness(im):
8
+ im_grey = im.convert("LA")
9
+ width, height = im.size
10
+
11
+ total = 0
12
+ for i in range(0, width):
13
+ for j in range(0, height):
14
+ total += im_grey.getpixel((i, j))[0]
15
+
16
+ return total / (width * height)
17
+
18
+
19
+ def get_border_brightness(im):
20
+ im_grey = im.convert("LA")
21
+ width, height = im.size
22
+
23
+ total = 0
24
+ for i in range(0, width):
25
+ for j in range(0, 5):
26
+ total += im_grey.getpixel((i, j))[0]
27
+
28
+ for i in range(0, width):
29
+ for j in range(height - 5, height):
30
+ total += im_grey.getpixel((i, j))[0]
31
+
32
+ return total / (width * 10)
33
+
34
+
35
+ @distill
36
+ def brightness(df, ops):
37
+ imgs = [Image.open(os.path.join(ops.data_path, img)) for img in df[ops.data_column]]
38
+ return [get_brightness(im) for im in imgs]
39
+
40
+
41
+ @distill
42
+ def border_brightness(df, ops):
43
+ imgs = [Image.open(os.path.join(ops.data_path, img)) for img in df[ops.data_column]]
44
+ return [get_border_brightness(im) for im in imgs]
color.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import colorsys
2
+ import os
3
+
4
+ import numpy as np
5
+ from PIL import Image
6
+ from zeno import distill
7
+ from zeno.api import ZenoOptions
8
+
9
+
10
+ def red_pixels(im):
11
+ arr = np.array(im)
12
+ count_red = 0
13
+ for x in range(arr.shape[0]):
14
+ for y in range(arr.shape[1]):
15
+ if arr[x, y, 0] > 180 and arr[x, y, 1] < 70 and arr[x, y, 2] < 70:
16
+ count_red += 1
17
+ return count_red
18
+
19
+
20
+ def blue_border_pixels(im):
21
+ arr = np.array(im)
22
+ count_blue = 0
23
+ for x in range(arr.shape[0]):
24
+ for y in range(10):
25
+ hsv = colorsys.rgb_to_hsv(arr[x, y, 0], arr[x, y, 1], arr[x, y, 2])
26
+ if hsv[0] > 0.51 and hsv[0] < 0.72:
27
+ count_blue += 1
28
+ for x in range(arr.shape[0]):
29
+ for y in range(arr.shape[1] - 10, arr.shape[1]):
30
+ hsv = colorsys.rgb_to_hsv(arr[x, y, 0], arr[x, y, 1], arr[x, y, 2])
31
+ if hsv[0] > 0.51 and hsv[0] < 0.72:
32
+ count_blue += 1
33
+ return count_blue
34
+
35
+
36
+ @distill
37
+ def red_count(df, ops: ZenoOptions):
38
+ imgs = [
39
+ Image.open(os.path.join(ops.data_path, img)).convert("RGB")
40
+ for img in df[ops.data_column]
41
+ ]
42
+ return [red_pixels(im) for im in imgs]
43
+
44
+
45
+ @distill
46
+ def blue_border_count(df, ops):
47
+ imgs = [
48
+ Image.open(os.path.join(ops.data_path, img)).convert("RGB")
49
+ for img in df[ops.data_column]
50
+ ]
51
+ return [blue_border_pixels(im) for im in imgs]
config.toml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ functions = "./"
2
+ view = "image-classification"
3
+ metadata = "./imagenette_formatted.csv"
4
+ models = ["IMAGENET1K_V1", "IMAGENET1K_V2"]
5
+ data_path = "./imagenette/"
6
+ data_column = "id"
7
+ label_column = "label"
8
+ batch_size = 32
9
+ port = 7860
10
+ host = "0.0.0.0"
11
+ editable = false
imagenette/.DS_Store ADDED
Binary file (6.15 kB). View file
 
imagenette/val/.DS_Store ADDED
Binary file (6.15 kB). View file
 
imagenette/val/n01440764/ILSVRC2012_val_00009111.JPEG ADDED
imagenette/val/n01440764/ILSVRC2012_val_00009191.JPEG ADDED
imagenette/val/n01440764/ILSVRC2012_val_00017472.JPEG ADDED
imagenette/val/n01440764/ILSVRC2012_val_00017700.JPEG ADDED
imagenette/val/n01440764/ILSVRC2012_val_00021740.JPEG ADDED
imagenette/val/n01440764/ILSVRC2012_val_00029930.JPEG ADDED
imagenette/val/n01440764/ILSVRC2012_val_00030740.JPEG ADDED
imagenette/val/n01440764/ILSVRC2012_val_00037861.JPEG ADDED
imagenette/val/n01440764/ILSVRC2012_val_00045880.JPEG ADDED
imagenette/val/n01440764/ILSVRC2012_val_00046252.JPEG ADDED
imagenette/val/n01440764/n01440764_10040.JPEG ADDED
imagenette/val/n01440764/n01440764_10042.JPEG ADDED
imagenette/val/n01440764/n01440764_10110.JPEG ADDED
imagenette/val/n01440764/n01440764_10120.JPEG ADDED
imagenette/val/n01440764/n01440764_10150.JPEG ADDED
imagenette/val/n01440764/n01440764_10162.JPEG ADDED
imagenette/val/n01440764/n01440764_10211.JPEG ADDED
imagenette/val/n01440764/n01440764_10251.JPEG ADDED
imagenette/val/n01440764/n01440764_10281.JPEG ADDED