Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

167 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bus Stop Reinforcement Learning

This project uses a Proximal Policy Optimization (PPO) algorithm to seek out bus stops on Google Street View. It uses a YOLO computer vision model to score the outcomes resulting from the choices made by the PPO agent.

Setup

  1. Install required packages:
  • Stable Baselines (for PPO algorithm)
  • Ultralytics (for YOLO model)
  • Flask (for serving images)
  1. Setup Street View API:
  1. Setup a JSON/CSV file of stops:
  • All stops must have "longitude," "latitude" and "name" attributes. The "name" value is used for logging purposes and can be any value.
  1. (Optional) Configure Flask server to watch the model in action:
  • In settings.py, change run_server to True.
  • Increase wait_time in settings to add some buffer time between steps. Otherwise, the program might get hung up while trying to save images.
  • In the 'main' block of run.py, specify a port in the start_server() method call, or leave as 5000
  • After starting the program, navigate to localhost:{your port here} in a browser

Training

Navigate to the 'main' block in run.py (located at the end of the file). Use the train() method, specifying a path to save the model in, a csv or json file of bus stops, and, if resuming training, an existing model.

Stop Loading

To prevent the task of finding stops from being too simple, I wrote logic to "scramble" stops. After pulling up a new stop, the YOLO model is run to asses if a sign or shelter is within sight. If a shelter or sign is detected with a confidence value of at least S.min_score_to_scramble (specified in settings.py), the program will move in a random direction and pick a new camera angle. This process repeats recursively up to three times until the stop is no longer in view.

About

Using a PPO algorithm to find bus stops via the Street View API

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages