Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
datasets:
|
| 4 |
+
- google/quickdraw
|
| 5 |
+
pipeline_tag: image-feature-extraction
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
A simple, small-ish network for producing embeddings for black and white binary images. Takes a 32x32 drawing a produces a 64-dimensional embedding.
|
| 9 |
+
|
| 10 |
+
Sample usage:
|
| 11 |
+
|
| 12 |
+
```
|
| 13 |
+
import onnxruntime as ort
|
| 14 |
+
import numpy
|
| 15 |
+
|
| 16 |
+
ort_sess = ort.InferenceSession('tiny_doodle_embedding.onnx')
|
| 17 |
+
|
| 18 |
+
def compare(input_img_a, input_img_b):
|
| 19 |
+
img_a = process_input(input_img_a) # Crop and resize the input image so it's binary and fits in a 32x32 array.
|
| 20 |
+
img_b = process_input(input_img_b)
|
| 21 |
+
|
| 22 |
+
a_embedding = ort_sess.run(None, {'input': img_a.astype(numpy.float32)})[0]
|
| 23 |
+
b_embedding = ort_sess.run(None, {'input': img_b.astype(numpy.float32)})[0]
|
| 24 |
+
|
| 25 |
+
sim = numpy.dot(a_embedding , b_embedding.T) # Or a_embedding @ b_embedding.T
|
| 26 |
+
```
|