Git Product home page Git Product logo

two-stage-gan-in-trajectory-generation's Introduction

Large Scale GPS Trajectory Generation Using Map based on Two-stage-GAN

Python impletement of paper Large Scale GPS Trajectory Generation Using Map based on Two-stage-GAN (Link)

Introduction

we propose a map-based Two-Stage GAN method (TSG) to generate fine-grained and plausible large-scale trajectories. In the first stage, we first transfer GPS points data to discrete grid representation as the input for a modified deep convolutional generative adversarial network to learn the general pattern. In the second stage, inside each grid, we design an effective encoder-decoder network as the generator to extract road information from map image and then embed it into two parallel Long Short-Term Memory networks to generate GPS point sequence.

Result

We evaluate the synthetic trajectories in terms of their similarity to real data, i.e., distribution of overall GPS coordinate, distribution of trajectory sequences length, distribution of trajectory distance, top-N visited places and road networks matching accuracy. And we compare our result with the previous benchmark.

JS distance of distribution

Model $p_o(r)$ $p_s(l)$ $p_d(l)$
FTS-IP 0.413 0.182 0.187
LSTM 0.633 0.058 0.140
TSG 0.100 0.139 0.136

Visualization of road network matching

Train

Dataset

Trajectory data in Porto, available on Kaggle

Prepare the data

  1. Transform trajectory data into grids format pre_process/process_trajectory_data/to_grid.py

  2. Prepare the corresponding map images:

    • go to pre_process/map_generation/

    • run screen_shot.py

    • run cut.py

    • run merge.py

First stage GAN

  1. go to First_stage_gan/.

  2. run:

python WGANGP.py \
--dataroot ./grid32/ \
--labelroot ./traj_all_0115.txt \
--outf ./output \
--batchSize 64 \
--n_critic 1 \
--netG ./output_IN/netG_epoch_320.pth \
--netD ./output_IN/netD_epoch_320.pth \
--cuda \
--start_iter 320 \
--niter 350

Second stage GAN

  1. go to Second_stage_gan.

  2. run python train.py.

Generate trajectory data

  1. Coarse result generated from First stage GAN
cd First_stage_gan
python generate_fake_data.py --large_num 200 --model_path ./output_IN/netG_epoch_260.pth --output_path ../output_generated_coarse
  1. Final result TSG/pred.py

    Configurations

    • step_1_output path to the result of first stage GAN
    • map_dir path to the map data
    • checkpoint model result of second stage GAN

Citation

@article{wang2021,
    author = {Xingrui Wang and Xinyu Liu and Ziteng Lu and Hanfang Yang},
    title = {Large Scale GPS Trajectory Generation Using Map Based on Two Stage GAN},
    journal = {Journal of Data Science},
    volume = {19},
    number = {1},
    year = {2021},
    pages = {126-141},
    doi = {10.6339/21-JDS1004},
    issn = {1680-743X},
    publisher = {School of Statistics, Renmin University of China}
}

two-stage-gan-in-trajectory-generation's People

Contributors

xingruiwang 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

Watchers

 avatar  avatar

two-stage-gan-in-trajectory-generation's Issues

question

Can you provide the data style of the data set after processing,for tj = np.load('./data/9.npy', allow_pickle=True)
pre_process\process_trajectory_data\to_grid.py the lat and lon variables are undefined and are min_ Lat and min_ Lon
for i in t1:
a = int((float(i[1])-lat)//d) # lat
b = int((float(i[0])-lon)//d) # lon
t2.append([a, b, i[2]])

File / File Preprocessing Missing

Dear authors,

When running pre_process/process_trajectory_data/to_grid.py is looking for the file ./data/9.npy and something similar happens with generate_traj_plot.py . Would it be possible to have a script/specs on how to transform the trajectories in the npy files and in which path we should save them?

Thanks in advance

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.