Spaces:
Runtime error
Runtime error
updated file
Browse files- view_data.ipynb +619 -0
- view_omniart_data.ipynb +0 -0
- view_predictions.ipynb +63 -10
view_data.ipynb
ADDED
@@ -0,0 +1,619 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": null,
|
6 |
+
"metadata": {},
|
7 |
+
"outputs": [],
|
8 |
+
"source": [
|
9 |
+
"import pandas as pd\n",
|
10 |
+
"\n",
|
11 |
+
"df = pd.read_csv('/Users/ludovicaschaerf/Desktop/Data/omniart_v3_datadump.csv')\n",
|
12 |
+
"df.shape, df.columns"
|
13 |
+
]
|
14 |
+
},
|
15 |
+
{
|
16 |
+
"cell_type": "code",
|
17 |
+
"execution_count": null,
|
18 |
+
"metadata": {},
|
19 |
+
"outputs": [],
|
20 |
+
"source": [
|
21 |
+
"df['collection_origins'].value_counts()"
|
22 |
+
]
|
23 |
+
},
|
24 |
+
{
|
25 |
+
"cell_type": "code",
|
26 |
+
"execution_count": null,
|
27 |
+
"metadata": {},
|
28 |
+
"outputs": [],
|
29 |
+
"source": [
|
30 |
+
"df['general_type'].value_counts()"
|
31 |
+
]
|
32 |
+
},
|
33 |
+
{
|
34 |
+
"cell_type": "code",
|
35 |
+
"execution_count": null,
|
36 |
+
"metadata": {},
|
37 |
+
"outputs": [],
|
38 |
+
"source": [
|
39 |
+
"for val, c in zip(df['artwork_type'].value_counts(), df['artwork_type'].value_counts().index):\n",
|
40 |
+
" print(val,c)"
|
41 |
+
]
|
42 |
+
},
|
43 |
+
{
|
44 |
+
"cell_type": "code",
|
45 |
+
"execution_count": null,
|
46 |
+
"metadata": {},
|
47 |
+
"outputs": [],
|
48 |
+
"source": [
|
49 |
+
"df[df['collection_origins'] == 'The British Library [Flickr]']['artwork_type'].value_counts()"
|
50 |
+
]
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"cell_type": "code",
|
54 |
+
"execution_count": null,
|
55 |
+
"metadata": {},
|
56 |
+
"outputs": [],
|
57 |
+
"source": [
|
58 |
+
"df[df['collection_origins'] == 'The British Library [Flickr]']['general_type'].value_counts()"
|
59 |
+
]
|
60 |
+
},
|
61 |
+
{
|
62 |
+
"cell_type": "code",
|
63 |
+
"execution_count": null,
|
64 |
+
"metadata": {},
|
65 |
+
"outputs": [],
|
66 |
+
"source": [
|
67 |
+
"df[df['collection_origins'] == 'Brill Iconclass Arkyves']['artwork_type'].value_counts()"
|
68 |
+
]
|
69 |
+
},
|
70 |
+
{
|
71 |
+
"cell_type": "code",
|
72 |
+
"execution_count": null,
|
73 |
+
"metadata": {},
|
74 |
+
"outputs": [],
|
75 |
+
"source": [
|
76 |
+
"df[df['collection_origins'] == 'The Met 17']['artwork_type'].value_counts()"
|
77 |
+
]
|
78 |
+
},
|
79 |
+
{
|
80 |
+
"cell_type": "code",
|
81 |
+
"execution_count": null,
|
82 |
+
"metadata": {},
|
83 |
+
"outputs": [],
|
84 |
+
"source": [
|
85 |
+
"df[df['collection_origins'] == 'DeviantArt']['artwork_type'].value_counts()"
|
86 |
+
]
|
87 |
+
},
|
88 |
+
{
|
89 |
+
"cell_type": "code",
|
90 |
+
"execution_count": null,
|
91 |
+
"metadata": {},
|
92 |
+
"outputs": [],
|
93 |
+
"source": [
|
94 |
+
"df[df['collection_origins'] == 'WikiArts 17']['artwork_type'].value_counts()"
|
95 |
+
]
|
96 |
+
},
|
97 |
+
{
|
98 |
+
"cell_type": "code",
|
99 |
+
"execution_count": null,
|
100 |
+
"metadata": {},
|
101 |
+
"outputs": [],
|
102 |
+
"source": [
|
103 |
+
"df[df['collection_origins'] == 'MOMA - New York']['artwork_type'].value_counts()"
|
104 |
+
]
|
105 |
+
},
|
106 |
+
{
|
107 |
+
"cell_type": "code",
|
108 |
+
"execution_count": null,
|
109 |
+
"metadata": {},
|
110 |
+
"outputs": [],
|
111 |
+
"source": [
|
112 |
+
"df_filtered = df[~df['artwork_type'].fillna('').str.contains('book')]\n",
|
113 |
+
"df_filtered.shape"
|
114 |
+
]
|
115 |
+
},
|
116 |
+
{
|
117 |
+
"cell_type": "code",
|
118 |
+
"execution_count": null,
|
119 |
+
"metadata": {},
|
120 |
+
"outputs": [],
|
121 |
+
"source": [
|
122 |
+
"df_filtered = df_filtered[~df_filtered['artwork_type'].fillna('').str.contains('illustr')]\n",
|
123 |
+
"df_filtered.shape"
|
124 |
+
]
|
125 |
+
},
|
126 |
+
{
|
127 |
+
"cell_type": "code",
|
128 |
+
"execution_count": null,
|
129 |
+
"metadata": {},
|
130 |
+
"outputs": [],
|
131 |
+
"source": [
|
132 |
+
"df_filtered = df_filtered[~df_filtered['artwork_type'].fillna('').str.contains('unknown')]\n",
|
133 |
+
"df_filtered.shape"
|
134 |
+
]
|
135 |
+
},
|
136 |
+
{
|
137 |
+
"cell_type": "code",
|
138 |
+
"execution_count": null,
|
139 |
+
"metadata": {},
|
140 |
+
"outputs": [],
|
141 |
+
"source": [
|
142 |
+
"to_remove = df_filtered[df_filtered['collection_origins'] == 'Brill Iconclass Arkyves'][~(df_filtered['artwork_type'] == 'image')].index\n",
|
143 |
+
"df_filtered = df_filtered.drop(to_remove, axis=0)\n",
|
144 |
+
"df_filtered.shape, df_filtered[df_filtered['collection_origins'] == 'Brill Iconclass Arkyves']['artwork_type'].value_counts()"
|
145 |
+
]
|
146 |
+
},
|
147 |
+
{
|
148 |
+
"cell_type": "code",
|
149 |
+
"execution_count": null,
|
150 |
+
"metadata": {},
|
151 |
+
"outputs": [],
|
152 |
+
"source": [
|
153 |
+
"df_filtered = df_filtered[~(df_filtered['collection_origins'] == 'The British Library [Flickr]')]\n",
|
154 |
+
"df_filtered.shape"
|
155 |
+
]
|
156 |
+
},
|
157 |
+
{
|
158 |
+
"cell_type": "code",
|
159 |
+
"execution_count": null,
|
160 |
+
"metadata": {},
|
161 |
+
"outputs": [],
|
162 |
+
"source": [
|
163 |
+
"df_filtered = df_filtered.reset_index(drop=True)"
|
164 |
+
]
|
165 |
+
},
|
166 |
+
{
|
167 |
+
"cell_type": "code",
|
168 |
+
"execution_count": null,
|
169 |
+
"metadata": {},
|
170 |
+
"outputs": [],
|
171 |
+
"source": [
|
172 |
+
"df_filtered = df_filtered[~(df_filtered['collection_origins'] == 'The Met 17')]\n",
|
173 |
+
"df_filtered.shape"
|
174 |
+
]
|
175 |
+
},
|
176 |
+
{
|
177 |
+
"cell_type": "code",
|
178 |
+
"execution_count": null,
|
179 |
+
"metadata": {},
|
180 |
+
"outputs": [],
|
181 |
+
"source": [
|
182 |
+
"df_filtered = df[df['artwork_type'] == 'textiles'].reset_index()\n"
|
183 |
+
]
|
184 |
+
},
|
185 |
+
{
|
186 |
+
"cell_type": "code",
|
187 |
+
"execution_count": null,
|
188 |
+
"metadata": {},
|
189 |
+
"outputs": [],
|
190 |
+
"source": [
|
191 |
+
"df_filtered.sample(5)"
|
192 |
+
]
|
193 |
+
},
|
194 |
+
{
|
195 |
+
"cell_type": "code",
|
196 |
+
"execution_count": null,
|
197 |
+
"metadata": {},
|
198 |
+
"outputs": [],
|
199 |
+
"source": [
|
200 |
+
"from PIL import Image\n",
|
201 |
+
"import requests\n",
|
202 |
+
"from io import BytesIO\n",
|
203 |
+
"\n",
|
204 |
+
"\n",
|
205 |
+
"print(df_filtered['image_url'][0])\n",
|
206 |
+
"# Download the image\n",
|
207 |
+
"response = requests.get(df_filtered['image_url'][0])\n",
|
208 |
+
"image_data = response.content\n",
|
209 |
+
"\n",
|
210 |
+
"# Open and display the image\n",
|
211 |
+
"image = Image.open(BytesIO(image_data))\n",
|
212 |
+
"image.show()"
|
213 |
+
]
|
214 |
+
},
|
215 |
+
{
|
216 |
+
"cell_type": "code",
|
217 |
+
"execution_count": null,
|
218 |
+
"metadata": {},
|
219 |
+
"outputs": [],
|
220 |
+
"source": [
|
221 |
+
"import matplotlib.pyplot as plt\n",
|
222 |
+
"import random"
|
223 |
+
]
|
224 |
+
},
|
225 |
+
{
|
226 |
+
"cell_type": "code",
|
227 |
+
"execution_count": 1,
|
228 |
+
"metadata": {},
|
229 |
+
"outputs": [
|
230 |
+
{
|
231 |
+
"ename": "NameError",
|
232 |
+
"evalue": "name 'random' is not defined",
|
233 |
+
"output_type": "error",
|
234 |
+
"traceback": [
|
235 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
236 |
+
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
237 |
+
"\u001b[1;32m/Users/ludovicaschaerf/Desktop/latent-space-theories/view_data.ipynb Cell 23\u001b[0m in \u001b[0;36m<cell line: 2>\u001b[0;34m()\u001b[0m\n\u001b[1;32m <a href='vscode-notebook-cell:/Users/ludovicaschaerf/Desktop/latent-space-theories/view_data.ipynb#X25sZmlsZQ%3D%3D?line=0'>1</a>\u001b[0m \u001b[39m# Randomly select 20 images\u001b[39;00m\n\u001b[0;32m----> <a href='vscode-notebook-cell:/Users/ludovicaschaerf/Desktop/latent-space-theories/view_data.ipynb#X25sZmlsZQ%3D%3D?line=1'>2</a>\u001b[0m random_images \u001b[39m=\u001b[39m random\u001b[39m.\u001b[39msample(\u001b[39mlist\u001b[39m(df_filtered[\u001b[39m'\u001b[39m\u001b[39mimage_url\u001b[39m\u001b[39m'\u001b[39m]), \u001b[39m20\u001b[39m\u001b[39m*\u001b[39m\u001b[39m20\u001b[39m)\n\u001b[1;32m <a href='vscode-notebook-cell:/Users/ludovicaschaerf/Desktop/latent-space-theories/view_data.ipynb#X25sZmlsZQ%3D%3D?line=3'>4</a>\u001b[0m \u001b[39m# Set up the grid layout\u001b[39;00m\n\u001b[1;32m <a href='vscode-notebook-cell:/Users/ludovicaschaerf/Desktop/latent-space-theories/view_data.ipynb#X25sZmlsZQ%3D%3D?line=4'>5</a>\u001b[0m grid_size \u001b[39m=\u001b[39m (\u001b[39m20\u001b[39m, \u001b[39m20\u001b[39m)\n",
|
238 |
+
"\u001b[0;31mNameError\u001b[0m: name 'random' is not defined"
|
239 |
+
]
|
240 |
+
}
|
241 |
+
],
|
242 |
+
"source": [
|
243 |
+
"# Randomly select 20 images\n",
|
244 |
+
"random_images = random.sample(list(df_filtered['image_url']), 20*20)\n",
|
245 |
+
"\n",
|
246 |
+
"# Set up the grid layout\n",
|
247 |
+
"grid_size = (20, 20)\n",
|
248 |
+
"fig, axs = plt.subplots(*grid_size, figsize=(100, 100))\n",
|
249 |
+
"\n",
|
250 |
+
"# Display the images in the grid\n",
|
251 |
+
"for i, image_link in enumerate(random_images):\n",
|
252 |
+
" response = requests.get(image_link)\n",
|
253 |
+
" image_data = response.content\n",
|
254 |
+
" try:\n",
|
255 |
+
" image = plt.imread(BytesIO(image_data), format='auto')\n",
|
256 |
+
" except (OSError, IOError,):\n",
|
257 |
+
" print(f\"Skipped image {i + 1} due to an error\")\n",
|
258 |
+
"\n",
|
259 |
+
" # Compute the grid coordinates\n",
|
260 |
+
" x = i % grid_size[1]\n",
|
261 |
+
" y = i // grid_size[1]\n",
|
262 |
+
" \n",
|
263 |
+
" # Display the image in the corresponding grid cell\n",
|
264 |
+
" axs[y, x].imshow(image)\n",
|
265 |
+
" axs[y, x].axis('off')\n",
|
266 |
+
"\n",
|
267 |
+
"# Adjust spacing and display the grid of images\n",
|
268 |
+
"plt.tight_layout()\n",
|
269 |
+
"plt.show()"
|
270 |
+
]
|
271 |
+
},
|
272 |
+
{
|
273 |
+
"cell_type": "code",
|
274 |
+
"execution_count": null,
|
275 |
+
"metadata": {},
|
276 |
+
"outputs": [],
|
277 |
+
"source": [
|
278 |
+
"df_filtered['collection_origins'].value_counts()"
|
279 |
+
]
|
280 |
+
},
|
281 |
+
{
|
282 |
+
"cell_type": "code",
|
283 |
+
"execution_count": null,
|
284 |
+
"metadata": {},
|
285 |
+
"outputs": [],
|
286 |
+
"source": [
|
287 |
+
"df_filtered = df_filtered[df_filtered['collection_origins']=='The Met 17'].reset_index()"
|
288 |
+
]
|
289 |
+
},
|
290 |
+
{
|
291 |
+
"cell_type": "code",
|
292 |
+
"execution_count": null,
|
293 |
+
"metadata": {},
|
294 |
+
"outputs": [],
|
295 |
+
"source": [
|
296 |
+
"df_filtered['omni_id']"
|
297 |
+
]
|
298 |
+
},
|
299 |
+
{
|
300 |
+
"cell_type": "code",
|
301 |
+
"execution_count": null,
|
302 |
+
"metadata": {},
|
303 |
+
"outputs": [],
|
304 |
+
"source": [
|
305 |
+
"df_filtered.columns"
|
306 |
+
]
|
307 |
+
},
|
308 |
+
{
|
309 |
+
"cell_type": "code",
|
310 |
+
"execution_count": null,
|
311 |
+
"metadata": {},
|
312 |
+
"outputs": [],
|
313 |
+
"source": [
|
314 |
+
"df_filtered.loc[0, ['original_id_in_collection', 'artwork_name', 'artist_full_name']]"
|
315 |
+
]
|
316 |
+
},
|
317 |
+
{
|
318 |
+
"cell_type": "code",
|
319 |
+
"execution_count": null,
|
320 |
+
"metadata": {},
|
321 |
+
"outputs": [],
|
322 |
+
"source": [
|
323 |
+
"met_data = pd.read_csv('/Users/ludovicaschaerf/Desktop/Data/MetObjects.csv')\n",
|
324 |
+
"met_data.head()"
|
325 |
+
]
|
326 |
+
},
|
327 |
+
{
|
328 |
+
"cell_type": "code",
|
329 |
+
"execution_count": null,
|
330 |
+
"metadata": {},
|
331 |
+
"outputs": [],
|
332 |
+
"source": [
|
333 |
+
"df_filtered.to_csv('/Users/ludovicaschaerf/Desktop/Data/omniart_v3_textiles.csv', index=False)"
|
334 |
+
]
|
335 |
+
},
|
336 |
+
{
|
337 |
+
"cell_type": "code",
|
338 |
+
"execution_count": null,
|
339 |
+
"metadata": {},
|
340 |
+
"outputs": [],
|
341 |
+
"source": [
|
342 |
+
"df_filtered.to_csv('/Users/ludovicaschaerf/Desktop/Data/omniart_v3_filtered.csv', index=False)"
|
343 |
+
]
|
344 |
+
},
|
345 |
+
{
|
346 |
+
"cell_type": "code",
|
347 |
+
"execution_count": null,
|
348 |
+
"metadata": {},
|
349 |
+
"outputs": [],
|
350 |
+
"source": [
|
351 |
+
"import requests\n",
|
352 |
+
"req = requests.get(\"https://api.vam.ac.uk/v2/objects/search?images_exist=true&id_category=THES48885&kw_object_type=Textile%20design&kw_object_type=Furnishing%20fabric&page_size=100\")\n",
|
353 |
+
"object_data = req.json()\n",
|
354 |
+
"print(object_data)\n",
|
355 |
+
"object_info = object_data[\"info\"]\n",
|
356 |
+
"object_records = object_data[\"records\"]\n",
|
357 |
+
"record_count = object_info[\"record_count\"]\n",
|
358 |
+
"print(f\"There are {record_count} objects that have these aspects in the record\")"
|
359 |
+
]
|
360 |
+
},
|
361 |
+
{
|
362 |
+
"cell_type": "code",
|
363 |
+
"execution_count": null,
|
364 |
+
"metadata": {},
|
365 |
+
"outputs": [],
|
366 |
+
"source": [
|
367 |
+
"import urllib.request\n",
|
368 |
+
"\n",
|
369 |
+
"def download_image(url, file_path, file_name):\n",
|
370 |
+
" full_path = file_path + file_name + '.jpg'\n",
|
371 |
+
" urllib.request.urlretrieve(url, full_path)"
|
372 |
+
]
|
373 |
+
},
|
374 |
+
{
|
375 |
+
"cell_type": "code",
|
376 |
+
"execution_count": null,
|
377 |
+
"metadata": {},
|
378 |
+
"outputs": [],
|
379 |
+
"source": [
|
380 |
+
"from tqdm import tqdm\n",
|
381 |
+
"import pandas as pd"
|
382 |
+
]
|
383 |
+
},
|
384 |
+
{
|
385 |
+
"cell_type": "code",
|
386 |
+
"execution_count": null,
|
387 |
+
"metadata": {},
|
388 |
+
"outputs": [],
|
389 |
+
"source": [
|
390 |
+
"df = pd.read_csv(f\"https://api.vam.ac.uk/v2/objects/search?images_exist=true&id_category=THES48885&kw_object_type=Textile%20design&response_format=csv&page={0}&kw_object_type=Furnishing%20fabric&page_size=100\")\n",
|
391 |
+
"df.head()"
|
392 |
+
]
|
393 |
+
},
|
394 |
+
{
|
395 |
+
"cell_type": "code",
|
396 |
+
"execution_count": null,
|
397 |
+
"metadata": {},
|
398 |
+
"outputs": [],
|
399 |
+
"source": [
|
400 |
+
"f\"https://framemark.vam.ac.uk/collections/{df.loc[0, '_primaryImageId']}/full/735,/0/default.jpg\""
|
401 |
+
]
|
402 |
+
},
|
403 |
+
{
|
404 |
+
"cell_type": "code",
|
405 |
+
"execution_count": null,
|
406 |
+
"metadata": {},
|
407 |
+
"outputs": [],
|
408 |
+
"source": [
|
409 |
+
"out_path = '/Users/ludovicaschaerf/Desktop/Data/VA_textiles/'\n",
|
410 |
+
"\n",
|
411 |
+
"for i in tqdm(range(100)):\n",
|
412 |
+
" df = pd.read_csv(f\"https://api.vam.ac.uk/v2/objects/search?images_exist=true&id_category=THES48885&kw_object_type=Textile%20design&response_format=csv&kw_object_type=Furnishing%20fabric&page_size=100&page={i}\")\n",
|
413 |
+
" \n",
|
414 |
+
" df.to_csv(out_path + f'info_{i}.csv', index = False)\n",
|
415 |
+
" \n",
|
416 |
+
" for j in range(100):\n",
|
417 |
+
" im_url = f\"https://framemark.vam.ac.uk/collections/{df.loc[j, '_primaryImageId']}/full/735,/0/default.jpg\"\n",
|
418 |
+
" name = df.loc[j, 'systemNumber']\n",
|
419 |
+
" \n",
|
420 |
+
" download_image(im_url, out_path, name)\n",
|
421 |
+
" \n",
|
422 |
+
" "
|
423 |
+
]
|
424 |
+
},
|
425 |
+
{
|
426 |
+
"cell_type": "code",
|
427 |
+
"execution_count": null,
|
428 |
+
"metadata": {},
|
429 |
+
"outputs": [],
|
430 |
+
"source": [
|
431 |
+
"for i in range(100):\n",
|
432 |
+
" df = pd.read_csv(out_path + f'info_{i}.csv')\n",
|
433 |
+
" \n",
|
434 |
+
" if i == 0:\n",
|
435 |
+
" total_df = df\n",
|
436 |
+
" print(total_df.head())\n",
|
437 |
+
" else:\n",
|
438 |
+
" total_df = pd.concat([total_df, df], axis=0)\n",
|
439 |
+
" \n",
|
440 |
+
"print(total_df.shape)\n",
|
441 |
+
"total_df.to_csv(out_path + f'complete_info.csv', index = False)\n"
|
442 |
+
]
|
443 |
+
},
|
444 |
+
{
|
445 |
+
"cell_type": "code",
|
446 |
+
"execution_count": null,
|
447 |
+
"metadata": {},
|
448 |
+
"outputs": [],
|
449 |
+
"source": [
|
450 |
+
"image = object_records[4]['_images']['_iiif_image_base_url'] + 'full/735,/0/default.jpg'\n",
|
451 |
+
"image"
|
452 |
+
]
|
453 |
+
},
|
454 |
+
{
|
455 |
+
"cell_type": "code",
|
456 |
+
"execution_count": null,
|
457 |
+
"metadata": {},
|
458 |
+
"outputs": [],
|
459 |
+
"source": [
|
460 |
+
"for rec in tqdm(object_records):\n",
|
461 |
+
" im_url = rec['_images']['_iiif_image_base_url'] + 'full/735,/0/default.jpg'\n",
|
462 |
+
" name = rec['systemNumber']\n",
|
463 |
+
" \n",
|
464 |
+
" download_image(im_url, out_path, name)"
|
465 |
+
]
|
466 |
+
},
|
467 |
+
{
|
468 |
+
"cell_type": "code",
|
469 |
+
"execution_count": null,
|
470 |
+
"metadata": {},
|
471 |
+
"outputs": [],
|
472 |
+
"source": [
|
473 |
+
"import undetected_chromedriver as uc"
|
474 |
+
]
|
475 |
+
},
|
476 |
+
{
|
477 |
+
"cell_type": "code",
|
478 |
+
"execution_count": null,
|
479 |
+
"metadata": {},
|
480 |
+
"outputs": [],
|
481 |
+
"source": [
|
482 |
+
"import sys\n",
|
483 |
+
"\n",
|
484 |
+
"def chromeUndetectableDriver():\n",
|
485 |
+
" driver = uc.Chrome()\n",
|
486 |
+
" return driver\n"
|
487 |
+
]
|
488 |
+
},
|
489 |
+
{
|
490 |
+
"cell_type": "code",
|
491 |
+
"execution_count": null,
|
492 |
+
"metadata": {},
|
493 |
+
"outputs": [],
|
494 |
+
"source": [
|
495 |
+
"out_path = '/Users/ludovicaschaerf/Desktop/Data/GWU_textiles'"
|
496 |
+
]
|
497 |
+
},
|
498 |
+
{
|
499 |
+
"cell_type": "code",
|
500 |
+
"execution_count": null,
|
501 |
+
"metadata": {},
|
502 |
+
"outputs": [],
|
503 |
+
"source": [
|
504 |
+
"import re\n",
|
505 |
+
"import time\n",
|
506 |
+
"\n",
|
507 |
+
"from bs4 import BeautifulSoup as bs\n",
|
508 |
+
"\n",
|
509 |
+
"def scrape_gwm():\n",
|
510 |
+
" driver = chromeUndetectableDriver()\n",
|
511 |
+
" driver.get('https://collections-gwu.zetcom.net/en/collection/?f=withImages&f=publicDomain&ff=%7B%22classification_en_s%22%3A%5B%22Textile%22%5D%7D&om=5')\n",
|
512 |
+
" \n",
|
513 |
+
" d = {'Filename': [], 'Title': [], 'Geography': [], 'Culture': [], 'Materials': [],\n",
|
514 |
+
" 'Collection': [], 'Accession Number': [], 'Credit Line': [], 'Date': [],\n",
|
515 |
+
" 'Copyright': [], 'Object Type': [], 'Dimensions': [], 'Structure': [], 'Used in': []}\n",
|
516 |
+
"\n",
|
517 |
+
" c = 1\n",
|
518 |
+
" # scroll down until full page is rendered\n",
|
519 |
+
" soup = None\n",
|
520 |
+
" time.sleep(10)\n",
|
521 |
+
" soup = bs(driver.page_source, 'html.parser')\n",
|
522 |
+
" print(soup)\n",
|
523 |
+
" # while True and c < 500: # c < 100 to prevent infinite loop\n",
|
524 |
+
" # c += 1\n",
|
525 |
+
" # time.sleep(3)\n",
|
526 |
+
" # driver.execute_script(\"window.scrollTo(0,document.body.scrollHeight)\")\n",
|
527 |
+
" # ele = driver.find_element(\"xpath\", '//*[@class=\"SearchFormResults-buttonViewMore\"]')\n",
|
528 |
+
" # ele.click()\n",
|
529 |
+
" # time.sleep(3)\n",
|
530 |
+
" # s = bs(driver.page_source, 'html.parser')\n",
|
531 |
+
" # if s != soup:\n",
|
532 |
+
" # soup = s\n",
|
533 |
+
" # continue\n",
|
534 |
+
" # else:\n",
|
535 |
+
" # print('reached end of page')\n",
|
536 |
+
" # break\n",
|
537 |
+
"\n",
|
538 |
+
" for a in tqdm(\n",
|
539 |
+
" soup.findAll('div', id=re.compile('search-result-item-object-*'))): # soup.findAll('div', 'item'): #for old version of website use this\n",
|
540 |
+
" try:\n",
|
541 |
+
" link = 'https://collections-gwu.zetcom.net/' + a.find('a')['href'] # a.find('a')['href'] #for old version of website\n",
|
542 |
+
" except Exception as e:\n",
|
543 |
+
" print('not working', e, a)\n",
|
544 |
+
" continue\n",
|
545 |
+
" \n",
|
546 |
+
" name = a.find('a')['href']\n",
|
547 |
+
" driver.get(link)\n",
|
548 |
+
" time.sleep(2)\n",
|
549 |
+
" \n",
|
550 |
+
" soup_ = bs(driver.page_source, 'html.parser')\n",
|
551 |
+
" i = soup_.find('img', {'class': 'Carousel-itemImage'})\n",
|
552 |
+
" print(i)\n",
|
553 |
+
" \n",
|
554 |
+
" if i is not None:\n",
|
555 |
+
" i = 'https://collections-gwu.zetcom.net/' + i['src']\n",
|
556 |
+
" print(i, name)\n",
|
557 |
+
" download_image(i, out_path, name)\n",
|
558 |
+
" d['Filename'].append(name)\n",
|
559 |
+
" d['Title'].append(soup_.find('h1', {'class': 'text-primary'}).text)\n",
|
560 |
+
" for a in soup_.findAll('div', id='CollectionDetails-Item'):\n",
|
561 |
+
" d[a.find('div', {'class': 'CollectionDetails-Item-Lable'}).text].append(a.find('div', {'class': 'CollectionDetails-Item-Body'}).text)\n",
|
562 |
+
" else:\n",
|
563 |
+
" print('Link was none,', soup_)\n",
|
564 |
+
" \n",
|
565 |
+
" print(d)\n",
|
566 |
+
"\n",
|
567 |
+
" # pd.DataFrame(d).to_csv(output_csv, index=False)\n",
|
568 |
+
" # return pd.DataFrame(d)\n"
|
569 |
+
]
|
570 |
+
},
|
571 |
+
{
|
572 |
+
"cell_type": "code",
|
573 |
+
"execution_count": null,
|
574 |
+
"metadata": {},
|
575 |
+
"outputs": [],
|
576 |
+
"source": [
|
577 |
+
"scrape_gwm()"
|
578 |
+
]
|
579 |
+
},
|
580 |
+
{
|
581 |
+
"cell_type": "code",
|
582 |
+
"execution_count": null,
|
583 |
+
"metadata": {},
|
584 |
+
"outputs": [],
|
585 |
+
"source": [
|
586 |
+
"! python /Users/ludovicaschaerf/Desktop/Repos/ailia-models/background_removal/indexnet/indexnet.py --input /Users/ludovicaschaerf/Desktop/Data/VA_textiles/O25180.jpg --savepath /Users/ludovicaschaerf/Desktop/Data/NO_BG/no_bg_O25180.jpg -a u2net"
|
587 |
+
]
|
588 |
+
},
|
589 |
+
{
|
590 |
+
"cell_type": "code",
|
591 |
+
"execution_count": null,
|
592 |
+
"metadata": {},
|
593 |
+
"outputs": [],
|
594 |
+
"source": []
|
595 |
+
}
|
596 |
+
],
|
597 |
+
"metadata": {
|
598 |
+
"kernelspec": {
|
599 |
+
"display_name": "art-reco_x86",
|
600 |
+
"language": "python",
|
601 |
+
"name": "python3"
|
602 |
+
},
|
603 |
+
"language_info": {
|
604 |
+
"codemirror_mode": {
|
605 |
+
"name": "ipython",
|
606 |
+
"version": 3
|
607 |
+
},
|
608 |
+
"file_extension": ".py",
|
609 |
+
"mimetype": "text/x-python",
|
610 |
+
"name": "python",
|
611 |
+
"nbconvert_exporter": "python",
|
612 |
+
"pygments_lexer": "ipython3",
|
613 |
+
"version": "3.8.16"
|
614 |
+
},
|
615 |
+
"orig_nbformat": 4
|
616 |
+
},
|
617 |
+
"nbformat": 4,
|
618 |
+
"nbformat_minor": 2
|
619 |
+
}
|
view_omniart_data.ipynb
DELETED
File without changes
|
view_predictions.ipynb
CHANGED
@@ -2,10 +2,31 @@
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
-
"execution_count":
|
6 |
"id": "fe7acfaf-dc61-4211-9c78-8e4433bc9deb",
|
7 |
"metadata": {},
|
8 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
"source": [
|
10 |
"import pandas as pd\n",
|
11 |
"import pickle\n",
|
@@ -150,10 +171,19 @@
|
|
150 |
},
|
151 |
{
|
152 |
"cell_type": "code",
|
153 |
-
"execution_count":
|
154 |
"id": "0eae840f",
|
155 |
"metadata": {},
|
156 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
"source": [
|
158 |
"import open_clip\n",
|
159 |
"import os\n",
|
@@ -164,7 +194,7 @@
|
|
164 |
},
|
165 |
{
|
166 |
"cell_type": "code",
|
167 |
-
"execution_count":
|
168 |
"id": "4d776015",
|
169 |
"metadata": {},
|
170 |
"outputs": [],
|
@@ -175,10 +205,33 @@
|
|
175 |
},
|
176 |
{
|
177 |
"cell_type": "code",
|
178 |
-
"execution_count":
|
179 |
"id": "e3f917a7",
|
180 |
"metadata": {},
|
181 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
"source": [
|
183 |
"model_clip, _, preprocess = open_clip.create_model_and_transforms('ViT-L-14', pretrained='laion2b_s32b_b82k')\n",
|
184 |
"tokenizer = open_clip.get_tokenizer('ViT-L-14')\n",
|
@@ -204,7 +257,7 @@
|
|
204 |
},
|
205 |
{
|
206 |
"cell_type": "code",
|
207 |
-
"execution_count":
|
208 |
"id": "f7858bbf",
|
209 |
"metadata": {},
|
210 |
"outputs": [],
|
@@ -214,7 +267,7 @@
|
|
214 |
},
|
215 |
{
|
216 |
"cell_type": "code",
|
217 |
-
"execution_count":
|
218 |
"id": "de6bd428",
|
219 |
"metadata": {},
|
220 |
"outputs": [],
|
@@ -224,7 +277,7 @@
|
|
224 |
},
|
225 |
{
|
226 |
"cell_type": "code",
|
227 |
-
"execution_count":
|
228 |
"id": "d19c8e4c",
|
229 |
"metadata": {},
|
230 |
"outputs": [],
|
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
+
"execution_count": 1,
|
6 |
"id": "fe7acfaf-dc61-4211-9c78-8e4433bc9deb",
|
7 |
"metadata": {},
|
8 |
+
"outputs": [
|
9 |
+
{
|
10 |
+
"name": "stdout",
|
11 |
+
"output_type": "stream",
|
12 |
+
"text": [
|
13 |
+
"Intel MKL WARNING: Support of Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2) enabled only processors has been deprecated. Intel oneAPI Math Kernel Library 2025.0 will require Intel(R) Advanced Vector Extensions (Intel(R) AVX) instructions.\n",
|
14 |
+
"Intel MKL WARNING: Support of Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2) enabled only processors has been deprecated. Intel oneAPI Math Kernel Library 2025.0 will require Intel(R) Advanced Vector Extensions (Intel(R) AVX) instructions.\n"
|
15 |
+
]
|
16 |
+
},
|
17 |
+
{
|
18 |
+
"ename": "ModuleNotFoundError",
|
19 |
+
"evalue": "No module named 'sklearn'",
|
20 |
+
"output_type": "error",
|
21 |
+
"traceback": [
|
22 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
23 |
+
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
|
24 |
+
"Cell \u001b[0;32mIn[1], line 8\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mtorch\u001b[39;00m\n\u001b[1;32m 7\u001b[0m \u001b[39m#import ninja\u001b[39;00m\n\u001b[0;32m----> 8\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mbackend\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mdisentangle_concepts\u001b[39;00m \u001b[39mimport\u001b[39;00m \u001b[39m*\u001b[39m\n\u001b[1;32m 9\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mdnnlib\u001b[39;00m \n\u001b[1;32m 10\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mlegacy\u001b[39;00m\n",
|
25 |
+
"File \u001b[0;32m~/Desktop/latent-space-theories/backend/disentangle_concepts.py:2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mnumpy\u001b[39;00m \u001b[39mas\u001b[39;00m \u001b[39mnp\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39msklearn\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39msvm\u001b[39;00m \u001b[39mimport\u001b[39;00m SVC\n\u001b[1;32m 3\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39msklearn\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mlinear_model\u001b[39;00m \u001b[39mimport\u001b[39;00m LogisticRegression\n\u001b[1;32m 4\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39msklearn\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mmodel_selection\u001b[39;00m \u001b[39mimport\u001b[39;00m train_test_split\n",
|
26 |
+
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'sklearn'"
|
27 |
+
]
|
28 |
+
}
|
29 |
+
],
|
30 |
"source": [
|
31 |
"import pandas as pd\n",
|
32 |
"import pickle\n",
|
|
|
171 |
},
|
172 |
{
|
173 |
"cell_type": "code",
|
174 |
+
"execution_count": 1,
|
175 |
"id": "0eae840f",
|
176 |
"metadata": {},
|
177 |
+
"outputs": [
|
178 |
+
{
|
179 |
+
"name": "stderr",
|
180 |
+
"output_type": "stream",
|
181 |
+
"text": [
|
182 |
+
"/Users/ludovicaschaerf/anaconda3/envs/torch_arm/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
183 |
+
" from .autonotebook import tqdm as notebook_tqdm\n"
|
184 |
+
]
|
185 |
+
}
|
186 |
+
],
|
187 |
"source": [
|
188 |
"import open_clip\n",
|
189 |
"import os\n",
|
|
|
194 |
},
|
195 |
{
|
196 |
"cell_type": "code",
|
197 |
+
"execution_count": 2,
|
198 |
"id": "4d776015",
|
199 |
"metadata": {},
|
200 |
"outputs": [],
|
|
|
205 |
},
|
206 |
{
|
207 |
"cell_type": "code",
|
208 |
+
"execution_count": 3,
|
209 |
"id": "e3f917a7",
|
210 |
"metadata": {},
|
211 |
+
"outputs": [
|
212 |
+
{
|
213 |
+
"name": "stdout",
|
214 |
+
"output_type": "stream",
|
215 |
+
"text": [
|
216 |
+
"['Provenance ADRIA', 'Provenance AEGINA', 'Provenance AL MINA', 'Provenance ALICANTE', 'Provenance AMATHUS', 'Provenance AMPURIAS', 'Provenance APOLLONIA PONTICA', 'Provenance APULIA', 'Provenance ARGOLIS', 'Provenance ARGOS', 'Provenance ATHENS', 'Provenance ATHENS (?)', 'Provenance ATTICA', 'Provenance BARI', 'Provenance BENGHAZI', 'Provenance BEREZAN', 'Provenance BLACK SEA', 'Provenance BOEOTIA', 'Provenance BOLOGNA', 'Provenance CAPUA', 'Provenance CARIA', 'Provenance CARTHAGE', 'Provenance CHIUSI', 'Provenance CIVITAVECCHIA', 'Provenance CORINTH', 'Provenance CORSICA', 'Provenance CRETE', 'Provenance CRIMEA', 'Provenance CUMAE', 'Provenance CYCLADES', 'Provenance CYPRUS', 'Provenance CYRENAICA', 'Provenance CYRENE', 'Provenance EGYPT', 'Provenance ELIS', 'Provenance ENSERUNE', 'Provenance ETRURIA', 'Provenance EUBOEA', 'Provenance FALERII', 'Provenance GRANADA', 'Provenance GREECE', 'Provenance GREECE (?)', 'Provenance HISTRIA', 'Provenance ITALY', 'Provenance JAEN', 'Provenance KITION', 'Provenance LESBOS', 'Provenance LOCRI', 'Provenance LOCRIS', 'Provenance LYCIA', 'Provenance MACEDONIA', 'Provenance MARION', 'Provenance MARSEILLES', 'Provenance MARZABOTTO', 'Provenance METAPONTUM', 'Provenance MILETUS', 'Provenance NAPLES', 'Provenance NAUCRATIS', 'Provenance NOLA', 'Provenance NUMANA', 'Provenance OLD SMYRNA', 'Provenance ORVIETO', 'Provenance PAESTUM', 'Provenance PHOCIS', 'Provenance PITANE', 'Provenance POPULONIA', 'Provenance RHODES', 'Provenance ROME', 'Provenance RUVO', 'Provenance SALERNO', 'Provenance SAMOS', 'Provenance SARDINIA', 'Provenance SARDIS', 'Provenance SICILY', 'Provenance SMYRNA', 'Provenance SOUTH', 'Provenance SPARTA', 'Provenance SPINA', 'Provenance SUESSULA', 'Provenance TARANTO', 'Provenance TELL DEFENNEH', 'Provenance THASOS', 'Provenance THERA', 'Provenance THESSALY', 'Provenance THRACE', 'Provenance TOCRA', 'Provenance TODI', 'Provenance ULLASTRET', 'Provenance VALENCIA', 'Shape Name ALABASTRON', 'Shape Name ALABASTRON FRAGMENT', 'Shape Name AMPHORA', 'Shape Name AMPHORA (?) FRAGMENT', 'Shape Name AMPHORISKOS', 'Shape Name ARYBALLOS', 'Shape Name ASKOS', 'Shape Name ASKOS FRAGMENT', 'Shape Name BOTTLE', 'Shape Name BOWL', 'Shape Name BOWL FRAGMENT', 'Shape Name CHALICE', 'Shape Name CHALICE FRAGMENT', 'Shape Name CHOUS', 'Shape Name CHOUS FRAGMENT', 'Shape Name CUP', 'Shape Name CUP (?) FRAGMENT', 'Shape Name CUP A', 'Shape Name CUP A FRAGMENT', 'Shape Name CUP A FRAGMENTS', 'Shape Name CUP B', 'Shape Name CUP B FRAGMENT', 'Shape Name CUP B FRAGMENTS', 'Shape Name CUP C', 'Shape Name CUP C FRAGMENT', 'Shape Name CUP C FRAGMENTS', 'Shape Name CUP DROOP', 'Shape Name CUP DROOP FRAGMENT', 'Shape Name CUP FRAGMENT', 'Shape Name CUP FRAGMENTS', 'Shape Name CUP KASSEL', 'Shape Name CUP KASSEL FRAGMENT', 'Shape Name CUP LITTLE MASTER BAND', 'Shape Name CUP LITTLE MASTER BAND (?) FRAGMENT', 'Shape Name CUP LITTLE MASTER BAND FRAGMENT', 'Shape Name CUP LITTLE MASTER BAND FRAGMENTS', 'Shape Name CUP LITTLE MASTER FRAGMENT', 'Shape Name CUP LITTLE MASTER LIP', 'Shape Name CUP LITTLE MASTER LIP FRAGMENT', 'Shape Name CUP LITTLE MASTER LIP FRAGMENTS', 'Shape Name CUP SIANA', 'Shape Name CUP SIANA FRAGMENT', 'Shape Name CUP SIANA FRAGMENTS', 'Shape Name CUP SKYPHOS', 'Shape Name CUP SKYPHOS FRAGMENT', 'Shape Name CUP STEMLESS', 'Shape Name CUP STEMLESS FRAGMENT', 'Shape Name CUP STEMLESS FRAGMENTS', 'Shape Name DINOS', 'Shape Name DINOS FRAGMENT', 'Shape Name DISH', 'Shape Name EPICHYSIS', 'Shape Name EPINETRON FRAGMENT', 'Shape Name FEEDER', 'Shape Name FIGURE VASE', 'Shape Name FIGURE VASE ARYBALLOS', 'Shape Name FIGURE VASE ASKOS', 'Shape Name FIGURE VASE FRAGMENT', 'Shape Name FIGURE VASE KANTHAROS', 'Shape Name FIGURE VASE LEKYTHOS', 'Shape Name FIGURE VASE OINOCHOE', 'Shape Name FISH-PLATE', 'Shape Name FLASK', 'Shape Name FRAGMENT', 'Shape Name FRAGMENTS', 'Shape Name GUTTUS', 'Shape Name HYDRIA', 'Shape Name HYDRIA (?) FRAGMENT', 'Shape Name HYDRIA FRAGMENT', 'Shape Name HYDRIA FRAGMENTS', 'Shape Name INCENSE BURNER', 'Shape Name JAR', 'Shape Name JUG', 'Shape Name KALATHOS', 'Shape Name KANTHAROS', 'Shape Name KANTHAROS FRAGMENT', 'Shape Name KERNOS', 'Shape Name KOTYLE', 'Shape Name KOTYLE FRAGMENT', 'Shape Name KRATER', 'Shape Name KRATER (?) FRAGMENT', 'Shape Name KRATER FRAGMENT', 'Shape Name KRATER FRAGMENTS', 'Shape Name KYATHOS', 'Shape Name KYATHOS FRAGMENT', 'Shape Name LEBES', 'Shape Name LEBES FRAGMENT', 'Shape Name LEKANIS', 'Shape Name LEKANIS FRAGMENT', 'Shape Name LEKANIS FRAGMENTS', 'Shape Name LEKANIS LID', 'Shape Name LEKANIS LID FRAGMENT', 'Shape Name LEKYTHOS', 'Shape Name LEKYTHOS FRAGMENT', 'Shape Name LEKYTHOS FRAGMENTS', 'Shape Name LID', 'Shape Name LID FRAGMENT', 'Shape Name LOUTROPHOROS', 'Shape Name LOUTROPHOROS FRAGMENT', 'Shape Name LOUTROPHOROS FRAGMENTS', 'Shape Name LYDION', 'Shape Name MASTOID', 'Shape Name MINIATURE PANATHENAIC AMPHORA', 'Shape Name MUG', 'Shape Name MUG FRAGMENT', 'Shape Name NESTORIS', 'Shape Name OINOCHOE', 'Shape Name OINOCHOE (?) FRAGMENT', 'Shape Name OINOCHOE FRAGMENT', 'Shape Name OINOCHOE FRAGMENTS', 'Shape Name OLLA', 'Shape Name OLPE', 'Shape Name OLPE FRAGMENT', 'Shape Name OLPE FRAGMENTS', 'Shape Name PELIKE', 'Shape Name PELIKE FRAGMENT', 'Shape Name PELIKE FRAGMENTS', 'Shape Name PHIALE', 'Shape Name PHIALE FRAGMENT', 'Shape Name PITCHER', 'Shape Name PLAQUE FRAGMENT', 'Shape Name PLAQUE FRAGMENTS', 'Shape Name PLATE', 'Shape Name PLATE FRAGMENT', 'Shape Name PLATE FRAGMENTS', 'Shape Name PLEMOCHOE', 'Shape Name PSEUDO-PANATHENAIC AMPHORA', 'Shape Name PSEUDO-PANATHENAIC AMPHORA FRAGMENT', 'Shape Name PSYKTER', 'Shape Name PYXIS', 'Shape Name PYXIS FRAGMENT', 'Shape Name PYXIS FRAGMENTS', 'Shape Name PYXIS LID', 'Shape Name PYXIS LID FRAGMENT', 'Shape Name RHYTON', 'Shape Name SKYPHOS', 'Shape Name SKYPHOS (?) FRAGMENT', 'Shape Name SKYPHOS FRAGMENT', 'Shape Name SKYPHOS FRAGMENTS', 'Shape Name STAMNOS', 'Shape Name STAMNOS FRAGMENT', 'Shape Name STAMNOS FRAGMENTS', 'Shape Name STAND', 'Shape Name STAND FRAGMENT', 'Shape Name STEMLESS CUP FRAGMENT', 'Shape Name STIRRUP JAR', 'Shape Name TANKARD', 'Shape Name UNKNOWN', 'Shape Name URN', 'Shape Name VARIOUS', 'Shape Name VASE', 'Fabric ARGIVE GEOMETRIC', 'Fabric ARRETINE', 'Fabric ATHENIAN', 'Fabric ATHENIAN (?)', 'Fabric ATHENIAN GEOMETRIC', 'Fabric ATHENIAN PROTOGEOMETRIC', 'Fabric BOEOTIAN', 'Fabric BOEOTIAN GEOMETRIC', 'Fabric CALENIAN', 'Fabric CAMPANA', 'Fabric CANOSAN', 'Fabric CHALCIDIAN', 'Fabric CORINTHIAN', 'Fabric CRETAN', 'Fabric CYCLADIC', 'Fabric CYPRIOT', 'Fabric CYPRIOT, BRONZE AGE', 'Fabric CYPRIOT, IRON AGE', 'Fabric CYPRIOT, MYCENAEAN STYLE', 'Fabric DAUNIAN', 'Fabric EAST GREEK', 'Fabric EAST GREEK GEOMETRIC', 'Fabric EAST GREEK, CLAZOMENIAN', 'Fabric EAST GREEK, FIKELLURA', 'Fabric EAST GREEK, NAUCRATITE', 'Fabric EGYPTIAN', 'Fabric ETRUSCAN', 'Fabric ETRUSCO-CORINTHIAN', 'Fabric FALISCAN', 'Fabric GALLIC', 'Fabric GALLO-ROMAN', 'Fabric GREEK', 'Fabric HELLADIC', 'Fabric HELLENISTIC', 'Fabric IBERIAN', 'Fabric IONIAN', 'Fabric ITALIOTE', 'Fabric ITALO-CORINTHIAN', 'Fabric ITALO-GEOMETRIC', 'Fabric LACONIAN', 'Fabric LACONIAN GEOMETRIC', 'Fabric MESSAPIAN', 'Fabric MINOAN', 'Fabric MYCENEAN', 'Fabric PONTIC', 'Fabric PROTO-ELAMITE', 'Fabric PROTOATTIC', 'Fabric PROTOCORINTHIAN', 'Fabric PROTOCORINTHIAN, TRANSITIONAL', 'Fabric ROMAN', 'Fabric SOUTH ITALIAN', 'Fabric SOUTH ITALIAN, APULIAN', 'Fabric SOUTH ITALIAN, CAMPANIAN', 'Fabric SOUTH ITALIAN, GNATHIAN', 'Fabric SOUTH ITALIAN, LUCANIAN', 'Fabric SOUTH ITALIAN, PAESTAN', 'Fabric SOUTH ITALIAN, SICILIAN', 'Fabric TERRA SIGILLATA', 'Fabric UNCERTAIN', 'Fabric VEIAN', 'Fabric VILLA NOVA', 'Technique ADDED COLOUR', 'Technique BLACK GLAZE', 'Technique BLACK PATTERN', 'Technique BLACK-FIGURE', 'Technique BROWN GLAZE', 'Technique BUCCHERO', 'Technique IMPASTO', 'Technique OUTLINE', 'Technique PATTERN', 'Technique PLAIN', 'Technique PSEUDO RED-FIGURE', 'Technique RED POLISHED WARE', 'Technique RED-FIGURE', 'Technique RELIEF', 'Technique RESERVING', 'Technique SILHOUETTE', 'Technique WHITE PAINTED WARE']\n"
|
217 |
+
]
|
218 |
+
},
|
219 |
+
{
|
220 |
+
"name": "stderr",
|
221 |
+
"output_type": "stream",
|
222 |
+
"text": [
|
223 |
+
"/Users/ludovicaschaerf/anaconda3/envs/torch_arm/lib/python3.11/site-packages/torch/amp/autocast_mode.py:221: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling\n",
|
224 |
+
" warnings.warn('User provided device_type of \\'cuda\\', but CUDA is not available. Disabling')\n"
|
225 |
+
]
|
226 |
+
},
|
227 |
+
{
|
228 |
+
"name": "stdout",
|
229 |
+
"output_type": "stream",
|
230 |
+
"text": [
|
231 |
+
"(318, 768)\n"
|
232 |
+
]
|
233 |
+
}
|
234 |
+
],
|
235 |
"source": [
|
236 |
"model_clip, _, preprocess = open_clip.create_model_and_transforms('ViT-L-14', pretrained='laion2b_s32b_b82k')\n",
|
237 |
"tokenizer = open_clip.get_tokenizer('ViT-L-14')\n",
|
|
|
257 |
},
|
258 |
{
|
259 |
"cell_type": "code",
|
260 |
+
"execution_count": 4,
|
261 |
"id": "f7858bbf",
|
262 |
"metadata": {},
|
263 |
"outputs": [],
|
|
|
267 |
},
|
268 |
{
|
269 |
"cell_type": "code",
|
270 |
+
"execution_count": 5,
|
271 |
"id": "de6bd428",
|
272 |
"metadata": {},
|
273 |
"outputs": [],
|
|
|
277 |
},
|
278 |
{
|
279 |
"cell_type": "code",
|
280 |
+
"execution_count": 6,
|
281 |
"id": "d19c8e4c",
|
282 |
"metadata": {},
|
283 |
"outputs": [],
|