Datasets:
Adding small lines for embeddings.
Browse files- README.md +2 -0
- tutorials/embeddings.md +20 -0
README.md
CHANGED
@@ -47,6 +47,8 @@ The image files are all hosted in the AWS S3 bucket `pd12m`. The URLs to the ima
|
|
47 |
|
48 |
[Downloading Images](./tutorials/images.md)
|
49 |
|
|
|
|
|
50 |
# License
|
51 |
The dataset is licensed under the [CDLA-Permissive-2.0](https://cdla.dev/permissive-2-0/).
|
52 |
|
|
|
47 |
|
48 |
[Downloading Images](./tutorials/images.md)
|
49 |
|
50 |
+
[Working with the Embeddings](./tutorials/embeddings.md)
|
51 |
+
|
52 |
# License
|
53 |
The dataset is licensed under the [CDLA-Permissive-2.0](https://cdla.dev/permissive-2-0/).
|
54 |
|
tutorials/embeddings.md
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Working with the embeddings
|
2 |
+
The embeddings are available as numpy files, where each row is a 768-dimension floating point embedding. Each row is associated with it's matching index in the metadata files.
|
3 |
+
|
4 |
+
#### Open an embedding file
|
5 |
+
The files are in numpy format, and can be opened with `numpy` in Python.
|
6 |
+
```python
|
7 |
+
import numpy as np
|
8 |
+
embeddings = np.load('pd12m.01.npy')
|
9 |
+
```
|
10 |
+
|
11 |
+
#### Join Embeddings to Metadata
|
12 |
+
If you already have the metadata files loaded with pandas, you can join the embeddings to the dataframe simply.
|
13 |
+
```python
|
14 |
+
df["embeddings"] = embeddings.tolist()
|
15 |
+
```
|
16 |
+
Alternatively, you could use a 0-based index to access both the metadata and associated embedding.
|
17 |
+
```python
|
18 |
+
i = 300
|
19 |
+
metadata = df.iloc[i]
|
20 |
+
embedding = embeddings[i]
|