Skip to content

Commit 0506e58

Browse files
committed
fixing
1 parent 46c48b5 commit 0506e58

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

examples/feature_vectors.ipynb

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"id": "9ece0f6e-518a-49b6-b06a-959d50bef991",
1414
"metadata": {},
1515
"source": [
16-
"## Use case 1: compute feature vectors with fastdup and load then with numpy for further processing"
16+
"## Use case 1: compute feature vectors with fastdup and load them with numpy for further processing"
1717
]
1818
},
1919
{
@@ -97,8 +97,12 @@
9797
"source": [
9898
"import fastdup\n",
9999
"import numpy as np\n",
100+
"\n",
101+
"#chnage to your image folder\n",
102+
"input_dir = '/Users/dannybickson/visual_database/cxx/unittests/two_images/'\n",
103+
"\n",
100104
"# Run fastup on an input image folder to create embeddings\n",
101-
"fd = fastdup.create(input_dir='/Users/dannybickson/visual_database/cxx/unittests/two_images/', work_dir='out')\n",
105+
"fd = fastdup.create(input_dir=input_dir, work_dir='out')\n",
102106
"fd.run(overwrite=True, print_summary=False)\n",
103107
"\n",
104108
"# Read the embeddings to use them in python\n",
@@ -162,14 +166,19 @@
162166
}
163167
],
164168
"source": [
169+
"import fastdup\n",
170+
"import numpy as np\n",
171+
"import os\n",
172+
"input_dir = '/Users/dannybickson/visual_database/cxx/unittests/two_images/'\n",
173+
"flist = os.listdir(input_dir)\n",
174+
"flist = [os.path.join(input_dir, f) for f in flist]\n",
175+
"\n",
165176
"# replace the below code with computation of your own features\n",
166177
"matrix = np.random.rand(2, 576).astype('float32')\n",
167178
"\n",
168179
"# save the embedding along the filenames into a working folder\n",
169180
"!mkdir -p embedding_input\n",
170181
"fastdup.save_binary_feature('embedding_input', flist, matrix)\n",
171-
"\n",
172-
"\n",
173182
"fastdup.run('~/visual_database/cxx/unittests/two_images/', run_mode=2, work_dir='embedding_input')"
174183
]
175184
},
@@ -208,11 +217,18 @@
208217
],
209218
"source": [
210219
"# Note: files should contain absolute path and not relative path\n",
211-
"import pandas as pd\n",
212-
"df = pd.DataFrame({'filename':flist})\n",
213-
"fd2 = fastdup.create(input_dir='/Users/dannybickson/visual_database/cxx/unittests/two_images/', work_dir='out3')\n",
214-
"fd2.run(annotations=df, embeddings=matrix, print_summary=False, overwrite=True)\n",
215-
"\n"
220+
"import fastdup\n",
221+
"import numpy as np\n",
222+
"import os\n",
223+
"input_dir = '/Users/dannybickson/visual_database/cxx/unittests/two_images/'\n",
224+
"flist = os.listdir(input_dir)\n",
225+
"flist = [os.path.join(input_dir, f) for f in flist]\n",
226+
"\n",
227+
"# replace the below code with computation of your own features\n",
228+
"matrix = np.random.rand(2, 576).astype('float32')\n",
229+
"\n",
230+
"fd2 = fastdup.create(input_dir=input_dir, work_dir='output2')\n",
231+
"fd2.run(annotations=flist, embeddings=matrix, print_summary=False, overwrite=True)"
216232
]
217233
},
218234
{

0 commit comments

Comments
 (0)