DanielIglesias97 commited on
Commit
708f5d3
·
1 Parent(s): 1ab83f7

First upload of the code of NodeImageSearchEngine to the repository.

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. README.md +3 -23
  2. compose.yaml +30 -0
  3. index.html +0 -435
  4. node_server/Dockerfile +17 -0
  5. node_server/package.json +15 -0
  6. node_server/server.js +39 -0
  7. node_server/views/index.ejs +31 -0
  8. node_server/views/style.css +64 -0
  9. python_clip_image_search/Dockerfile +30 -0
  10. python_clip_image_search/config.cfg +7 -0
  11. python_clip_image_search/dataset/000000000139.jpg +0 -0
  12. python_clip_image_search/dataset/000000000285.jpg +0 -0
  13. python_clip_image_search/dataset/000000000632.jpg +0 -0
  14. python_clip_image_search/dataset/000000000724.jpg +0 -0
  15. python_clip_image_search/dataset/000000000776.jpg +0 -0
  16. python_clip_image_search/dataset/000000000785.jpg +0 -0
  17. python_clip_image_search/dataset/000000000802.jpg +0 -0
  18. python_clip_image_search/dataset/000000000872.jpg +0 -0
  19. python_clip_image_search/dataset/000000000885.jpg +0 -0
  20. python_clip_image_search/dataset/000000001000.jpg +0 -0
  21. python_clip_image_search/dataset/000000001268.jpg +0 -0
  22. python_clip_image_search/dataset/000000001296.jpg +0 -0
  23. python_clip_image_search/dataset/000000001353.jpg +0 -0
  24. python_clip_image_search/dataset/000000001425.jpg +0 -0
  25. python_clip_image_search/dataset/000000001490.jpg +0 -0
  26. python_clip_image_search/dataset/000000001503.jpg +0 -0
  27. python_clip_image_search/dataset/000000001532.jpg +0 -0
  28. python_clip_image_search/dataset/000000001584.jpg +0 -0
  29. python_clip_image_search/dataset/000000001675.jpg +0 -0
  30. python_clip_image_search/dataset/000000001761.jpg +0 -0
  31. python_clip_image_search/dataset/000000001818.jpg +0 -0
  32. python_clip_image_search/dataset/000000001993.jpg +0 -0
  33. python_clip_image_search/dataset/000000002006.jpg +0 -0
  34. python_clip_image_search/dataset/000000002149.jpg +0 -0
  35. python_clip_image_search/dataset/000000002153.jpg +0 -0
  36. python_clip_image_search/dataset/000000002157.jpg +0 -0
  37. python_clip_image_search/dataset/000000002261.jpg +0 -0
  38. python_clip_image_search/dataset/000000002299.jpg +0 -0
  39. python_clip_image_search/dataset/000000002431.jpg +0 -0
  40. python_clip_image_search/dataset/000000002473.jpg +0 -0
  41. python_clip_image_search/dataset/000000002532.jpg +0 -0
  42. python_clip_image_search/dataset/000000002587.jpg +0 -0
  43. python_clip_image_search/dataset/000000002592.jpg +0 -0
  44. python_clip_image_search/dataset/000000002685.jpg +0 -0
  45. python_clip_image_search/dataset/000000002923.jpg +0 -0
  46. python_clip_image_search/dataset/000000003156.jpg +0 -0
  47. python_clip_image_search/dataset/000000003255.jpg +0 -0
  48. python_clip_image_search/dataset/000000003501.jpg +0 -0
  49. python_clip_image_search/dataset/000000003553.jpg +0 -0
  50. python_clip_image_search/dataset/000000003661.jpg +0 -0
README.md CHANGED
@@ -1,25 +1,5 @@
1
- ---
2
- title: NodeImageSearchEngine
3
- emoji: 🧠
4
- colorFrom: yellow
5
- colorTo: indigo
6
- sdk: static
7
- pinned: false
8
- ---
9
 
10
- # Nerfies
11
 
