Connecting Python + Tensorflow to an Emulator in C++

355 views Asked by At

I am trying to do deep reinforcement learning on the GameBoy platform, similar to what Google DeepMind has done on the Atari platform (https://deepmind.com/research/dqn/). For this purpose, I found a GameBoy Emulator in C++, and I want to do the reinforcement learning parts using the Python TensorFlow API. The system needs to do at least the following:

  • Send the current video frame from the Emulator to the Neural Network (NN) constructed using the TensorFlow API
  • Using the NN predict what action the agent should make (which key it should press)
  • Send this key press back to the emulator
  • Get back from the emulator the new game score
  • Retrain the NN

My questions is how should I do this communication between the emulator written in C++ and the bits doing reinforcement learning using Python plus TensorFlow?

So far I have considered the following options:

1) Use the C++ TensorFlow API. However, from my understanding this can only run already constructed graphs, so it would be rather cumbersome to construct the graph in Python then run it using the C++ API. Furthermore the documentation for the C++ API is not very good.

2) Do some kind of OS piping between the C++ and Python parts.

3) Embed Python into C++ like this: https://docs.python.org/3.3/extending/embedding.html

Which of these would be the best way to do it? Are there other options I haven't considered?

0

There are 0 answers