C#でTensorFlowを動かす。
C#でTensorFlowのCNNを動かす。
Unity上でTensorFlowのCNNを動かす。
- To set up the development environment and build TensorFlowSharp, please refer to the following.
- Create a CNN model
- Create a project with unity
https://github.com/migueldeicaza/TensorFlowSharp
Link of dll file
https://github.com/migueldeicaza/TensorFlowSharp#working-on-tensorflowsharp
Reference: Install MonoDevelop preview via FlatPak
$ sudo add-apt-repository ppa:alexlarsson/flatpak
$ sudo apt update
$ sudo apt install flatpak
$ flatpak install --user --from https://download.mono-project.com/repo/monodevelop.flatpakref
# Check if it can be started
$ flatpak run com.xamarin.MonoDevelop
Reference1 : LD_LIBRARY_PATH を設定しても反映されないことがある
Reference2 : Interop with Native Libraries
$ cd Downloads
$ wget https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.1.0.tar.gz
$ cd /usr/local
$ sudo tar xzvf ~/Downloads/libtensorflow-cpu-linux-x86_64-1.1.0.tar.gz
#Configuration a path
$ cd /etc/ld.so.conf.d
$ sudo vim lib_path.conf
#Save the string below(A directory with Libtensorflow.so)
/usr/local/lib
#Rebuild /etc/ld.so.cache
$ sudo ldconfig
$ ldconfig -p > ~/out.txt
#Check if the library has been added
$ find ~/ -type f -name "out.txt" | xargs grep 'libtensorflow.so'
Open the solution (.sin) right under the clone (or download) directory with MonoDevelop.
Next, rebuild the solution with Build -> Rebuild All.
I move SampleTest. Select SampleTest and press Build Project.
Start the executable file on the console.
$ sudo apt-get install mono-complete
$ cd ~/workspace/c_sharp/TensorFlowSharp/SampleTest/bin/Debug
$ mono SampleTest.exe
[Additional notes]
Reference:Nuget and “Unable to load the service index”
I got an error as below. (on 7.29 2017)
[nuget.org] Unable to load the service index for source https://api.nuget.org/v3/index.json. An error occurred while sending the request
Error: SecureChannelFailure (Object reference not set an instance of an object) Object reference not set to an instance of an object
How to deal
run command below from terminal.
export MONO_TLS_PROVIDER=legacy
So the build will pass.
macOS Sierra 10.12.6
Visual Studio 7.0.1 (build 24)
unity 2017.1.0f3
download and install the installer from the below link
https://www.visualstudio.com/vs/visual-studio-mac/
$ cd ~/Downloads
$ curl -O https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-1.1.0.tar.gz
$ cd /usr/local
$ sudo tar zxvf ~/Downloads/libtensorflow-cpu-darwin-x86_64-1.1.0.tar.gz
$ cd lib
$ sudo mv libtensorflow.so libtensorflow.dylib
#Check if the library has been added
$ find /usr/local/ -type f -name "libtensorflow.dylib"
Open the solution (.sin) right under the clone (or download) directory with VisualStudio.
Next, rebuild the solution with Build -> Rebuild All.
Microsoft Visual Studio Community 2017
Version 15.2 (26430.16) Releasec
Microsoft .NET Framework
Version 4.6.01586
download dll file from the below link
https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-1.2.0-rc0.zip
After expansion, rename from tensorflow.dll to libtensorflow.dll and move in C:\Windows\System32.
download and install the installer from the below link.
https://www.visualstudio.com/downloads/
Follow the instructions to install the tool.
Open the solution (.sin) right under the clone (or download) directory with VisualStudio.
Next, rebuild the solution with Build -> Rebuild All.