|
11 | 11 | },
|
12 | 12 | {
|
13 | 13 | "cell_type": "code",
|
14 |
| - "execution_count": 1, |
| 14 | + "execution_count": 25, |
15 | 15 | "metadata": {},
|
16 | 16 | "outputs": [],
|
17 | 17 | "source": [
|
18 | 18 | "import os\n",
|
19 | 19 | "os.environ[\"CUDA_VISIBLE_DEVICES\"]=\"\"\n",
|
20 |
| - "from clip_retrieval.clip_back import load_clip_indices, KnnService" |
| 20 | + "from clip_retrieval.clip_back import load_clip_indices, KnnService, ClipOptions" |
21 | 21 | ]
|
22 | 22 | },
|
23 | 23 | {
|
24 | 24 | "cell_type": "code",
|
25 |
| - "execution_count": 2, |
| 25 | + "execution_count": 51, |
26 | 26 | "metadata": {},
|
27 | 27 | "outputs": [
|
28 | 28 | {
|
29 | 29 | "name": "stdout",
|
30 | 30 | "output_type": "stream",
|
31 | 31 | "text": [
|
32 |
| - "loading clip...\n", |
33 |
| - "loading metadata...\n", |
34 |
| - "loading indices...\n" |
| 32 | + "IO_FLAG_ONDISK_SAME_DIR: updating ondisk filename from combined-indices/merged_index.ivfdata to /home/chris/Documents/clip_client/Laion5B_H14/image.index/merged_index.ivfdata\n" |
35 | 33 | ]
|
36 | 34 | }
|
37 | 35 | ],
|
38 | 36 | "source": [
|
| 37 | + "clip_options = ClipOptions(\n", |
| 38 | + " indice_folder = \"currently unused by knn.query()\",\n", |
| 39 | + " clip_model = \"open_clip:ViT-H-14\",\n", |
| 40 | + " enable_hdf5 = False,\n", |
| 41 | + " enable_faiss_memory_mapping = True,\n", |
| 42 | + " columns_to_return = [\"url\", \"caption\"],\n", |
| 43 | + " reorder_metadata_by_ivf_index = False,\n", |
| 44 | + " enable_mclip_option = False,\n", |
| 45 | + " use_jit = False,\n", |
| 46 | + " use_arrow = True,\n", |
| 47 | + " provide_safety_model = False,\n", |
| 48 | + " provide_violence_detector = False,\n", |
| 49 | + " provide_aesthetic_embeddings = False,\n", |
| 50 | + ")\n", |
39 | 51 | "columns = [\"url\", \"caption\"]\n",
|
40 |
| - "indices_loaded, indices, device, model, preprocess, mclip_model = load_clip_indices(\"/home/rom1504/indices_paths.json\", True, True, columns, False)\n", |
41 |
| - "knn_service = KnnService(indices_loaded=indices_loaded, device=device, model=model, preprocess=preprocess, columns_to_return=columns, metadata_is_ordered_by_ivf=False, mclip_model=mclip_model)" |
| 52 | + "resources = load_clip_indices(\"/home/rom1504/indices_paths.json\", clip_options)\n", |
| 53 | + "knn_service = KnnService(clip_resources=resources)" |
42 | 54 | ]
|
43 | 55 | },
|
44 | 56 | {
|
|
52 | 64 | },
|
53 | 65 | {
|
54 | 66 | "cell_type": "code",
|
55 |
| - "execution_count": 5, |
| 67 | + "execution_count": 45, |
56 | 68 | "metadata": {},
|
57 | 69 | "outputs": [],
|
58 | 70 | "source": [
|
59 |
| - "results = knn_service.query(text_input=\"watermark\", modality=\"image\", indice_name=\"laion_400m\", num_images=1000, num_result_ids=1000)" |
| 71 | + "results = knn_service.query(text_input=\"watermark\", num_images=1000, num_result_ids=1000)" |
60 | 72 | ]
|
61 | 73 | },
|
62 | 74 | {
|
63 | 75 | "cell_type": "code",
|
64 |
| - "execution_count": 8, |
| 76 | + "execution_count": 46, |
65 | 77 | "metadata": {},
|
66 | 78 | "outputs": [],
|
67 | 79 | "source": [
|
|
71 | 83 | },
|
72 | 84 | {
|
73 | 85 | "cell_type": "code",
|
74 |
| - "execution_count": 9, |
| 86 | + "execution_count": 47, |
75 | 87 | "metadata": {},
|
76 | 88 | "outputs": [
|
77 | 89 | {
|
|
102 | 114 | " <tbody>\n",
|
103 | 115 | " <tr>\n",
|
104 | 116 | " <th>0</th>\n",
|
105 |
| - " <td>https://static2.bigstockphoto.com/thumbs/7/8/3...</td>\n", |
106 |
| - " <td>Milch spritzt Sammlung, isolated on white back...</td>\n", |
| 117 | + " <td>http://lh3.googleusercontent.com/-q2Q0k45_bPA/...</td>\n", |
| 118 | + " <td>Watermark Intellectual Asset Management</td>\n", |
107 | 119 | " </tr>\n",
|
108 | 120 | " <tr>\n",
|
109 | 121 | " <th>1</th>\n",
|
110 |
| - " <td>https://t2.ftcdn.net/jpg/00/62/03/77/400_F_620...</td>\n", |
111 |
| - " <td>Abstract background</td>\n", |
| 122 | + " <td>https://tallncurly.com/wp-content/uploads/2014...</td>\n", |
| 123 | + " <td>TNC_feat_watermarks</td>\n", |
112 | 124 | " </tr>\n",
|
113 | 125 | " <tr>\n",
|
114 | 126 | " <th>2</th>\n",
|
115 |
| - " <td>https://as2.ftcdn.net/jpg/00/57/88/83/500_F_57...</td>\n", |
116 |
| - " <td>Spoed Foto op Canvas Abstract wave Abstract pa...</td>\n", |
| 127 | + " <td>https://tallncurly.com/wp-content/uploads/2014...</td>\n", |
| 128 | + " <td>TNC_feat_watermarks</td>\n", |
117 | 129 | " </tr>\n",
|
118 | 130 | " <tr>\n",
|
119 | 131 | " <th>3</th>\n",
|
120 |
| - " <td>https://image.shutterstock.com/image-photo/sto...</td>\n", |
121 |
| - " <td>Marine pattern with stylized blue waves. Cosme...</td>\n", |
| 132 | + " <td>https://tallncurly.com/wp-content/uploads/2014...</td>\n", |
| 133 | + " <td>TNC_feat_watermarks</td>\n", |
122 | 134 | " </tr>\n",
|
123 | 135 | " <tr>\n",
|
124 | 136 | " <th>4</th>\n",
|
125 |
| - " <td>https://thumb7.shutterstock.com/image-photo/st...</td>\n", |
126 |
| - " <td>water background - stock photo</td>\n", |
| 137 | + " <td>https://www.civiq.com.au/wp-content/uploads/20...</td>\n", |
| 138 | + " <td>An icons for WaterMark hygienic features</td>\n", |
127 | 139 | " </tr>\n",
|
128 | 140 | " <tr>\n",
|
129 | 141 | " <th>...</th>\n",
|
130 | 142 | " <td>...</td>\n",
|
131 | 143 | " <td>...</td>\n",
|
132 | 144 | " </tr>\n",
|
133 | 145 | " <tr>\n",
|
134 |
| - " <th>995</th>\n", |
135 |
| - " <td>https://t1.ftcdn.net/jpg/00/54/99/42/400_F_549...</td>\n", |
136 |
| - " <td>Abstract business background</td>\n", |
| 146 | + " <th>160</th>\n", |
| 147 | + " <td>https://www.aoaophoto.com/images/save-text-wat...</td>\n", |
| 148 | + " <td>save text watermark</td>\n", |
137 | 149 | " </tr>\n",
|
138 | 150 | " <tr>\n",
|
139 |
| - " <th>996</th>\n", |
140 |
| - " <td>https://img3.stockfresh.com/files/sstk/200/550...</td>\n", |
141 |
| - " <td>Brickwall as Background for Product Placement ...</td>\n", |
| 151 | + " <th>161</th>\n", |
| 152 | + " <td>https://magnusveteransfoundation.org/wp-conten...</td>\n", |
| 153 | + " <td>watermark design logo</td>\n", |
142 | 154 | " </tr>\n",
|
143 | 155 | " <tr>\n",
|
144 |
| - " <th>997</th>\n", |
145 |
| - " <td>https://thumb1.shutterstock.com/image-photo/st...</td>\n", |
146 |
| - " <td>motorboat and nature - stock vector</td>\n", |
| 156 | + " <th>162</th>\n", |
| 157 | + " <td>https://iseeocean.com/wp-content/uploads/job-m...</td>\n", |
| 158 | + " <td>Watermark Surf House Espinho</td>\n", |
147 | 159 | " </tr>\n",
|
148 | 160 | " <tr>\n",
|
149 |
| - " <th>998</th>\n", |
150 |
| - " <td>https://thumb1.shutterstock.com/image-photo/st...</td>\n", |
151 |
| - " <td>Molecular structure scientific vertical backgr...</td>\n", |
| 161 | + " <th>163</th>\n", |
| 162 | + " <td>http://a1.mzstatic.com/us/r30/Purple/v4/0d/04/...</td>\n", |
| 163 | + " <td>eZy Watermark lite - iTunes App Ranking and Ap...</td>\n", |
152 | 164 | " </tr>\n",
|
153 | 165 | " <tr>\n",
|
154 |
| - " <th>999</th>\n", |
155 |
| - " <td>https://thumb9.shutterstock.com/image-photo/st...</td>\n", |
156 |
| - " <td>Connections raster icon. This flat rounded squ...</td>\n", |
| 166 | + " <th>164</th>\n", |
| 167 | + " <td>http://www.mdameer.com/Media/Default/_Profiles...</td>\n", |
| 168 | + " <td><strong>How To:</strong> Image Watermark Filter</td>\n", |
157 | 169 | " </tr>\n",
|
158 | 170 | " </tbody>\n",
|
159 | 171 | "</table>\n",
|
160 |
| - "<p>1000 rows × 2 columns</p>\n", |
| 172 | + "<p>165 rows × 2 columns</p>\n", |
161 | 173 | "</div>"
|
162 | 174 | ],
|
163 | 175 | "text/plain": [
|
164 | 176 | " url \\\n",
|
165 |
| - "0 https://static2.bigstockphoto.com/thumbs/7/8/3... \n", |
166 |
| - "1 https://t2.ftcdn.net/jpg/00/62/03/77/400_F_620... \n", |
167 |
| - "2 https://as2.ftcdn.net/jpg/00/57/88/83/500_F_57... \n", |
168 |
| - "3 https://image.shutterstock.com/image-photo/sto... \n", |
169 |
| - "4 https://thumb7.shutterstock.com/image-photo/st... \n", |
| 177 | + "0 http://lh3.googleusercontent.com/-q2Q0k45_bPA/... \n", |
| 178 | + "1 https://tallncurly.com/wp-content/uploads/2014... \n", |
| 179 | + "2 https://tallncurly.com/wp-content/uploads/2014... \n", |
| 180 | + "3 https://tallncurly.com/wp-content/uploads/2014... \n", |
| 181 | + "4 https://www.civiq.com.au/wp-content/uploads/20... \n", |
170 | 182 | ".. ... \n",
|
171 |
| - "995 https://t1.ftcdn.net/jpg/00/54/99/42/400_F_549... \n", |
172 |
| - "996 https://img3.stockfresh.com/files/sstk/200/550... \n", |
173 |
| - "997 https://thumb1.shutterstock.com/image-photo/st... \n", |
174 |
| - "998 https://thumb1.shutterstock.com/image-photo/st... \n", |
175 |
| - "999 https://thumb9.shutterstock.com/image-photo/st... \n", |
| 183 | + "160 https://www.aoaophoto.com/images/save-text-wat... \n", |
| 184 | + "161 https://magnusveteransfoundation.org/wp-conten... \n", |
| 185 | + "162 https://iseeocean.com/wp-content/uploads/job-m... \n", |
| 186 | + "163 http://a1.mzstatic.com/us/r30/Purple/v4/0d/04/... \n", |
| 187 | + "164 http://www.mdameer.com/Media/Default/_Profiles... \n", |
176 | 188 | "\n",
|
177 | 189 | " caption \n",
|
178 |
| - "0 Milch spritzt Sammlung, isolated on white back... \n", |
179 |
| - "1 Abstract background \n", |
180 |
| - "2 Spoed Foto op Canvas Abstract wave Abstract pa... \n", |
181 |
| - "3 Marine pattern with stylized blue waves. Cosme... \n", |
182 |
| - "4 water background - stock photo \n", |
| 190 | + "0 Watermark Intellectual Asset Management \n", |
| 191 | + "1 TNC_feat_watermarks \n", |
| 192 | + "2 TNC_feat_watermarks \n", |
| 193 | + "3 TNC_feat_watermarks \n", |
| 194 | + "4 An icons for WaterMark hygienic features \n", |
183 | 195 | ".. ... \n",
|
184 |
| - "995 Abstract business background \n", |
185 |
| - "996 Brickwall as Background for Product Placement ... \n", |
186 |
| - "997 motorboat and nature - stock vector \n", |
187 |
| - "998 Molecular structure scientific vertical backgr... \n", |
188 |
| - "999 Connections raster icon. This flat rounded squ... \n", |
| 196 | + "160 save text watermark \n", |
| 197 | + "161 watermark design logo \n", |
| 198 | + "162 Watermark Surf House Espinho \n", |
| 199 | + "163 eZy Watermark lite - iTunes App Ranking and Ap... \n", |
| 200 | + "164 <strong>How To:</strong> Image Watermark Filter \n", |
189 | 201 | "\n",
|
190 |
| - "[1000 rows x 2 columns]" |
| 202 | + "[165 rows x 2 columns]" |
191 | 203 | ]
|
192 | 204 | },
|
193 |
| - "execution_count": 9, |
| 205 | + "execution_count": 47, |
194 | 206 | "metadata": {},
|
195 | 207 | "output_type": "execute_result"
|
196 | 208 | }
|
|
725 | 737 | "name": "python",
|
726 | 738 | "nbconvert_exporter": "python",
|
727 | 739 | "pygments_lexer": "ipython3",
|
728 |
| - "version": "3.8.10" |
| 740 | + "version": "3.9.17" |
729 | 741 | },
|
730 | 742 | "orig_nbformat": 4
|
731 | 743 | },
|
|
0 commit comments