12
- This is the repository that contains source code for the [Nerfies website](https://nerfies.github.io).
13
-
14
- If you find Nerfies useful for your work please cite:
15
- ```
16
- @article{park2021nerfies
17
- author = {Park, Keunhong and Sinha, Utkarsh and Barron, Jonathan T. and Bouaziz, Sofien and Goldman, Dan B and Seitz, Steven M. and Martin-Brualla, Ricardo},
18
- title = {Nerfies: Deformable Neural Radiance Fields},
19
- journal = {ICCV},
20
- year = {2021},
21
- }
22
- ```
23
-
24
- # Website License
25
- <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.
 
1
+ This repository contains the code of a NodeJS server for image search. This project was implemented to prove how to join Python code with NodeJS code using Docker.
2
+ In particular, the Python code performs the search using the CLIP model and then sends the results to the NodeJS server. Then, this server displays the images that
3
+ were obtained from the text search process.
 
 
 
 
 
4
 
 
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
compose.yaml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: node_image_search_engine
2
+ services:
3
+ node_frontend:
4
+ build: ./node_server
5
+ links:
6
+ - "python_clip_image_search:pclis"
7
+ ports:
8
+ - 3000:3000
9
+ volumes:
10
+ - type: bind
11
+ source: ./python_clip_image_search/dataset
12
+ target: /home/node/app/views/dataset
13
+ command: npm start
14
+ develop:
15
+ watch:
16
+ - action: sync
17
+ path: ./node_server
18
+ target: /home/node/app
19
+ ignore:
20
+ - ./node_server/node_modules/
21
+ - action: rebuild
22
+ path: package.json
23
+
24
+ python_clip_image_search:
25
+ build: ./python_clip_image_search
26
+ develop:
27
+ watch:
28
+ - action: sync
29
+ path: ./python_clip_image_search
30
+ target: /app
index.html DELETED
@@ -1,435 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="description"
6
- content="Deformable Neural Radiance Fields creates free-viewpoint portraits (nerfies) from casually captured videos.">
7
- <meta name="keywords" content="Nerfies, D-NeRF, NeRF">
8
- <meta name="viewport" content="width=device-width, initial-scale=1">
9
- <title>Nerfies: Deformable Neural Radiance Fields</title>
10
-
11
- <link href="https://fonts.googleapis.com/css?family=Google+Sans|Noto+Sans|Castoro"
12
- rel="stylesheet">
13
-
14
- <link rel="stylesheet" href="./static/css/bulma.min.css">
15
- <link rel="stylesheet" href="./static/css/bulma-carousel.min.css">
16
- <link rel="stylesheet" href="./static/css/bulma-slider.min.css">
17
- <link rel="stylesheet" href="./static/css/fontawesome.all.min.css">
18
- <link rel="stylesheet"
19
- href="https://cdn.jsdelivr.net/gh/jpswalsh/academicons@1/css/academicons.min.css">
20
- <link rel="stylesheet" href="./static/css/index.css">
21
- <link rel="icon" href="./static/images/favicon.svg">
22
-
23
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
24
- <script defer src="./static/js/fontawesome.all.min.js"></script>
25
- <script src="./static/js/bulma-carousel.min.js"></script>
26
- <script src="./static/js/bulma-slider.min.js"></script>
27
- <script src="./static/js/index.js"></script>
28
- </head>
29
- <body>
30
-
31
- <section class="hero">
32
- <div class="hero-body">
33
- <div class="container is-max-desktop">
34
- <div class="columns is-centered">
35
- <div class="column has-text-centered">
36
- <h1 class="title is-1 publication-title">Nerfies: Deformable Neural Radiance Fields</h1>
37
- <div class="is-size-5 publication-authors">
38
- <span class="author-block">
39
- <a href="https://keunhong.com" target="_blank">Keunhong Park</a><sup>1</sup>,</span>
40
- <span class="author-block">
41
- <a href="https://utkarshsinha.com" target="_blank">Utkarsh Sinha</a><sup>2</sup>,</span>
42
- <span class="author-block">
43
- <a href="https://jonbarron.info" target="_blank">Jonathan T. Barron</a><sup>2</sup>,
44
- </span>
45
- <span class="author-block">
46
- <a href="http://sofienbouaziz.com" target="_blank">Sofien Bouaziz</a><sup>2</sup>,
47
- </span>
48
- <span class="author-block">
49
- <a href="https://www.danbgoldman.com" target="_blank">Dan B Goldman</a><sup>2</sup>,
50
- </span>
51
- <span class="author-block">
52
- <a href="https://homes.cs.washington.edu/~seitz/" target="_blank">Steven M. Seitz</a><sup>1,2</sup>,
53
- </span>
54
- <span class="author-block">
55
- <a href="http://www.ricardomartinbrualla.com" target="_blank">Ricardo Martin-Brualla</a><sup>2</sup>
56
- </span>
57
- </div>
58
-
59
- <div class="is-size-5 publication-authors">
60
- <span class="author-block"><sup>1</sup>University of Washington,</span>
61
- <span class="author-block"><sup>2</sup>Google Research</span>
62
- </div>
63
-
64
- <div class="column has-text-centered">
65
- <div class="publication-links">
66
- <!-- PDF Link. -->
67
- <span class="link-block">
68
- <a href="https://arxiv.org/pdf/2011.12948" target="_blank"
69
- class="external-link button is-normal is-rounded is-dark">
70
- <span class="icon">
71
- <i class="fas fa-file-pdf"></i>
72
- </span>
73
- <span>Paper</span>
74
- </a>
75
- </span>
76
- <span class="link-block">
77
- <a href="https://arxiv.org/abs/2011.12948" target="_blank"
78
- class="external-link button is-normal is-rounded is-dark">
79
- <span class="icon">
80
- <i class="ai ai-arxiv"></i>
81
- </span>
82
- <span>arXiv</span>
83
- </a>
84
- </span>
85
- <!-- Video Link. -->
86
- <span class="link-block">
87
- <a href="https://www.youtube.com/watch?v=MrKrnHhk8IA" target="_blank"
88
- class="external-link button is-normal is-rounded is-dark">
89
- <span class="icon">
90
- <i class="fab fa-youtube"></i>
91
- </span>
92
- <span>Video</span>
93
- </a>
94
- </span>
95
- <!-- Code Link. -->
96
- <span class="link-block">
97
- <a href="https://github.com/google/nerfies" target="_blank"
98
- class="external-link button is-normal is-rounded is-dark">
99
- <span class="icon">
100
- <i class="fab fa-github"></i>
101
- </span>
102
- <span>Code</span>
103
- </a>
104
- </span>
105
- <!-- Dataset Link. -->
106
- <span class="link-block">
107
- <a href="https://github.com/google/nerfies/releases/tag/0.1" target="_blank"
108
- class="external-link button is-normal is-rounded is-dark">
109
- <span class="icon">
110
- <i class="far fa-images"></i>
111
- </span>
112
- <span>Data</span>
113
- </a>
114
- </div>
115
-
116
- </div>
117
- </div>
118
- </div>
119
- </div>
120
- </div>
121
- </section>
122
-
123
- <section class="hero teaser">
124
- <div class="container is-max-desktop">
125
- <div class="hero-body">
126
- <video id="teaser" autoplay muted loop playsinline height="100%">
127
- <source src="./static/videos/teaser.mp4"
128
- type="video/mp4">
129
- </video>
130
- <h2 class="subtitle has-text-centered">
131
- <span class="dnerf">Nerfies</span> turns selfie videos from your phone into
132
- free-viewpoint
133
- portraits.
134
- </h2>
135
- </div>
136
- </div>
137
- </section>
138
-
139
-
140
- <section class="hero is-light is-small">
141
- <div class="hero-body">
142
- <div class="container">
143
- <div id="results-carousel" class="carousel results-carousel">
144
- <div class="item item-steve">
145
- <video poster="" id="steve" autoplay controls muted loop playsinline height="100%">
146
- <source src="./static/videos/steve.mp4"
147
- type="video/mp4">
148
- </video>
149
- </div>
150
- <div class="item item-chair-tp">
151
- <video poster="" id="chair-tp" autoplay controls muted loop playsinline height="100%">
152
- <source src="./static/videos/chair-tp.mp4"
153
- type="video/mp4">
154
- </video>
155
- </div>
156
- <div class="item item-shiba">
157
- <video poster="" id="shiba" autoplay controls muted loop playsinline height="100%">
158
- <source src="./static/videos/shiba.mp4"
159
- type="video/mp4">
160
- </video>
161
- </div>
162
- <div class="item item-fullbody">
163
- <video poster="" id="fullbody" autoplay controls muted loop playsinline height="100%">
164
- <source src="./static/videos/fullbody.mp4"
165
- type="video/mp4">
166
- </video>
167
- </div>
168
- <div class="item item-blueshirt">
169
- <video poster="" id="blueshirt" autoplay controls muted loop playsinline height="100%">
170
- <source src="./static/videos/blueshirt.mp4"
171
- type="video/mp4">
172
- </video>
173
- </div>
174
- <div class="item item-mask">
175
- <video poster="" id="mask" autoplay controls muted loop playsinline height="100%">
176
- <source src="./static/videos/mask.mp4"
177
- type="video/mp4">
178
- </video>
179
- </div>
180
- <div class="item item-coffee">
181
- <video poster="" id="coffee" autoplay controls muted loop playsinline height="100%">
182
- <source src="./static/videos/coffee.mp4"
183
- type="video/mp4">
184
- </video>
185
- </div>
186
- <div class="item item-toby">
187
- <video poster="" id="toby" autoplay controls muted loop playsinline height="100%">
188
- <source src="./static/videos/toby2.mp4"
189
- type="video/mp4">
190
- </video>
191
- </div>
192
- </div>
193
- </div>
194
- </div>
195
- </section>
196
-
197
-
198
- <section class="section">
199
- <div class="container is-max-desktop">
200
- <!-- Abstract. -->
201
- <div class="columns is-centered has-text-centered">
202
- <div class="column is-four-fifths">
203
- <h2 class="title is-3">Abstract</h2>
204
- <div class="content has-text-justified">
205
- <p>
206
- We present the first method capable of photorealistically reconstructing a non-rigidly
207
- deforming scene using photos/videos captured casually from mobile phones.
208
- </p>
209
- <p>
210
- Our approach augments neural radiance fields
211
- (NeRF) by optimizing an
212
- additional continuous volumetric deformation field that warps each observed point into a
213
- canonical 5D NeRF.
214
- We observe that these NeRF-like deformation fields are prone to local minima, and
215
- propose a coarse-to-fine optimization method for coordinate-based models that allows for
216
- more robust optimization.
217
- By adapting principles from geometry processing and physical simulation to NeRF-like
218
- models, we propose an elastic regularization of the deformation field that further
219
- improves robustness.
220
- </p>
221
- <p>
222
- We show that <span class="dnerf">Nerfies</span> can turn casually captured selfie
223
- photos/videos into deformable NeRF
224
- models that allow for photorealistic renderings of the subject from arbitrary
225
- viewpoints, which we dub <i>"nerfies"</i>. We evaluate our method by collecting data
226
- using a
227
- rig with two mobile phones that take time-synchronized photos, yielding train/validation
228
- images of the same pose at different viewpoints. We show that our method faithfully
229
- reconstructs non-rigidly deforming scenes and reproduces unseen views with high
230
- fidelity.
231
- </p>
232
- </div>
233
- </div>
234
- </div>
235
- <!--/ Abstract. -->
236
-
237
- <!-- Paper video. -->
238
- <div class="columns is-centered has-text-centered">
239
- <div class="column is-four-fifths">
240
- <h2 class="title is-3">Video</h2>
241
- <div class="publication-video">
242
- <iframe src="https://www.youtube.com/embed/MrKrnHhk8IA?rel=0&amp;showinfo=0"
243
- frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
244
- </div>
245
- </div>
246
- </div>
247
- <!--/ Paper video. -->
248
- </div>
249
- </section>
250
-
251
-
252
- <section class="section">
253
- <div class="container is-max-desktop">
254
-
255
- <div class="columns is-centered">
256
-
257
- <!-- Visual Effects. -->
258
- <div class="column">
259
- <div class="content">
260
- <h2 class="title is-3">Visual Effects</h2>
261
- <p>
262
- Using <i>nerfies</i> you can create fun visual effects. This Dolly zoom effect
263
- would be impossible without nerfies since it would require going through a wall.
264
- </p>
265
- <video id="dollyzoom" autoplay controls muted loop playsinline height="100%">
266
- <source src="./static/videos/dollyzoom-stacked.mp4"
267
- type="video/mp4">
268
- </video>
269
- </div>
270
- </div>
271
- <!--/ Visual Effects. -->
272
-
273
- <!-- Matting. -->
274
- <div class="column">
275
- <h2 class="title is-3">Matting</h2>
276
- <div class="columns is-centered">
277
- <div class="column content">
278
- <p>
279
- As a byproduct of our method, we can also solve the matting problem by ignoring
280
- samples that fall outside of a bounding box during rendering.
281
- </p>
282
- <video id="matting-video" controls playsinline height="100%">
283
- <source src="./static/videos/matting.mp4"
284
- type="video/mp4">
285
- </video>
286
- </div>
287
-
288
- </div>
289
- </div>
290
- </div>
291
- <!--/ Matting. -->
292
-
293
- <!-- Animation. -->
294
- <div class="columns is-centered">
295
- <div class="column is-full-width">
296
- <h2 class="title is-3">Animation</h2>
297
-
298
- <!-- Interpolating. -->
299
- <h3 class="title is-4">Interpolating states</h3>
300
- <div class="content has-text-justified">
301
- <p>
302
- We can also animate the scene by interpolating the deformation latent codes of two input
303
- frames. Use the slider here to linearly interpolate between the left frame and the right
304
- frame.
305
- </p>
306
- </div>
307
- <div class="columns is-vcentered interpolation-panel">
308
- <div class="column is-3 has-text-centered">
309
- <img src="./static/images/interpolate_start.jpg"
310
- class="interpolation-image"
311
- alt="Interpolate start reference image."/>
312
- <p>Start Frame</p>
313
- </div>
314
- <div class="column interpolation-video-column">
315
- <div id="interpolation-image-wrapper">
316
- Loading...
317
- </div>
318
- <input class="slider is-fullwidth is-large is-info"
319
- id="interpolation-slider"
320
- step="1" min="0" max="100" value="0" type="range">
321
- </div>
322
- <div class="column is-3 has-text-centered">
323
- <img src="./static/images/interpolate_end.jpg"
324
- class="interpolation-image"
325
- alt="Interpolation end reference image."/>
326
- <p class="is-bold">End Frame</p>
327
- </div>
328
- </div>
329
- <br/>
330
- <!--/ Interpolating. -->
331
-
332
- <!-- Re-rendering. -->
333
- <h3 class="title is-4">Re-rendering the input video</h3>
334
- <div class="content has-text-justified">
335
- <p>
336
- Using <span class="dnerf">Nerfies</span>, you can re-render a video from a novel
337
- viewpoint such as a stabilized camera by playing back the training deformations.
338
- </p>
339
- </div>
340
- <div class="content has-text-centered">
341
- <video id="replay-video"
342
- controls
343
- muted
344
- preload
345
- playsinline
346
- width="75%">
347
- <source src="./static/videos/replay.mp4"
348
- type="video/mp4">
349
- </video>
350
- </div>
351
- <!--/ Re-rendering. -->
352
-
353
- </div>
354
- </div>
355
- <!--/ Animation. -->
356
-
357
-
358
- <!-- Concurrent Work. -->
359
- <div class="columns is-centered">
360
- <div class="column is-full-width">
361
- <h2 class="title is-3">Related Links</h2>
362
-
363
- <div class="content has-text-justified">
364
- <p>
365
- There's a lot of excellent work that was introduced around the same time as ours.
366
- </p>
367
- <p>
368
- <a href="https://arxiv.org/abs/2104.09125" target="_blank">Progressive Encoding for Neural Optimization</a> introduces an idea similar to our windowed position encoding for coarse-to-fine optimization.
369
- </p>
370
- <p>
371
- <a href="https://www.albertpumarola.com/research/D-NeRF/index.html" target="_blank">D-NeRF</a> and <a href="https://gvv.mpi-inf.mpg.de/projects/nonrigid_nerf/" target="_blank">NR-NeRF</a>
372
- both use deformation fields to model non-rigid scenes.
373
- </p>
374
- <p>
375
- Some works model videos with a NeRF by directly modulating the density, such as <a href="https://video-nerf.github.io/" target="_blank">Video-NeRF</a>, <a href="https://www.cs.cornell.edu/~zl548/NSFF/" target="_blank">NSFF</a>, and <a href="https://neural-3d-video.github.io/" target="_blank">DyNeRF</a>
376
- </p>
377
- <p>
378
- There are probably many more by the time you are reading this. Check out <a href="https://dellaert.github.io/NeRF/" target="_blank">Frank Dellart's survey on recent NeRF papers</a>, and <a href="https://github.com/yenchenlin/awesome-NeRF" target="_blank">Yen-Chen Lin's curated list of NeRF papers</a>.
379
- </p>
380
- </div>
381
- </div>
382
- </div>
383
- <!--/ Concurrent Work. -->
384
-
385
- </div>
386
- </section>
387
-
388
-
389
- <section class="section" id="BibTeX">
390
- <div class="container is-max-desktop content">
391
- <h2 class="title">BibTeX</h2>
392
- <pre><code>@article{park2021nerfies,
393
- author = {Park, Keunhong and Sinha, Utkarsh and Barron, Jonathan T. and Bouaziz, Sofien and Goldman, Dan B and Seitz, Steven M. and Martin-Brualla, Ricardo},
394
- title = {Nerfies: Deformable Neural Radiance Fields},
395
- journal = {ICCV},
396
- year = {2021},
397
- }</code></pre>
398
- </div>
399
- </section>
400
-
401
-
402
- <footer class="footer">
403
- <div class="container">
404
- <div class="content has-text-centered">
405
- <a class="icon-link" target="_blank"
406
- href="./static/videos/nerfies_paper.pdf">
407
- <i class="fas fa-file-pdf"></i>
408
- </a>
409
- <a class="icon-link" href="https://github.com/keunhong" target="_blank" class="external-link" disabled>
410
- <i class="fab fa-github"></i>
411
- </a>
412
- </div>
413
- <div class="columns is-centered">
414
- <div class="column is-8">
415
- <div class="content">
416
- <p>
417
- This website is licensed under a <a rel="license" target="_blank"
418
- href="http://creativecommons.org/licenses/by-sa/4.0/">Creative
419
- Commons Attribution-ShareAlike 4.0 International License</a>.
420
- </p>
421
- <p>
422
- This means you are free to borrow the <a target="_blank"
423
- href="https://github.com/nerfies/nerfies.github.io">source code</a> of this website,
424
- we just ask that you link back to this page in the footer.
425
- Please remember to remove the analytics code included in the header of the website which
426
- you do not want on your website.
427
- </p>
428
- </div>
429
- </div>
430
- </div>
431
- </div>
432
- </footer>
433
-
434
- </body>
435
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_server/Dockerfile ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:10-alpine
2
+
3
+ RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
4
+
5
+ WORKDIR /home/node/app
6
+
7
+ COPY package*.json ./
8
+
9
+ USER node
10
+
11
+ RUN npm install
12
+
13
+ COPY --chown=node:node . .
14
+
15
+ EXPOSE 3000
16
+
17
+ CMD [ "node", "server.js" ]
node_server/package.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "image-viewer",
3
+ "version": "1.0.0",
4
+ "description": "A simple image viewer using Node.js and Viewer.js",
5
+ "main": "server.js",
6
+ "dependencies": {
7
+ "express": "^4.17.1",
8
+ "ejs": "^3.1.6",
9
+ "got": "^14.4.5",
10
+ "viewerjs": "^1.11.7"
11
+ },
12
+ "scripts": {
13
+ "start": "node server.js"
14
+ }
15
+ }
node_server/server.js ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const express = require('express');
2
+ const http = require('http');
3
+
4
+ const app = express();
5
+ const port = 3000;
6
+
7
+ app.set('view engine', 'ejs');
8
+ app.use(express.static('views'));
9
+
10
+ app.get('/', (req, res) => {
11
+ res.render('index', {'search_input': '', 'images': {'images': []}});
12
+ });
13
+
14
+ app.get('/query', (req, res) => {
15
+ let search_input = req.query.search_input;
16
+ http
17
+ .get(`http://pclis:5000/images?search_input=` + search_input, resp => {
18
+ let data = "";
19
+
20
+ // A chunk of data has been received.
21
+ resp.on("data", chunk => {
22
+ data += chunk;
23
+ });
24
+
25
+ // The whole response has been received. Print out the result.
26
+ resp.on("end", () => {
27
+ images_json = JSON.parse(data);
28
+ res.render('index', {'search_input': search_input,
29
+ 'images': images_json});
30
+ });
31
+ })
32
+ .on("error", err => {
33
+ console.log("Error: " + err.message);
34
+ });
35
+ });
36
+
37
+ app.listen(port, () => {
38
+ console.log(`Server running at http://localhost:${port}`);
39
+ });
node_server/views/index.ejs ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
5
+ <link rel="stylesheet" href="style.css">
6
+ </head>
7
+ <body>
8
+
9
+ <h1>CLIP Image Search</h1>
10
+
11
+ <form id="form" role="search" style="margin: 1em;" action="/query">
12
+ <input type="search" id="query" name="search_input"
13
+ placeholder="Search..."
14
+ aria-label="Search through site content" value="<%= search_input %>">
15
+ <button>Search</button>
16
+ </form>
17
+
18
+ <% if (images.images.length>0) { %>
19
+ <% images.images.forEach((item) => { %>
20
+ <div class="responsive">
21
+ <div class="gallery">
22
+ <img src="<%= item %>" width="600" height="400">
23
+ </div>
24
+ </div>
25
+ <% }); %>
26
+ <% } else { %>
27
+ <p>Type a query and press Search...</p>
28
+ <% } %>
29
+
30
+ </body>
31
+ </html>
node_server/views/style.css ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ div.gallery {
2
+ border: 1px solid #ccc;
3
+ }
4
+
5
+ div.gallery:hover {
6
+ border: 1px solid #777;
7
+ }
8
+
9
+ div.gallery img {
10
+ width: 100%;
11
+ height: auto;
12
+ }
13
+
14
+ div.desc {
15
+ padding: 15px;
16
+ text-align: center;
17
+ }
18
+
19
+ * {
20
+ box-sizing: border-box;
21
+ }
22
+
23
+ .responsive {
24
+ padding: 0 6px;
25
+ float: left;
26
+ width: 24.99999%;
27
+ }
28
+
29
+ @media only screen and (max-width: 700px) {
30
+ .responsive {
31
+ width: 49.99999%;
32
+ margin: 6px 0;
33
+ }
34
+ }
35
+
36
+ @media only screen and (max-width: 500px) {
37
+ .responsive {
38
+ width: 100%;
39
+ }
40
+ }
41
+
42
+ form {
43
+ background-color: #4654e1;
44
+ width: 300px;
45
+ height: 44px;
46
+ border-radius: 5px;
47
+ display: flex;
48
+ flex-direction: row;
49
+ align-items: center;
50
+ }
51
+
52
+ input {
53
+ all: unset;
54
+ font: 16px system-ui;
55
+ color: #fff;
56
+ height: 100%;
57
+ width: 100%;
58
+ padding: 6px 10px;
59
+ }
60
+
61
+ ::placeholder {
62
+ color: #fff;
63
+ opacity: 0.7;
64
+ }
python_clip_image_search/Dockerfile ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Python runtime as the base image
2
+ FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime
3
+
4
+ # It is necessary to install git to run the pip install -r requirements.txt
5
+ RUN apt-get update && apt-get install -y git
6
+
7
+ RUN useradd -m -u 1000 user
8
+ USER user
9
+ ENV HOME=/home/user \
10
+ PATH=/home/user/.local/bin:$PATH
11
+
12
+ # Set the working directory in the container
13
+ WORKDIR $HOME/app
14
+
15
+ # Copy the current directory contents into the container at /app
16
+ COPY --chown=user . $HOME/app
17
+
18
+ RUN pip install -r requirements.txt
19
+
20
+ # FROM base AS test
21
+ # CMD ["python", "-m", "pdb", "test_cli_search_engine.py"]
22
+ # FROM base AS run
23
+ # COPY . .
24
+ # CMD ["python", "app.py"]
25
+
26
+ COPY . .
27
+
28
+ EXPOSE 5000
29
+
30
+ CMD ["python", "server.py"]
python_clip_image_search/config.cfg ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ [SERVER]
2
+ host_ip_address = 0.0.0.0
3
+ port_number = 7860
4
+
5
+ [SEARCH_ENGINE]
6
+ image_root_dir = ./dataset
7
+ csv_file_path = ./image_features.csv
python_clip_image_search/dataset/000000000139.jpg ADDED
python_clip_image_search/dataset/000000000285.jpg ADDED
python_clip_image_search/dataset/000000000632.jpg ADDED
python_clip_image_search/dataset/000000000724.jpg ADDED
python_clip_image_search/dataset/000000000776.jpg ADDED
python_clip_image_search/dataset/000000000785.jpg ADDED
python_clip_image_search/dataset/000000000802.jpg ADDED
python_clip_image_search/dataset/000000000872.jpg ADDED
python_clip_image_search/dataset/000000000885.jpg ADDED
python_clip_image_search/dataset/000000001000.jpg ADDED
python_clip_image_search/dataset/000000001268.jpg ADDED
python_clip_image_search/dataset/000000001296.jpg ADDED
python_clip_image_search/dataset/000000001353.jpg ADDED
python_clip_image_search/dataset/000000001425.jpg ADDED
python_clip_image_search/dataset/000000001490.jpg ADDED
python_clip_image_search/dataset/000000001503.jpg ADDED
python_clip_image_search/dataset/000000001532.jpg ADDED
python_clip_image_search/dataset/000000001584.jpg ADDED
python_clip_image_search/dataset/000000001675.jpg ADDED
python_clip_image_search/dataset/000000001761.jpg ADDED
python_clip_image_search/dataset/000000001818.jpg ADDED
python_clip_image_search/dataset/000000001993.jpg ADDED
python_clip_image_search/dataset/000000002006.jpg ADDED
python_clip_image_search/dataset/000000002149.jpg ADDED
python_clip_image_search/dataset/000000002153.jpg ADDED
python_clip_image_search/dataset/000000002157.jpg ADDED
python_clip_image_search/dataset/000000002261.jpg ADDED
python_clip_image_search/dataset/000000002299.jpg ADDED
python_clip_image_search/dataset/000000002431.jpg ADDED
python_clip_image_search/dataset/000000002473.jpg ADDED
python_clip_image_search/dataset/000000002532.jpg ADDED
python_clip_image_search/dataset/000000002587.jpg ADDED
python_clip_image_search/dataset/000000002592.jpg ADDED
python_clip_image_search/dataset/000000002685.jpg ADDED
python_clip_image_search/dataset/000000002923.jpg ADDED
python_clip_image_search/dataset/000000003156.jpg ADDED
python_clip_image_search/dataset/000000003255.jpg ADDED
python_clip_image_search/dataset/000000003501.jpg ADDED
python_clip_image_search/dataset/000000003553.jpg ADDED
python_clip_image_search/dataset/000000003661.jpg ADDED