1
\$\begingroup\$

I am trying to implement a deep reinforcement learning IA with TensorFlow for a checker game in Unity. How can I do this?

I've searched for it on Google and found a lot of videos and tutorials on how to use machine learning agents with Unity, and other people who explain how to import a TensorFlow trained neural network in Unity, but I didn't see anything related to using directly TensorFlow in Unity to create (and train) neural networks.

If someone knows another package to create CNNs with C#, I am interested.

\$\endgroup\$
  • 1
    \$\begingroup\$ Presumably you tried searching "tensorflow unity" and found the same wealth of guides and sample projects I did, right on the first page of results. Please tell us about the progress you've made so far based on the research you've done, and describe in detail the specific step where you're currently stuck. \$\endgroup\$ – DMGregory Oct 10 '19 at 16:26
  • \$\begingroup\$ So I've searched it on google and found a lot of videos and tutorials on how to use ml-agents with unity, and other people who explain how to import a tensorflow trained neural network in unity, but I didn't see anything related to using directly TensorFlow in unity to create neural networks. \$\endgroup\$ – Bben01 Oct 10 '19 at 16:31
  • 1
    \$\begingroup\$ That's already more detail than was present in your question. Edit it to explain that issue more fully. Presumably you've read up on how to use TensorFlow from a C# script, and tried applying this to use its capabilities from within your Unity scripts? Where specifically did you run into a problem that you need targeted Q&A to solve? \$\endgroup\$ – DMGregory Oct 10 '19 at 16:36
  • \$\begingroup\$ I know how to create and train a neural network with TensorFlow (with python) but never experienced it on unity. I will read more on the link you gave, but from what I saw, this is mostly "how to train and python and then implement your neural network in c#" \$\endgroup\$ – Bben01 Oct 10 '19 at 16:54
  • 1
    \$\begingroup\$ So you tried using a C# wrapper to do the same thing you did in Python? Where specifically did you run into trouble doing that? Show us what you've tried and tell us specifically what's not working the way you want. \$\endgroup\$ – DMGregory Oct 10 '19 at 16:56
1
\$\begingroup\$

every application works with data. both unity and tensorflow work with data.

tensorflow is just a machine learning library that basically is made for python language. you dont need to find a wrapper to let you work with tensorflow but i think there is some.

assume you need neural network as supervised learning system to teach you agent to move to right direction.

you can simply generate some data in unity that can be used in tensorflow and python and you can generate or convert data to some thing that can be read by unity.

one good example: you want to teach the car to drive automatically that is teached by player.

direction of car and angles with road is the input and buttons that player pushes are output. you can save this in unity a table like excel mysql or...

you feed the neural network with this data and get weights of learned neural network. now you can generate you NN algorithm that drives the car.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thank you for your answer. But in my case I want the neural network to be able to play with itself and not with a generated dataset (unsupervised learning), so how could the python script use information from the game? \$\endgroup\$ – Bben01 Oct 11 '19 at 11:14
  • 1
    \$\begingroup\$ @Bben01 so you need something like reinforcement learning. the answer can still be the same. you can put some database in the middle but i think unity ml-agents is what you want blog.goodaudience.com/… \$\endgroup\$ – virtouso Oct 11 '19 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.