huseinzol05 commited on
Commit
61b1675
1 Parent(s): 09ee589

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +114 -0
README.md ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ task_categories:
3
+ - image-feature-extraction
4
+ ---
5
+
6
+ # Google Image Malaysian Vehicle Dedup
7
+
8
+ Original dataset https://huggingface.co/datasets/malaysia-ai/crawl-google-image-malaysian-vehicle
9
+
10
+ Source code at https://github.com/mesolitica/malaysian-dataset/tree/master/vlm/dedup-malaysian-vehicle
11
+
12
+ ## Dedup 50% similar
13
+
14
+ [dedup-0.5.jsonl](dedup-0.7.jsonl), total deduped 97598 images,
15
+
16
+ ```
17
+ {'filename': 'train-00075-of-00165-c0ebcc169b1f62d2.parquet',
18
+ 'keyword': '2021 Honda City 1.5 E',
19
+ 'no': 2,
20
+ 'selected_indices': [696,
21
+ 702,
22
+ 705,
23
+ 707,
24
+ 712,
25
+ 716,
26
+ 720,
27
+ 723,
28
+ 727,
29
+ 732,
30
+ 742,
31
+ 745,
32
+ 775,
33
+ 779,
34
+ 780,
35
+ 787,
36
+ 797,
37
+ 817,
38
+ 844,
39
+ 876,
40
+ 894,
41
+ 898,
42
+ 905,
43
+ 917,
44
+ 962,
45
+ 965,
46
+ 966,
47
+ 988,
48
+ 993,
49
+ 995,
50
+ 1000,
51
+ 1009,
52
+ 1012,
53
+ 1015,
54
+ 1016,
55
+ 1029,
56
+ 1044,
57
+ 1049,
58
+ 1054,
59
+ 1077,
60
+ 1086,
61
+ 1096,
62
+ 1131,
63
+ 1174,
64
+ 1185,
65
+ 1188,
66
+ 1198,
67
+ 1208,
68
+ 1216,
69
+ 1217,
70
+ 1219,
71
+ 1223,
72
+ 1229,
73
+ 1237,
74
+ 1247,
75
+ 1253,
76
+ 1274,
77
+ 1276,
78
+ 1286,
79
+ 1305,
80
+ 1314,
81
+ 1347,
82
+ 1348,
83
+ 1353,
84
+ 1355,
85
+ 1401,
86
+ 1412]}
87
+ ```
88
+
89
+ - `filename` is the parquet file from the original repository.
90
+ - `selected_indices` is the index of dataframe of that filename.
91
+
92
+ ## Embedding
93
+
94
+ We convert to embedding using https://huggingface.co/google/siglip-base-patch16-512, we use MosaicML for faster indexing,
95
+
96
+ ```python
97
+ from streaming import MDSWriter
98
+ from streaming.base.format.mds.encodings import Encoding, _encodings
99
+ from streaming import LocalDataset
100
+ import streaming
101
+ import numpy as np
102
+ from tqdm import tqdm
103
+
104
+ class Float32(Encoding):
105
+ def encode(self, obj) -> bytes:
106
+ return obj.tobytes()
107
+
108
+ def decode(self, data: bytes):
109
+ return np.frombuffer(data, np.float32)
110
+
111
+ _encodings['float32'] = Float32
112
+
113
+ dataset = LocalDataset('embedding')
114
+ ```