项目作者: isaac-chung

项目描述 :
A web app that help users pick their next insta-vacation destinations.
高级语言: Jupyter Notebook
项目地址: git://github.com/isaac-chung/nextpick.git
创建时间: 2020-05-27T15:55:25Z
项目社区:https://github.com/isaac-chung/nextpick

开源协议:MIT License

下载


License: MIT

Python 3.8
Website shields.io

NextPick

Pick your next insta-vacation

Website: nextpick.live

Presentation: Slides




What is NextPick?

There is an increasing portion of travellers saying that they use social media for planning their next trip, giving
a rise to the trend of social media-inspired tourism in recent years. These social media-inspired travellers tend
to go on “insta-holidays” (picturesque places), and “mini-vacations” (short duration). Closer-by locations are also
favoured for travel time considerations. Combining the above creates the need for media and proximity driven searches
for travel locations.

NextPick is my vision for addressing this need. It is a tool that recommends vacation spots based on an input image.
Similar images, along with their locations, are returned based on cosine similarity between the images and geo-proximity
to the user.

NextPick uses pre-trained deep learning models on the places365 dataset
to generate image feature embeddings. These embeddings are compared to geo-tagged images from
Flickr. Based on the image similarities and user-defined preferences, the top 5 locations
are provided.

How to use NextPick

The landing page allows the user to choose an image, enter their current
location, and select a proximity preference.
app

app

After an image is selected and the ‘Go’ button is clicked, the selected image
and the entered location are shown.
app

This is followed by 5 images, along with their cosine difference to the input image and the distance to the
current location. Clicking the address would lead to a Google search of the address.
app
app

And finally, the locations of those images are visualized on a map. Labels for each
data point is shown on hover. The red dot is the user’s entered location.
app

The purple dots are recommended locations.
app

The user can zoom in and out of the Plotly map.
app

Local setup

To run a local copy of NextPick, clone the master branch of the repository with

  1. git clone https://github.com/isaac-chung/insight.git

Then, create a virtual environment and have all the dependencies in requirements.txt installed. With Anaconda3,
we can use the following to create one called insight with Python 3.8 and all packages installed.

  1. conda create -n insight python=3.8
  2. source activate insight
  3. pip install -r requirements.txt

I am currently keeping the image data on this repository.
Once it’s downloaded, place the folder at the root level of the insight project folder, and rename it as data.
If this link is broken, you can follow
this Jupyter notebook
to retrieve your own geotagged imaged data using the Flickr API.

Also, in config.py, change the variable APP_PATH to the path of the app folder.

The app can be run locally using

  1. python server.py

Navigate via your web browser to http://127.0.0.1:5000/. This version of the app is tested on Windows 10 and Ubuntu
18.04 (WSL).

Unit Tests

NextPick comes with a few unit tests, which can be extended in a later time. To run these tests, first modify line 16
image_search.py from import NextPick.config as cfg to import config as cfg. Then navigate to the first NextPick
directory (nextpick/NextPick-app/NextPick), and type the following in the command line:

  1. python -m unittest discover -p '*_test.py'

Directory Files

  1. |-- NextPick-app
  2. (Holds the standalone web app)
  3. |-- NextPick
  4. |-- (where 'data' should be)
  5. |-- NextPick
  6. (folder for image processing, search, visualization functions)
  7. |-- image_search.py
  8. |-- ImageDataset.py
  9. |-- plotly_map.py
  10. |-- static
  11. (asset folder for the web app)
  12. |-- templates
  13. (html templates folder for the web app)
  14. |-- test
  15. (unit tests folder)
  16. |-- config.py
  17. |-- requirements.txt
  18. |-- server.py
  19. |-- setup.py
  20. |-- run.py
  21. |-- notebooks
  22. (notebooks folder for data acquisition and exploratory data analyses)
  23. |-- places365
  24. (asset folder from the places365 repo)
  25. |-- scripts
  26. (misc scripts)
  27. |-- static_img
  28. (image folder for README.md)

What’s next?

While it is true that there are small adjustments that can be made to the web app, a logical next step for this
project is to dockerize the app. Docker enables developers to easily pack, ship, and run any application as a
lightweight, portable, self-sufficient container, which can run virtually anywhere
(ZDNet). Docker containers are also
easy to deploy in a cloud.

Installing Docker

To get Docker running at the time of writing this on my Windows 10 Home machine, version 1909 (OS Build 18363.1082),
I followed these steps. I also
read this issue when setting the WSL version to 2, and
this issue when starting up Docker Quickstart.