Giter Site home page Giter Site logo

surya501 / loc2vec Goto Github PK

View Code? Open in Web Editor NEW
52.0 4.0 12.0 179.65 MB

Pytorch implementation of the Loc2Vec with some modifications for speed

Python 85.75% Shell 4.36% Dockerfile 6.37% Makefile 0.85% HTML 2.68%
loc2vec semi-supervised pytorch-implementation

loc2vec's Introduction

Loc2Vec Pytorch Mixed Precision Implementation

This project is inspired by this excellent blogpost: https://www.sentiance.com/2018/05/03/venue-mapping/

Read my blog post for implementation details and choices made

Note: This implementation requires FP16 support. If your GPU does not have that, just disable it with amp.init(enable=False) in trainer.py. You might also have to change the batch size in config.py.

How to generate tiles from openstreetmap data

Elaborate instructions are provided in the Readme file.

Alternatively, you can blindly use load.sh file after changing the path to the pbf file to create the file server. lat2tile.py has a quick utility function to generate all the tiles for the US-west region. You can generate a list of urls using the following. Once you have the following and download the tiles.

# download the us-west-latest.osm.pbf and change the path in load.sh
sh load.sh
python lat2tile.py > urls.txt

# start the server
docker run -p 80:80 -v openstreetmap-data:/var/lib/postgresql/10/main -d overv/openstreetmap-tile-server run
cat urls.txt | xargs -P 10 -n 1 wget -nH -nc -x

Environment setup (for pytorch and amp) and start training

conda env create -f  environment.yml
conda activate loc2vec
git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" .
cd ..
python loc2vec

Credits

Wanna Help?

First thanks! Below are a few things to implement. If you are a GIS expert, we can brainstorm a few ideas for collaboration. Open a issue and we can discuss there.

TODO:

  • Profile and remove CPU bottleneck
  • Add a conda environment file to make it self contained
  • Add ability to suspend and resume from training
  • Ability to save checkpoint even mid-epoch based on number of hard triplets
  • Add support for Fast.ai, esp Stocastic weight averaging & One cycle learning

Results

PCA

PCA

TSNE

TSNE

Nearest Neighbors (first column is the query image)

PCA

Interpolation in Embedding Space

TSNE

loc2vec's People

Contributors

surya501 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

loc2vec's Issues

It is difficult to generate the data.

According to your steps,I achieve all.There is no error during running the program that is used to generate the data,but I just cannot access the url.Just like this:
A8{_TN_F6%0{Z3)) R3RB I have difficulty generating this data,could you please upload it?Thank you!

About importing apex and the basic environment

Hi, Suresh, I'm really appreciated to this implementation. But I'm stuck in the beginning.
I'm trying to run your code but got this error when I'm running trainer.py.

  • from apex import amp (importt apex also didn't work).
    TypeError: Class advice impossible in Python3. Use the @Implementer class decorator instead.

I'm using python3.7 and similar issues about apex importing reported online are on the 3.5 online.
Thus, I want to confirm with you the environment you used in the project/ if it's possible to share a conda yml file for this project.
Best wishes.
Elliot

Apex

I'm running this project on Ubuntu vm.
Since the error:

Torch did not find available GPU on this system. If your intention is to cross-compile this is no an error.

Thus I commented the three with apex:
But the following error occur:

Segmentation fault (core dumped
Look into the code, the first Epoch stoped here:
outputs = model(data) in > trainer.py > .train_epoch()

I'm using the data of London instead of West US. The generation and read of tiles seems normal.
Could you please have a look if the issue is related to the apex.

Memory Issue

RuntimeError: CUDA out of memory. Tried to allocate 400.00 MiB (GPU 0; 15.90 GiB total capacity; 14.86 GiB already allocated; 335.88 MiB free; 69.75 MiB cached)

I'm trying train my own tile(without apex). But training seems very memory cosuming. Is that seem every batch is 400 Mb and finally cause cuda out of memory. ( I was thinking all the training data(about 400mb) being loaded into GPU ATM.

Do you have any idea about why the problem is happening.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.