├── .gitattributes ├── DeepLearningToolsForUnity ├── .gitignore ├── Assets │ ├── CNTKTest.unity │ ├── CNTKTest.unity.meta │ ├── Materials.meta │ ├── Materials │ │ ├── MatTest 1.mat │ │ ├── MatTest 1.mat.meta │ │ ├── MatTest 2.mat │ │ ├── MatTest 2.mat.meta │ │ ├── MatTest.mat │ │ └── MatTest.mat.meta │ ├── Scripts.meta │ ├── Scripts │ │ ├── CNTKExamples.meta │ │ ├── CNTKExamples │ │ │ ├── CSTrainingCPUOnlyExamples.meta │ │ │ ├── CSTrainingCPUOnlyExamples │ │ │ │ ├── App.config │ │ │ │ ├── App.config.meta │ │ │ │ ├── CSTrainingCPUOnlyExamples.csproj.meta │ │ │ │ ├── Program.cs │ │ │ │ ├── Program.cs.meta │ │ │ │ ├── Properties.meta │ │ │ │ ├── Properties │ │ │ │ │ ├── AssemblyInfo.cs │ │ │ │ │ └── AssemblyInfo.cs.meta │ │ │ │ ├── obj.meta │ │ │ │ ├── obj │ │ │ │ │ ├── x64.meta │ │ │ │ │ └── x64 │ │ │ │ │ │ ├── Debug.meta │ │ │ │ │ │ └── Debug │ │ │ │ │ │ └── TempPE.meta │ │ │ │ ├── packages.config │ │ │ │ └── packages.config.meta │ │ │ ├── Common.meta │ │ │ ├── Common │ │ │ │ ├── CifarResNetClassifier.cs │ │ │ │ ├── CifarResNetClassifier.cs.meta │ │ │ │ ├── LSTMSequenceClassifier.cs │ │ │ │ ├── LSTMSequenceClassifier.cs.meta │ │ │ │ ├── LogisticRegression.cs │ │ │ │ ├── LogisticRegression.cs.meta │ │ │ │ ├── MNISTClassifier.cs │ │ │ │ ├── MNISTClassifier.cs.meta │ │ │ │ ├── TestHelper.cs │ │ │ │ ├── TestHelper.cs.meta │ │ │ │ ├── TransferLearning.cs │ │ │ │ └── TransferLearning.cs.meta │ │ │ ├── ImageExtension.meta │ │ │ └── ImageExtension │ │ │ │ ├── CNTKImageProcessing.cs │ │ │ │ └── CNTKImageProcessing.cs.meta │ │ ├── TFSharpUtilities.meta │ │ └── TFSharpUtilities │ │ │ ├── TFSharpUtils.cs │ │ │ └── TFSharpUtils.cs.meta │ ├── Textures.meta │ ├── Textures │ │ ├── 23466317216_b99485ba14_o-panorama.jpg │ │ ├── 23466317216_b99485ba14_o-panorama.jpg.meta │ │ ├── 74432.jpg │ │ ├── 74432.jpg.meta │ │ ├── FFFFFF.png.png │ │ ├── FFFFFF.png.png.meta │ │ ├── depositphotos_107136762-stock-photo-white-noise-gritty-sandy-grunge.jpg │ │ ├── depositphotos_107136762-stock-photo-white-noise-gritty-sandy-grunge.jpg.meta │ │ ├── flower.jpg │ │ ├── flower.jpg.meta │ │ ├── free-wallpaper-11.jpg │ │ ├── free-wallpaper-11.jpg.meta │ │ ├── free-wallpaper-17.jpg │ │ ├── free-wallpaper-17.jpg.meta │ │ ├── free-wallpaper-18.jpg │ │ ├── free-wallpaper-18.jpg.meta │ │ ├── grass_leaves_0046_01_preview.jpg │ │ ├── grass_leaves_0046_01_preview.jpg.meta │ │ ├── image.png │ │ ├── image.png.meta │ │ ├── image4.png │ │ ├── image4.png.meta │ │ ├── mountains-4.jpg │ │ ├── mountains-4.jpg.meta │ │ ├── test.png │ │ ├── test.png.meta │ │ ├── test2.png │ │ ├── test2.png.meta │ │ ├── water.jpg │ │ └── water.jpg.meta │ ├── UnityCNTK.meta │ └── UnityCNTK │ │ ├── Common.meta │ │ ├── Common │ │ ├── CNTKUnityExtensionMethods.cs │ │ ├── CNTKUnityExtensionMethods.cs.meta │ │ ├── DataBuffer.cs │ │ ├── DataBuffer.cs.meta │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── EditorUtils.cs │ │ │ ├── EditorUtils.cs.meta │ │ │ ├── UsefulLayouts.cs │ │ │ └── UsefulLayouts.cs.meta │ │ ├── Images.WCT.cs │ │ ├── Images.WCT.cs.meta │ │ ├── Images.cs │ │ ├── Images.cs.meta │ │ ├── LayerDefinitions.Activation.cs │ │ ├── LayerDefinitions.Activation.cs.meta │ │ ├── LayerDefinitions.Helper.cs │ │ ├── LayerDefinitions.Helper.cs.meta │ │ ├── LayerDefinitions.cs │ │ ├── LayerDefinitions.cs.meta │ │ ├── Layers.cs │ │ ├── Layers.cs.meta │ │ ├── SequentialNetworks.cs │ │ ├── SequentialNetworks.cs.meta │ │ ├── Trainers.cs │ │ ├── Trainers.cs.meta │ │ ├── Utils.cs │ │ └── Utils.cs.meta │ │ ├── Dependencies.meta │ │ ├── Dependencies │ │ ├── SerializableDictionary.meta │ │ └── SerializableDictionary │ │ │ ├── Editor.meta │ │ │ ├── Editor │ │ │ ├── SerializableDictionaryPropertyDrawer.cs │ │ │ └── SerializableDictionaryPropertyDrawer.cs.meta │ │ │ ├── Example.meta │ │ │ ├── Example │ │ │ ├── Editor.meta │ │ │ ├── Editor │ │ │ │ ├── UserSerializableDictionaryPropertyDrawers.cs │ │ │ │ └── UserSerializableDictionaryPropertyDrawers.cs.meta │ │ │ ├── SerializableDicitonary Example.unity │ │ │ ├── SerializableDicitonary Example.unity.meta │ │ │ ├── SerializableDictionaryExample.cs │ │ │ ├── SerializableDictionaryExample.cs.meta │ │ │ ├── UserSerializableDictionaries.cs │ │ │ └── UserSerializableDictionaries.cs.meta │ │ │ ├── SerializableDictionary.cs │ │ │ ├── SerializableDictionary.cs.meta │ │ │ ├── SerializableDictionary.pdf │ │ │ └── SerializableDictionary.pdf.meta │ │ ├── Tools.meta │ │ └── Tools │ │ ├── CommonNNs.meta │ │ ├── CommonNNs │ │ ├── Examples.meta │ │ ├── Examples │ │ │ ├── CNTKGANTest.unity │ │ │ ├── CNTKGANTest.unity.meta │ │ │ ├── CNTKNetworkBuildTest.unity │ │ │ ├── CNTKNetworkBuildTest.unity.meta │ │ │ ├── DataPlane2D.cs │ │ │ ├── DataPlane2D.cs.meta │ │ │ ├── DataPlane2DInput.cs │ │ │ ├── DataPlane2DInput.cs.meta │ │ │ ├── TestGANTrain2D.cs │ │ │ ├── TestGANTrain2D.cs.meta │ │ │ ├── TestSeqNNTrain2D.cs │ │ │ └── TestSeqNNTrain2D.cs.meta │ │ ├── GAN.Dense.cs │ │ ├── GAN.Dense.cs.meta │ │ ├── Trainers.GAN.cs │ │ └── Trainers.GAN.cs.meta │ │ ├── ReinforcementLearning.meta │ │ ├── ReinforcementLearning │ │ ├── DQL.meta │ │ ├── DQL │ │ │ ├── DQLModel.cs │ │ │ ├── DQLModel.cs.meta │ │ │ ├── QNetworks.cs │ │ │ ├── QNetworks.cs.meta │ │ │ ├── Trainers.DQL.cs │ │ │ └── Trainers.DQL.cs.meta │ │ ├── Examples.meta │ │ ├── Examples │ │ │ ├── 3DBall.meta │ │ │ ├── 3DBall │ │ │ │ ├── Materials.meta │ │ │ │ ├── Materials │ │ │ │ │ ├── ball.mat │ │ │ │ │ ├── ball.mat.meta │ │ │ │ │ ├── logo 1.mat │ │ │ │ │ ├── logo 1.mat.meta │ │ │ │ │ ├── logo.mat │ │ │ │ │ ├── logo.mat.meta │ │ │ │ │ ├── logo.png │ │ │ │ │ └── logo.png.meta │ │ │ │ ├── Prefabs.meta │ │ │ │ ├── Prefabs │ │ │ │ │ ├── Game.prefab │ │ │ │ │ └── Game.prefab.meta │ │ │ │ ├── Scene.unity │ │ │ │ ├── Scene.unity.meta │ │ │ │ ├── Scripts.meta │ │ │ │ └── Scripts │ │ │ │ │ ├── Ball3DEnviroment.cs │ │ │ │ │ ├── Ball3DEnviroment.cs.meta │ │ │ │ │ ├── Ball3DRunner.cs │ │ │ │ │ └── Ball3DRunner.cs.meta │ │ │ ├── Maze.meta │ │ │ ├── Maze │ │ │ │ ├── MazeBlock.prefab │ │ │ │ ├── MazeBlock.prefab.meta │ │ │ │ ├── MazeDQLRunner.cs │ │ │ │ ├── MazeDQLRunner.cs.meta │ │ │ │ ├── MazeEnvironment.cs │ │ │ │ ├── MazeEnvironment.cs.meta │ │ │ │ ├── MazeGame.unity │ │ │ │ ├── MazeGame.unity.meta │ │ │ │ ├── MazeViewer.cs │ │ │ │ └── MazeViewer.cs.meta │ │ │ ├── Pole.meta │ │ │ ├── Pole │ │ │ │ ├── PoleDQLRunner.cs │ │ │ │ ├── PoleDQLRunner.cs.meta │ │ │ │ ├── PoleGameEnviroment.cs │ │ │ │ ├── PoleGameEnviroment.cs.meta │ │ │ │ ├── PoleRunner.cs │ │ │ │ ├── PoleRunner.cs.meta │ │ │ │ ├── Scene.unity │ │ │ │ ├── Scene.unity.meta │ │ │ │ ├── Square.png │ │ │ │ └── Square.png.meta │ │ │ ├── Pong.meta │ │ │ └── Pong │ │ │ │ ├── PongDQLRunner.cs │ │ │ │ ├── PongDQLRunner.cs.meta │ │ │ │ ├── PongEnvironment.cs │ │ │ │ ├── PongEnvironment.cs.meta │ │ │ │ ├── PongGameGraphic.cs │ │ │ │ ├── PongGameGraphic.cs.meta │ │ │ │ ├── PongPPORunner.cs │ │ │ │ ├── PongPPORunner.cs.meta │ │ │ │ ├── Prefabs.meta │ │ │ │ ├── Prefabs │ │ │ │ ├── Ball.prefab │ │ │ │ ├── Ball.prefab.meta │ │ │ │ ├── Racket.prefab │ │ │ │ ├── Racket.prefab.meta │ │ │ │ ├── ShowInfoPong.prefab │ │ │ │ ├── ShowInfoPong.prefab.meta │ │ │ │ ├── Wall.prefab │ │ │ │ └── Wall.prefab.meta │ │ │ │ ├── Scene.unity │ │ │ │ ├── Scene.unity.meta │ │ │ │ ├── ShowInfoPong.cs │ │ │ │ └── ShowInfoPong.cs.meta │ │ ├── PPO.meta │ │ └── PPO │ │ │ ├── PPOModel.cs │ │ │ ├── PPOModel.cs.meta │ │ │ ├── PPONetworks.cs │ │ │ ├── PPONetworks.cs.meta │ │ │ ├── Trainers.PPO.cs │ │ │ ├── Trainers.PPO.cs.meta │ │ │ ├── readme.md │ │ │ └── readme.md.meta │ │ ├── UniversalStyleTransfer.meta │ │ └── UniversalStyleTransfer │ │ ├── Data.meta │ │ ├── Data │ │ ├── UST_combined.bytes │ │ └── UST_combined.bytes.meta │ │ ├── Editor.meta │ │ ├── Editor │ │ ├── StyleTransferBatchInspector.cs │ │ ├── StyleTransferBatchInspector.cs.meta │ │ ├── StyleTransferBatchWindow.cs │ │ ├── StyleTransferBatchWindow.cs.meta │ │ ├── StyleTransferWindow.cs │ │ └── StyleTransferWindow.cs.meta │ │ ├── StyleTransferBatchHelper.cs │ │ ├── StyleTransferBatchHelper.cs.meta │ │ ├── UniversalStyleTransfer.cs │ │ ├── UniversalStyleTransfer.cs.meta │ │ ├── readme.md │ │ └── readme.md.meta └── ProjectSettings │ ├── ClusterInputManager.asset │ ├── DynamicsManager.asset │ ├── EditorBuildSettings.asset │ ├── EditorSettings.asset │ ├── GraphicsSettings.asset │ ├── InputManager.asset │ ├── NavMeshAreas.asset │ ├── NetworkManager.asset │ ├── Physics2DSettings.asset │ ├── ProjectSettings.asset │ ├── ProjectVersion.txt │ ├── QualitySettings.asset │ ├── TagManager.asset │ ├── TimeManager.asset │ └── UnityConnectSettings.asset ├── Docs └── Images │ ├── UST-pipeline.png │ └── advantage-equation.png └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | *.bytes filter=lfs diff=lfs merge=lfs -text 2 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /Assets/AssetStoreTools* 7 | 8 | # Visual Studio 2015 cache directory 9 | /.vs/ 10 | 11 | # Autogenerated VS/MD/Consulo solution and project files 12 | ExportedObj/ 13 | .consulo/ 14 | *.csproj 15 | *.unityproj 16 | *.sln 17 | *.suo 18 | *.tmp 19 | *.user 20 | *.userprefs 21 | *.pidb 22 | *.booproj 23 | *.svd 24 | *.pdb 25 | 26 | # Unity3D generated meta files 27 | *.pidb.meta 28 | 29 | # Unity3D Generated File On Crash Reports 30 | sysinfo.txt 31 | 32 | # Builds 33 | *.apk 34 | *.unitypackage 35 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/CNTKTest.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a97710345d46d644975a1cab382f429 3 | timeCreated: 1512989026 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb0023f59ee4f4745992afb0db130a08 3 | folderAsset: yes 4 | timeCreated: 1518261272 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Materials/MatTest 1.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: MatTest 1 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 1, b: 1, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Materials/MatTest 1.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0474c905cae702248910c4f6445ddfc7 3 | timeCreated: 1518261279 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 2100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Materials/MatTest 2.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: MatTest 2 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 1, b: 1, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Materials/MatTest 2.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2a7f815fffe73ae4b92f65928f379e39 3 | timeCreated: 1518261279 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 2100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Materials/MatTest.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: MatTest 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 1, b: 1, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Materials/MatTest.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 30549871da08f524a847a9dd4d92b1d3 3 | timeCreated: 1518261279 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 2100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7781e601bd485684e8f1bc638f0f26f9 3 | folderAsset: yes 4 | timeCreated: 1512989085 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e3e3a00d761069444a406221bf1b6f60 3 | folderAsset: yes 4 | timeCreated: 1512989680 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/CSTrainingCPUOnlyExamples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 51d308a105b702d4dbeaeb8e7a6787bd 3 | folderAsset: yes 4 | timeCreated: 1512989702 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/CSTrainingCPUOnlyExamples/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/CSTrainingCPUOnlyExamples/App.config.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a1e6634555ce78d4687c6e81ea5776f0 3 | timeCreated: 1512989702 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/CSTrainingCPUOnlyExamples/CSTrainingCPUOnlyExamples.csproj.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aaa79b6503bc9ae4e841114c4b38c6a4 3 | timeCreated: 1512989702 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/CSTrainingCPUOnlyExamples/Program.cs: -------------------------------------------------------------------------------- 1 | using CNTK; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace CNTK.CSTrainingExamples 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | var device = DeviceDescriptor.CPUDevice; 15 | Console.WriteLine($"======== running LogisticRegression.TrainAndEvaluate using {device.Type} ========"); 16 | LogisticRegression.TrainAndEvaluate(device); 17 | 18 | Console.WriteLine($"======== running MNISTClassifier.TrainAndEvaluate with multilayer perceptron (MLP) classifier using {device.Type} ========"); 19 | MNISTClassifier.TrainAndEvaluate(device, false, true); 20 | 21 | Console.WriteLine($"======== running MNISTClassifier.TrainAndEvaluate with convolutional neural network using {device.Type} ========"); 22 | MNISTClassifier.TrainAndEvaluate(device, true, true); 23 | 24 | // Batch normalization is not available on CPU build. See following examples in GPU project. 25 | // Following examples will be enabled once BN is supported on CPU. 26 | //Console.WriteLine("======== running CifarResNet.TrainAndEvaluate using CPU ========"); 27 | //CifarResNetClassifier.TrainAndEvaluate(device, true); 28 | 29 | //Console.WriteLine("======== running TransferLearning.TrainAndEvaluateWithFlowerData using CPU ========"); 30 | //TransferLearning.TrainAndEvaluateWithFlowerData(device, true); 31 | 32 | //Console.WriteLine("======== running TransferLearning.TrainAndEvaluateWithAnimalData using CPU ========"); 33 | //TransferLearning.TrainAndEvaluateWithAnimalData(device, true); 34 | 35 | Console.WriteLine($"======== running LSTMSequenceClassifier.Train using {device.Type} ========"); 36 | LSTMSequenceClassifier.Train(device); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/CSTrainingCPUOnlyExamples/Program.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3c67a7b6c988c2243bf54ab04efd0981 3 | timeCreated: 1512989702 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/CSTrainingCPUOnlyExamples/Properties.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d9038a194d15b3e409f156eb27e7639c 3 | folderAsset: yes 4 | timeCreated: 1512989702 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/CSTrainingCPUOnlyExamples/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Image")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Image")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e34bcbf0-9e9b-4225-8c1a-7592c95bac0b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/CSTrainingCPUOnlyExamples/Properties/AssemblyInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6af03d563f1a0064a9024631a07daea2 3 | timeCreated: 1512989702 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/CSTrainingCPUOnlyExamples/obj.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1fabc821aabf00c4cabdd13159934e2d 3 | folderAsset: yes 4 | timeCreated: 1512989702 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/CSTrainingCPUOnlyExamples/obj/x64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd62271aff051594fa6be4a42461bbd8 3 | folderAsset: yes 4 | timeCreated: 1512989702 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/CSTrainingCPUOnlyExamples/obj/x64/Debug.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 264104b98be3c2a438b04a926633f7ff 3 | folderAsset: yes 4 | timeCreated: 1512989702 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/CSTrainingCPUOnlyExamples/obj/x64/Debug/TempPE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 440a3af7c2224124381fa99d3ae06680 3 | folderAsset: yes 4 | timeCreated: 1512989702 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/CSTrainingCPUOnlyExamples/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/CSTrainingCPUOnlyExamples/packages.config.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9241af23c767c1a48bf9d758bc7578fd 3 | timeCreated: 1512989702 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/Common.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7dc93b5705d7c14d94fd2964e477f1e 3 | folderAsset: yes 4 | timeCreated: 1512989702 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/Common/CifarResNetClassifier.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53f88650d21aeaa479a66ef96be0051b 3 | timeCreated: 1512989702 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/Common/LSTMSequenceClassifier.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1eab10aa56bb61448a260f83e054677a 3 | timeCreated: 1512989702 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/Common/LogisticRegression.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff94dd0df86ffbe4fb9e160ed74a3697 3 | timeCreated: 1512989702 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/Common/MNISTClassifier.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 905b955efea6d8540ae3d9bfd0fde368 3 | timeCreated: 1512989702 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/Common/TestHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba871bed20846294d891c7a6dcffa1aa 3 | timeCreated: 1512989702 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/Common/TransferLearning.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2676b6a2fed10a346bbc79e47b21695b 3 | timeCreated: 1512989702 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/ImageExtension.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ebfb9d36fddd37c4a85b5e829355e68d 3 | folderAsset: yes 4 | timeCreated: 1512989866 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/CNTKExamples/ImageExtension/CNTKImageProcessing.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a0383d5a3a6c9c84fade2c9a0d2dfe6e 3 | timeCreated: 1512989866 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/TFSharpUtilities.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a6b0ad927009ce04d9ed34144e6ce931 3 | folderAsset: yes 4 | timeCreated: 1516211797 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/TFSharpUtilities/TFSharpUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | using System; 6 | 7 | #if TensorFlow 8 | using TensorFlow; 9 | public static class TFSharpUtils { 10 | 11 | public static void SVD(float[,] covMat, out float[] s, out float[,] v) 12 | { 13 | TFShape shape = new TFShape(covMat.GetLength(0), covMat.GetLength(1)); 14 | var reshaped = covMat.Reshape(); 15 | var inputTensor = TFTensor.FromBuffer(shape, reshaped, 0, reshaped.Length); 16 | 17 | TFGraph svdGraph = new TFGraph(); 18 | TFOutput input = svdGraph.Placeholder(TFDataType.Float, shape); 19 | var svdResult = (ValueTuple)svdGraph.Svd(input, true); 20 | 21 | var sess = new TFSession(svdGraph); 22 | var runner = sess.GetRunner(); 23 | runner.AddInput(input, inputTensor); 24 | runner.Fetch(svdResult.Item1); 25 | runner.Fetch(svdResult.Item2); 26 | 27 | TFTensor[] results = runner.Run(); 28 | s = (float[])results[0].GetValue(); 29 | v = (float[,])results[1].GetValue(); 30 | TFStatus temp = new TFStatus(); 31 | sess.CloseSession(temp); 32 | sess.DeleteSession(temp); 33 | } 34 | 35 | } 36 | #endif -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Scripts/TFSharpUtilities/TFSharpUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 859e21a3607f3684fa360f6c215189ab 3 | timeCreated: 1516211826 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8f9275fdd9295d741966b1685733e44d 3 | folderAsset: yes 4 | timeCreated: 1513264654 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/23466317216_b99485ba14_o-panorama.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/Textures/23466317216_b99485ba14_o-panorama.jpg -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/23466317216_b99485ba14_o-panorama.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ad4468216dd39c4882c45ac50b12075 3 | timeCreated: 1517583072 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 0 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | spriteSheet: 70 | serializedVersion: 2 71 | sprites: [] 72 | outline: [] 73 | physicsShape: [] 74 | spritePackingTag: 75 | userData: 76 | assetBundleName: 77 | assetBundleVariant: 78 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/74432.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/Textures/74432.jpg -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/74432.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9b913d86b28dc34e95bbfbae572c480 3 | timeCreated: 1518026619 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 0 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | spriteSheet: 70 | serializedVersion: 2 71 | sprites: [] 72 | outline: [] 73 | physicsShape: [] 74 | spritePackingTag: 75 | userData: 76 | assetBundleName: 77 | assetBundleVariant: 78 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/FFFFFF.png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/Textures/FFFFFF.png.png -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/FFFFFF.png.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1af99668247cdc948883af3182af0408 3 | timeCreated: 1518026755 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 0 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | spriteSheet: 70 | serializedVersion: 2 71 | sprites: [] 72 | outline: [] 73 | physicsShape: [] 74 | spritePackingTag: 75 | userData: 76 | assetBundleName: 77 | assetBundleVariant: 78 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/depositphotos_107136762-stock-photo-white-noise-gritty-sandy-grunge.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/Textures/depositphotos_107136762-stock-photo-white-noise-gritty-sandy-grunge.jpg -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/depositphotos_107136762-stock-photo-white-noise-gritty-sandy-grunge.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53c44b0ffcad35243b8040b2e11bffb3 3 | timeCreated: 1518026974 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 0 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | spriteSheet: 70 | serializedVersion: 2 71 | sprites: [] 72 | outline: [] 73 | physicsShape: [] 74 | spritePackingTag: 75 | userData: 76 | assetBundleName: 77 | assetBundleVariant: 78 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/flower.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/Textures/flower.jpg -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/flower.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ca0599571e88f84db50cfcbf95d27fa 3 | timeCreated: 1516117983 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 0 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 1 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 1 52 | spriteTessellationDetail: -1 53 | textureType: 8 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | - buildTarget: Standalone 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 1 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | - buildTarget: iPhone 80 | maxTextureSize: 2048 81 | resizeAlgorithm: 0 82 | textureFormat: -1 83 | textureCompression: 1 84 | compressionQuality: 50 85 | crunchedCompression: 0 86 | allowsAlphaSplitting: 0 87 | overridden: 0 88 | androidETC2FallbackOverride: 0 89 | - buildTarget: Android 90 | maxTextureSize: 2048 91 | resizeAlgorithm: 0 92 | textureFormat: -1 93 | textureCompression: 1 94 | compressionQuality: 50 95 | crunchedCompression: 0 96 | allowsAlphaSplitting: 0 97 | overridden: 0 98 | androidETC2FallbackOverride: 0 99 | - buildTarget: WebGL 100 | maxTextureSize: 2048 101 | resizeAlgorithm: 0 102 | textureFormat: -1 103 | textureCompression: 1 104 | compressionQuality: 50 105 | crunchedCompression: 0 106 | allowsAlphaSplitting: 0 107 | overridden: 0 108 | androidETC2FallbackOverride: 0 109 | spriteSheet: 110 | serializedVersion: 2 111 | sprites: [] 112 | outline: [] 113 | physicsShape: [] 114 | spritePackingTag: 115 | userData: 116 | assetBundleName: 117 | assetBundleVariant: 118 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/free-wallpaper-11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/Textures/free-wallpaper-11.jpg -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/free-wallpaper-11.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e42bb1868145a44d9170fb5d20ff747 3 | timeCreated: 1519423422 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 0 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | spriteSheet: 70 | serializedVersion: 2 71 | sprites: [] 72 | outline: [] 73 | physicsShape: [] 74 | spritePackingTag: 75 | userData: 76 | assetBundleName: 77 | assetBundleVariant: 78 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/free-wallpaper-17.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/Textures/free-wallpaper-17.jpg -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/free-wallpaper-17.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a38e3371a55ff5646893e8ad8cbef9b6 3 | timeCreated: 1519423009 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 0 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | spriteSheet: 70 | serializedVersion: 2 71 | sprites: [] 72 | outline: [] 73 | physicsShape: [] 74 | spritePackingTag: 75 | userData: 76 | assetBundleName: 77 | assetBundleVariant: 78 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/free-wallpaper-18.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/Textures/free-wallpaper-18.jpg -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/free-wallpaper-18.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3db1c111ecddbab48bd90bc67d5e3355 3 | timeCreated: 1519423376 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 0 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | spriteSheet: 70 | serializedVersion: 2 71 | sprites: [] 72 | outline: [] 73 | physicsShape: [] 74 | spritePackingTag: 75 | userData: 76 | assetBundleName: 77 | assetBundleVariant: 78 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/grass_leaves_0046_01_preview.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/Textures/grass_leaves_0046_01_preview.jpg -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/grass_leaves_0046_01_preview.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd536a3eed114f24887d53ea69d2d769 3 | timeCreated: 1519646337 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 0 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | spriteSheet: 70 | serializedVersion: 2 71 | sprites: [] 72 | outline: [] 73 | physicsShape: [] 74 | spritePackingTag: 75 | userData: 76 | assetBundleName: 77 | assetBundleVariant: 78 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/Textures/image.png -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/image.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea8685265d82df548934e6ae2c411d5c 3 | timeCreated: 1518100481 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 0 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 1 52 | spriteTessellationDetail: -1 53 | textureType: 8 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | - buildTarget: Standalone 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 1 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | - buildTarget: iPhone 80 | maxTextureSize: 2048 81 | resizeAlgorithm: 0 82 | textureFormat: -1 83 | textureCompression: 1 84 | compressionQuality: 50 85 | crunchedCompression: 0 86 | allowsAlphaSplitting: 0 87 | overridden: 0 88 | androidETC2FallbackOverride: 0 89 | - buildTarget: Android 90 | maxTextureSize: 2048 91 | resizeAlgorithm: 0 92 | textureFormat: -1 93 | textureCompression: 1 94 | compressionQuality: 50 95 | crunchedCompression: 0 96 | allowsAlphaSplitting: 0 97 | overridden: 0 98 | androidETC2FallbackOverride: 0 99 | - buildTarget: WebGL 100 | maxTextureSize: 2048 101 | resizeAlgorithm: 0 102 | textureFormat: -1 103 | textureCompression: 1 104 | compressionQuality: 50 105 | crunchedCompression: 0 106 | allowsAlphaSplitting: 0 107 | overridden: 0 108 | androidETC2FallbackOverride: 0 109 | spriteSheet: 110 | serializedVersion: 2 111 | sprites: [] 112 | outline: [] 113 | physicsShape: [] 114 | spritePackingTag: 115 | userData: 116 | assetBundleName: 117 | assetBundleVariant: 118 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/image4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/Textures/image4.png -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/image4.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d8d79deb8b1547142a5d595d3670210e 3 | timeCreated: 1518270683 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 0 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | spriteSheet: 70 | serializedVersion: 2 71 | sprites: [] 72 | outline: [] 73 | physicsShape: [] 74 | spritePackingTag: 75 | userData: 76 | assetBundleName: 77 | assetBundleVariant: 78 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/mountains-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/Textures/mountains-4.jpg -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/mountains-4.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f3763befeb28bea40a24b8ec7f489ece 3 | timeCreated: 1519423493 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 0 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | spriteSheet: 70 | serializedVersion: 2 71 | sprites: [] 72 | outline: [] 73 | physicsShape: [] 74 | spritePackingTag: 75 | userData: 76 | assetBundleName: 77 | assetBundleVariant: 78 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/Textures/test.png -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/test.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b8f6fa831cefc2f4ab1b849886cc93e0 3 | timeCreated: 1518023363 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 0 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | spriteSheet: 70 | serializedVersion: 2 71 | sprites: [] 72 | outline: [] 73 | physicsShape: [] 74 | spritePackingTag: 75 | userData: 76 | assetBundleName: 77 | assetBundleVariant: 78 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/test2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/Textures/test2.png -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/test2.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22adfc187e0ca8c4ab292ef521ef432d 3 | timeCreated: 1518096186 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 0 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | spriteSheet: 70 | serializedVersion: 2 71 | sprites: [] 72 | outline: [] 73 | physicsShape: [] 74 | spritePackingTag: 75 | userData: 76 | assetBundleName: 77 | assetBundleVariant: 78 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/water.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/Textures/water.jpg -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/Textures/water.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f008529a80cbe3f4d9e031b45ca1d952 3 | timeCreated: 1516117985 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 0 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 1 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 1 52 | spriteTessellationDetail: -1 53 | textureType: 8 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | - buildTarget: Standalone 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 1 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | - buildTarget: iPhone 80 | maxTextureSize: 2048 81 | resizeAlgorithm: 0 82 | textureFormat: -1 83 | textureCompression: 1 84 | compressionQuality: 50 85 | crunchedCompression: 0 86 | allowsAlphaSplitting: 0 87 | overridden: 0 88 | androidETC2FallbackOverride: 0 89 | - buildTarget: Android 90 | maxTextureSize: 2048 91 | resizeAlgorithm: 0 92 | textureFormat: -1 93 | textureCompression: 1 94 | compressionQuality: 50 95 | crunchedCompression: 0 96 | allowsAlphaSplitting: 0 97 | overridden: 0 98 | androidETC2FallbackOverride: 0 99 | - buildTarget: WebGL 100 | maxTextureSize: 2048 101 | resizeAlgorithm: 0 102 | textureFormat: -1 103 | textureCompression: 1 104 | compressionQuality: 50 105 | crunchedCompression: 0 106 | allowsAlphaSplitting: 0 107 | overridden: 0 108 | androidETC2FallbackOverride: 0 109 | spriteSheet: 110 | serializedVersion: 2 111 | sprites: [] 112 | outline: [] 113 | physicsShape: [] 114 | spritePackingTag: 115 | userData: 116 | assetBundleName: 117 | assetBundleVariant: 118 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4d43ad895716504ea3bb7f7808d8d36 3 | folderAsset: yes 4 | timeCreated: 1513244424 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9da2afa779d4d254ab724afedd7d5a09 3 | folderAsset: yes 4 | timeCreated: 1517560939 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/CNTKUnityExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using CNTK; 5 | namespace UnityCNTK 6 | { 7 | public static class CNTKUnityExtensionMethods 8 | { 9 | /// 10 | /// Shallow copy a IList and retrn a array. 11 | /// 12 | /// 13 | /// 14 | /// 15 | /// 16 | public static T[] CopyToArray(this IList iList, int startIndex = 0) 17 | { 18 | T[] result = new T[iList.Count - startIndex]; 19 | iList.CopyTo(result, startIndex); 20 | return result; 21 | } 22 | 23 | 24 | public static Parameter FindParameterByName(this Function func, string name) 25 | { 26 | var allInputs = func.Parameters(); 27 | foreach (var p in allInputs) 28 | { 29 | if (p.Kind == VariableKind.Parameter) 30 | { 31 | //look for the parameter of the same name from the other function 32 | if (name == p.Name) { 33 | return p; 34 | } 35 | } 36 | } 37 | return null; 38 | } 39 | 40 | public static List FindParametersByName(this Function func, string[] names) 41 | { 42 | HashSet set = new HashSet(names); 43 | var allInputs = func.Parameters(); 44 | var result = new List(); 45 | foreach (var p in allInputs) 46 | { 47 | if (p.Kind == VariableKind.Parameter) 48 | { 49 | //look for the parameter of the same name from the other function 50 | if (set.Contains( p.Name)) 51 | { 52 | result.Add(p); 53 | } 54 | } 55 | } 56 | return result; 57 | } 58 | 59 | public static void RestoreParametersByName(this Function func, Function fromFunction) 60 | { 61 | var allInputs = func.Parameters(); 62 | var fromInputs = fromFunction.Parameters(); 63 | foreach(var p in allInputs) 64 | { 65 | if(p.Kind == VariableKind.Parameter) 66 | { 67 | Parameter fromP = null; 68 | //look for the parameter of the same name from the other function 69 | foreach(var f in fromInputs) 70 | { 71 | if(f.Name == p.Name) 72 | { 73 | fromP = f; 74 | break; 75 | } 76 | } 77 | 78 | if(fromP == null) 79 | { 80 | Debug.LogWarning("Did not find parameter " + p.Name + " in the other function"); 81 | }else if (!p.Shape.Equals(fromP.Shape)) 82 | { 83 | Debug.LogError("Parameter shapes not the same. Original " + p.Name + " has a shape of " + string.Join(",", p.Shape.Dimensions) + " while the new one is " + string.Join(",", fromP.Shape.Dimensions)); 84 | } 85 | else 86 | { 87 | p.Value().CopyFrom(fromP.Value()); 88 | } 89 | 90 | } 91 | } 92 | } 93 | } 94 | } -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/CNTKUnityExtensionMethods.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 460fa3047de996b43958be02c31c6564 3 | timeCreated: 1514884410 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/DataBuffer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7b4ab18237a7c8c42900fd078f39cae8 3 | timeCreated: 1519379586 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a218b9f492a74ee4f97144766c6c74d8 3 | folderAsset: yes 4 | timeCreated: 1517560944 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/Editor/EditorUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | using UnityEditor; 6 | 7 | 8 | namespace UnityCNTK.Editor 9 | { 10 | 11 | public static class EditorUtils 12 | { 13 | public static void SaveTextureToPNGFile(Texture2D tex, string defaultName = "image") 14 | { 15 | string path = EditorUtility.SaveFilePanelInProject("Save png", defaultName, "png", 16 | "Please enter a file name to save the texture to"); 17 | if (path.Length != 0) 18 | { 19 | byte[] pngData = tex.EncodeToPNG(); 20 | if (pngData != null) 21 | { 22 | File.WriteAllBytes(path, pngData); 23 | 24 | // As we are saving to the asset folder, tell Unity to scan for modified or new assets 25 | AssetDatabase.Refresh(); 26 | } 27 | } 28 | } 29 | 30 | [MenuItem("CONTEXT/Renderer/SaveMainTextureToFile")] 31 | public static void EditorSaveTextureToPNGFile(MenuCommand menuCommand) 32 | { 33 | var rend = menuCommand.context as Renderer; 34 | if (rend.sharedMaterial == null) 35 | { 36 | Debug.LogWarning("No material in renderer"); 37 | return; 38 | } 39 | var tex = rend.sharedMaterial.mainTexture as Texture2D; 40 | if (tex == null) 41 | { 42 | Debug.LogWarning("No Texture2d in material"); 43 | return; 44 | } 45 | string path = EditorUtility.SaveFilePanelInProject("Save png", "image", "png", 46 | "Please enter a file name to save the texture to"); 47 | if (path.Length != 0) 48 | { 49 | var tempText = Images.GetReadableTextureFromUnreadable(tex); 50 | byte[] pngData = tempText.EncodeToPNG(); 51 | GameObject.DestroyImmediate(tempText); 52 | if (pngData != null) 53 | { 54 | File.WriteAllBytes(path, pngData); 55 | 56 | // As we are saving to the asset folder, tell Unity to scan for modified or new assets 57 | AssetDatabase.Refresh(); 58 | } 59 | } 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/Editor/EditorUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e3afed07a5d700449bb369e43ff2c75b 3 | timeCreated: 1518018391 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/Editor/UsefulLayouts.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | 6 | 7 | namespace UnityCNTK.Editor 8 | { 9 | 10 | public class ResizableSubWindow 11 | { 12 | 13 | public Rect WindowRect { get; set; } = new Rect(50, 50, 100, 100); 14 | public Vector2 MinWindowSize { get; set; } = new Vector2(75, 50); 15 | protected bool isResize = false; 16 | public int ID { get; set; } 17 | 18 | protected static GUIStyle styleWindowResize = null; 19 | protected static GUIContent gcDrag = new GUIContent("", "drag to resize"); 20 | protected static Vector2 buttonSize = new Vector2(10, 10); 21 | protected static float dragableTopHeight = 20; 22 | 23 | 24 | public string Title { get; set; } 25 | 26 | public ResizableSubWindow(int id, Rect initWindowRect, string title = "") 27 | { 28 | WindowRect = initWindowRect; 29 | Title = title; 30 | ID = id; 31 | } 32 | 33 | public ResizableSubWindow(int id, string title = "") 34 | { 35 | Title = title; 36 | ID = id; 37 | } 38 | 39 | 40 | public void OnGUI() 41 | { 42 | 43 | WindowRect = GUILayout.Window(ID, WindowRect, DoWindow, Title, GUILayout.ExpandWidth(true)); 44 | } 45 | 46 | protected virtual void DoWindow(int windowID) 47 | { 48 | WindowRect = ResizeWindow(WindowRect, ref isResize, MinWindowSize); 49 | GUILayout.Label(""); 50 | 51 | var dragAreaRect = new Rect(0, 0, WindowRect.width, dragableTopHeight); 52 | GUI.DragWindow(dragAreaRect); 53 | //GUI.Button(dragAreaRect,""); 54 | } 55 | 56 | public static Rect ResizeWindow(Rect windowRect, ref bool isRezising, Vector2 minWindowSize) 57 | { 58 | // this is a custom style that looks like a // in the lower corner 59 | if (styleWindowResize == null) 60 | { 61 | styleWindowResize = GUI.skin.GetStyle("WindowBottomResize"); 62 | //Debug.Log("resizer style"); 63 | } 64 | Vector2 mouse = Event.current.mousePosition; 65 | //rectangle for the drag button 66 | Rect r = new Rect(windowRect.size - buttonSize, buttonSize); 67 | 68 | if (Event.current.type == EventType.MouseDown && r.Contains(mouse)) 69 | { 70 | isRezising = true; 71 | //Debug.Log("start resize"); 72 | //Event.current.Use(); // the GUI.Button below will eat the event, and this way it will show its active state 73 | } 74 | else if ((Event.current.type == EventType.MouseUp || Event.current.rawType == EventType.MouseUp) && isRezising) 75 | { 76 | isRezising = false; 77 | } 78 | else if (isRezising) 79 | { 80 | //Debug.Log("resizing"); 81 | //Debug.Log(Event.current.delta.x); 82 | // Debug.Log(windowRect); 83 | windowRect.width = Mathf.Max(minWindowSize.x, windowRect.width + Event.current.delta.x / 2); 84 | windowRect.height = Mathf.Max(minWindowSize.y, windowRect.height + Event.current.delta.y / 2); 85 | windowRect.xMax = Mathf.Min(Screen.width, windowRect.xMax); // modifying xMax affects width, not x 86 | windowRect.yMax = Mathf.Min(Screen.height, windowRect.yMax); // modifying yMax affects height, not y 87 | } 88 | 89 | 90 | //draw a button, also eat the mouse down event so that other event(window dragging) will not be trigger 91 | GUI.Button(r, gcDrag, styleWindowResize); 92 | return windowRect; 93 | 94 | } 95 | } 96 | 97 | } -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/Editor/UsefulLayouts.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a3c145e87a226d4ba7eb8626c2e09de 3 | timeCreated: 1517561003 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/Images.WCT.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64c13cf685ebd034882adc82ab792cfa 3 | timeCreated: 1515678483 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/Images.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f3218eb68c7a85428453c57c6b2df89 3 | timeCreated: 1513275444 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/LayerDefinitions.Activation.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56e58d9369139c846ac8c3ded1b7be50 3 | timeCreated: 1519135602 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/LayerDefinitions.Helper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using CNTK; 5 | 6 | namespace UnityCNTK.LayerDefinitions 7 | { 8 | public static class LayerDefineHelper 9 | { 10 | public static ResNodeDenseDef[] ResNodeLayers(int numOfNodes, int hiddenSize, NormalizationMethod normalizatoin = NormalizationMethod.None,float dropout = 0.0f) 11 | { 12 | var result = new ResNodeDenseDef[numOfNodes]; 13 | for(int i = 0; i < numOfNodes; ++i) 14 | { 15 | result[i]=new ResNodeDenseDef(hiddenSize, normalizatoin, dropout); 16 | } 17 | return result; 18 | } 19 | 20 | public static LayerDenseDef[] DenseLayers(int numOfLayers, int hiddenSize, bool hasBias = true, NormalizationMethod normalizatoin = NormalizationMethod.None, float dropout = 0.0f, float initialWeightScale = 0.1f, LayerDef activation = null) 21 | { 22 | var result = new LayerDenseDef[numOfLayers]; 23 | for (int i = 0; i < numOfLayers; ++i) 24 | { 25 | result[i] = new LayerDenseDef(hiddenSize, normalizatoin, activation, dropout); 26 | result[i].HasBias = hasBias; 27 | result[i].InitialWeightScale = initialWeightScale; 28 | } 29 | return result; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/LayerDefinitions.Helper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74f9791c3c4194047b2a0a7c5ff8cf6b 3 | timeCreated: 1519135602 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/LayerDefinitions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb9f7083ee61b734283498c1ec7357d1 3 | timeCreated: 1519135602 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/Layers.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 924c33a1aceee5c40acd209d19315172 3 | timeCreated: 1513244434 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/SequentialNetworks.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using CNTK; 4 | 5 | namespace UnityCNTK 6 | { 7 | public class SequentialNetworkDense 8 | { 9 | 10 | //the reference to the CNTK function of the resnet 11 | public LayerDefinitions.InputLayerDef InputLayer { get; private set; } = null; 12 | public LayerDefinitions.LayerDef[] HiddenLayers { get; private set; } = null; 13 | public LayerDefinitions.OutputLayerDef OutputLayer { get; private set; } = null; 14 | 15 | public DeviceDescriptor Device { get; set; } 16 | public Function CNTKFunction { get { return OutputLayer.CNTKFunction; } } 17 | 18 | public List Parameters { get { 19 | return CNTKFunction.FindParametersByName(ParameterNames.ToArray()); 20 | } } 21 | 22 | public List ParameterNames; 23 | 24 | /// input specs for the resnet 25 | /// hidden layers specs for the resnet. 26 | /// output specs for the resnet 27 | /// Note that those input well not be copied. 28 | public SequentialNetworkDense(LayerDefinitions.InputLayerDef input, LayerDefinitions.LayerDef[] hiddenLayers, LayerDefinitions.OutputLayerDef output, DeviceDescriptor device, string name="") 29 | { 30 | this.InputLayer = input; 31 | this.HiddenLayers = hiddenLayers; 32 | OutputLayer = output; 33 | Device = device; 34 | ParameterNames = new List(); 35 | //start to build the network 36 | var temp = input.Build("NetworkInput"); 37 | for (int i = 0; i < hiddenLayers.Length; ++i) 38 | { 39 | temp = hiddenLayers[i].Build(temp, device, name+".Hidden." + i); 40 | ParameterNames.AddRange(hiddenLayers[i].ParameterNames); 41 | } 42 | 43 | temp = OutputLayer.Build(temp, device, name + ".NetworkOutput"); 44 | ParameterNames.AddRange(OutputLayer.ParameterNames); 45 | 46 | } 47 | 48 | public IList EvaluateOne(float[] input) 49 | { 50 | 51 | var inputVar = InputLayer.InputVariable; 52 | var outputVar = OutputLayer.GetOutputVariable(); 53 | 54 | 55 | Value inputdata = Value.CreateBatch(inputVar.Shape, input, Device, true); 56 | 57 | 58 | var inputDataMap = new Dictionary() { { inputVar, inputdata } }; 59 | var outputDataMap = new Dictionary() { { outputVar, null } }; 60 | 61 | 62 | outputVar.ToFunction().Evaluate(inputDataMap, outputDataMap, Device); 63 | var result = outputDataMap[outputVar].GetDenseData(outputVar); 64 | return result[0]; 65 | } 66 | 67 | public IList EvaluateOne(float[] input, Variable outputVar) 68 | { 69 | 70 | var inputVar = InputLayer.InputVariable; 71 | 72 | 73 | Value inputdata = Value.CreateBatch(inputVar.Shape, input, Device, true); 74 | 75 | 76 | var inputDataMap = new Dictionary() { { inputVar, inputdata } }; 77 | var outputDataMap = new Dictionary() { { outputVar, null } }; 78 | 79 | 80 | outputVar.ToFunction().Evaluate(inputDataMap, outputDataMap, Device); 81 | 82 | return outputDataMap[outputVar].GetDenseData(outputVar)[0]; 83 | } 84 | 85 | public byte[] Save() 86 | { 87 | return CNTKFunction.Save(); 88 | } 89 | 90 | public void Restore(byte[] data) 91 | { 92 | Function f = Function.Load(data, Device); 93 | CNTKFunction.RestoreParametersByName(f); 94 | } 95 | 96 | } 97 | 98 | 99 | 100 | 101 | 102 | } -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/SequentialNetworks.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: abe319f4ca5379841a7caf36d9cdb316 3 | timeCreated: 1519814477 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/Trainers.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26b31fc3d9d8a4c4eaed1f5c062f370b 3 | timeCreated: 1519814549 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Common/Utils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3c6b4ecbeb8a6214ba0b9243c11b6b7c 3 | timeCreated: 1518183684 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e296bfc16c8cc264b9605e8f624c4723 3 | folderAsset: yes 4 | timeCreated: 1518263123 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ac085fd30f747094c98b59ff390f1936 3 | folderAsset: yes 4 | timeCreated: 1516440314 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20029ee1c099f4b47afbac48208879b9 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/Editor/SerializableDictionaryPropertyDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91da51d02ab9ebc459d80d5965d40d19 3 | timeCreated: 1492869349 4 | licenseType: Store 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea574807be3814126807ca7b22d13988 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/Example/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b9e966b834ddb48d0815c494d4f511da 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/Example/Editor/UserSerializableDictionaryPropertyDrawers.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | [CustomPropertyDrawer(typeof(StringStringDictionary))] 7 | [CustomPropertyDrawer(typeof(DicGameobjectFloat))] 8 | [CustomPropertyDrawer(typeof(ObjectColorDictionary))] 9 | [CustomPropertyDrawer(typeof(MaterialTexture2DDictionary))] 10 | [CustomPropertyDrawer(typeof(Texture2DTexture2DDictionary))] 11 | public class AnySerializableDictionaryPropertyDrawer : SerializableDictionaryPropertyDrawer {} 12 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/Example/Editor/UserSerializableDictionaryPropertyDrawers.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3089b6c771301cc44ba23b7f8f469e14 3 | timeCreated: 1493639898 4 | licenseType: Store 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/Example/SerializableDicitonary Example.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c0758ade4ba74b7493ce3806fa2f38b 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/Example/SerializableDictionaryExample.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class SerializableDictionaryExample : MonoBehaviour { 6 | // The dictionaries can be accessed throught a property 7 | [SerializeField] 8 | StringStringDictionary m_stringStringDictionary; 9 | public IDictionary StringStringDictionary 10 | { 11 | get { return m_stringStringDictionary; } 12 | set { m_stringStringDictionary.CopyFrom (value); } 13 | } 14 | 15 | public ObjectColorDictionary m_objectColorDictionary; 16 | 17 | void Reset () 18 | { 19 | // access by property 20 | StringStringDictionary = new Dictionary() { {"first key", "value A"}, {"second key", "value B"}, {"third key", "value C"} }; 21 | m_objectColorDictionary = new ObjectColorDictionary() { {gameObject, Color.blue}, {this, Color.red} }; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/Example/SerializableDictionaryExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5ff00a74ccb984498070d9930a7944c 3 | timeCreated: 1500228763 4 | licenseType: Store 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/Example/UserSerializableDictionaries.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System; 4 | using UnityEngine; 5 | 6 | [Serializable] 7 | public class StringStringDictionary : SerializableDictionary {} 8 | 9 | [Serializable] 10 | public class ObjectColorDictionary : SerializableDictionary {} 11 | 12 | [Serializable] 13 | public class DicGameobjectFloat : SerializableDictionary { } 14 | 15 | [Serializable] 16 | public class MaterialTexture2DDictionary : SerializableDictionary { } 17 | [Serializable] 18 | public class Texture2DTexture2DDictionary : SerializableDictionary { } -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/Example/UserSerializableDictionaries.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd910530dd8f6b5429c65a494644ed09 3 | timeCreated: 1493639913 4 | licenseType: Store 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/SerializableDictionary.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | public class SerializableDictionary : Dictionary, ISerializationCallbackReceiver 7 | { 8 | [SerializeField] 9 | TKey[] m_keys; 10 | [SerializeField] 11 | TValue[] m_values; 12 | 13 | public SerializableDictionary() 14 | { 15 | } 16 | 17 | public SerializableDictionary(IDictionary dict) : base(dict.Count) 18 | { 19 | foreach (var kvp in dict) 20 | { 21 | this[kvp.Key] = kvp.Value; 22 | } 23 | } 24 | 25 | public void CopyFrom(IDictionary dict) 26 | { 27 | this.Clear(); 28 | foreach (var kvp in dict) 29 | { 30 | this[kvp.Key] = kvp.Value; 31 | } 32 | } 33 | 34 | public void OnAfterDeserialize() 35 | { 36 | if(m_keys != null && m_values != null && m_keys.Length == m_values.Length) 37 | { 38 | this.Clear(); 39 | int n = m_keys.Length; 40 | for(int i = 0; i < n; ++i) 41 | { 42 | this[m_keys[i]] = m_values[i]; 43 | } 44 | 45 | m_keys = null; 46 | m_values = null; 47 | } 48 | 49 | } 50 | 51 | public void OnBeforeSerialize() 52 | { 53 | int n = this.Count; 54 | m_keys = new TKey[n]; 55 | m_values = new TValue[n]; 56 | 57 | int i = 0; 58 | foreach(var kvp in this) 59 | { 60 | m_keys[i] = kvp.Key; 61 | m_values[i] = kvp.Value; 62 | ++i; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/SerializableDictionary.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7be1c9624387604fba4005ccf7dbd5a 3 | timeCreated: 1492868176 4 | licenseType: Store 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/SerializableDictionary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/SerializableDictionary.pdf -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Dependencies/SerializableDictionary/SerializableDictionary.pdf.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8eb73a56b3a6ee64ab2c30cac8878d8f 3 | timeCreated: 1500229932 4 | licenseType: Store 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ede655c4852b5cb4b872b196febeb9cc 3 | folderAsset: yes 4 | timeCreated: 1513246701 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/CommonNNs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ca9fd773a790084388479eb01056d93 3 | folderAsset: yes 4 | timeCreated: 1520974573 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/CommonNNs/Examples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 696b03739b6235349adbf28ec319e79b 3 | folderAsset: yes 4 | timeCreated: 1520974679 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/CommonNNs/Examples/CNTKGANTest.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f4014969bfc2cb847b1da9698796a12e 3 | timeCreated: 1512989026 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/CommonNNs/Examples/CNTKNetworkBuildTest.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bee2ded95001ebf48897f6f76fc6f369 3 | timeCreated: 1512989026 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/CommonNNs/Examples/DataPlane2D.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e759de9fe1f6f3c4b960cca208f12aeb 3 | timeCreated: 1519386367 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/CommonNNs/Examples/DataPlane2DInput.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.EventSystems; 5 | 6 | [RequireComponent(typeof(DataPlane2D))] 7 | [RequireComponent(typeof(EventTrigger))] 8 | [RequireComponent(typeof(Collider))] 9 | public class DataPlane2DInput : MonoBehaviour { 10 | 11 | 12 | protected DataPlane2D dataPlane; 13 | public int currentDataLabel; 14 | 15 | private void Awake() 16 | { 17 | dataPlane = GetComponent(); 18 | } 19 | // Use this for initialization 20 | void Start () { 21 | 22 | } 23 | 24 | // Update is called once per frame 25 | void Update () { 26 | 27 | } 28 | 29 | public void OnClicked(BaseEventData data) 30 | { 31 | var pdata = data as PointerEventData; 32 | var rcast = pdata.pointerCurrentRaycast; 33 | dataPlane.AddDatapoint(rcast.worldPosition, currentDataLabel); 34 | print("Clicked On " + rcast.worldPosition); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/CommonNNs/Examples/DataPlane2DInput.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d64a6540d22042546b334b9392941ac4 3 | timeCreated: 1519387993 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/CommonNNs/Examples/TestGANTrain2D.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityCNTK; 5 | using CNTK; 6 | 7 | public class TestGANTrain2D : MonoBehaviour { 8 | 9 | 10 | 11 | protected GAN gan; 12 | protected TrainerGAN trainerGan; 13 | public DataPlane2D dataPlane; 14 | public float lrGenerator = 0.001f; 15 | public float lrDiscriminator = 0.001f; 16 | public bool training = false; 17 | 18 | 19 | public int trainedEpisodes = 0; 20 | 21 | // Use this for initialization 22 | void Start () { 23 | CreateGAN(); 24 | 25 | } 26 | 27 | // Update is called once per frame 28 | void Update () { 29 | if (training) 30 | { 31 | TrainOnce(10); 32 | } 33 | } 34 | 35 | 36 | 37 | public void CreateGAN() 38 | { 39 | gan = new GAN(2, 0, 2, 10, 5, 10, 5, DeviceDescriptor.GPUDevice(0)); 40 | trainerGan = new TrainerGAN(gan, LearnerDefs.AdamLearner(lrGenerator), LearnerDefs.AdamLearner(lrDiscriminator),DeviceDescriptor.GPUDevice(0)); 41 | trainerGan.usePredictionInTraining = true; 42 | } 43 | 44 | 45 | public void LoadTrainingData() 46 | { 47 | trainerGan.ClearData(); 48 | trainerGan.AddData(null,dataPlane.GetDataPositions()); 49 | } 50 | 51 | 52 | public void TrainOnce(int episodes) 53 | { 54 | trainerGan.SetLearningRateGenerator(lrGenerator); 55 | trainerGan.SetLearningRateDiscriminator(lrDiscriminator); 56 | for (int i = 0; i < episodes; ++i) 57 | { 58 | trainerGan.TrainMiniBatch(32); 59 | trainedEpisodes++; 60 | } 61 | 62 | Debug.Log("G loss: " + trainerGan.LastLossGenerator); 63 | Debug.Log("D loss: " + trainerGan.LastLossDiscriminator); 64 | } 65 | 66 | public void UseGAN(int generatedNumber) 67 | { 68 | dataPlane.RemovePointsOfType(1); 69 | for (int i = 0; i < generatedNumber; ++i) 70 | { 71 | var result = gan.EvaluateOne(null); 72 | dataPlane.AddDatapoint(new Vector2(result[0], result[1]), 1); 73 | } 74 | 75 | } 76 | 77 | 78 | public void SaveGenerator() 79 | { 80 | trainerGan.SaveGenerator(2); 81 | } 82 | 83 | public void RestoreGenerator() 84 | { 85 | trainerGan.RestoreGenerator(2); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/CommonNNs/Examples/TestGANTrain2D.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 70f51731092a9f045b35de4528ac89db 3 | timeCreated: 1520334925 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/CommonNNs/Examples/TestSeqNNTrain2D.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using CNTK; 5 | using System.Linq; 6 | using UnityCNTK; 7 | using UnityCNTK.Tools.StyleAndTexture; 8 | using UnityCNTK.LayerDefinitions; 9 | using System.Threading; 10 | using System; 11 | using MathNet.Numerics; 12 | using Accord.Math; 13 | 14 | public class TestSeqNNTrain2D : MonoBehaviour { 15 | 16 | protected SequentialNetworkDense network; 17 | public DataPlane2D dataPlane; 18 | protected TrainerSimpleNN trainer; 19 | public float lr = 0.00001f; 20 | public bool training = false; 21 | protected OutputLayerDef outputLayer; 22 | // Use this for initialization 23 | void Start () { 24 | CreateResnode(); 25 | 26 | //TestLayerNormalization(); 27 | 28 | } 29 | 30 | 31 | // Update is called once per frame 32 | void Update () { 33 | if (training) 34 | { 35 | TrainOnce(50); 36 | } 37 | } 38 | 39 | 40 | 41 | public void CreateResnode() 42 | { 43 | var input = new InputLayerDense(2); 44 | 45 | //outputLayer = new OutputLayerDenseBayesian(1); 46 | outputLayer = new OutputLayerDense(1, null, OutputLayerDense.LossFunction.Square); 47 | 48 | network = new SequentialNetworkDense(input, LayerDefineHelper.DenseLayers(10,5,true,NormalizationMethod.None), outputLayer, DeviceDescriptor.CPUDevice); 49 | //network = new SequentialNetworkDense(input, LayerDefineHelper.ResNodeLayers(10, 5), outputLayer, DeviceDescriptor.CPUDevice); 50 | 51 | trainer = new TrainerSimpleNN(network, LearnerDefs.AdamLearner(lr),DeviceDescriptor.CPUDevice); 52 | 53 | dataPlane.network = this; 54 | } 55 | 56 | public void LoadTrainingData() 57 | { 58 | trainer.ClearData(); 59 | trainer.AddData(dataPlane.GetDataPositions(), dataPlane.GetDataLabels()); 60 | 61 | } 62 | 63 | public void TrainOnce(int episodes) 64 | { 65 | trainer.SetLearningRate(lr); 66 | for (int i = 0; i < episodes; ++i) 67 | { 68 | trainer.TrainMiniBatch(32); 69 | } 70 | print("Training loss:" + trainer.LastLoss); 71 | } 72 | 73 | public float EvalPosition(Vector2 position) 74 | { 75 | var pred = network.EvaluateOne(new float[] { position.x, position.y }); 76 | //var variance = network.EvaluateOne(new float[] { position.x, position.y }, outputLayer.GetVarianceVariable()); 77 | //print("Predicted: " + pred[0] + ", variance: " + variance[0]); 78 | print("Predicted: " + pred[0]); 79 | return pred[0]; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/CommonNNs/Examples/TestSeqNNTrain2D.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 919a13c1ae048e848a02337980f91b9b 3 | timeCreated: 1512989094 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/CommonNNs/GAN.Dense.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 356981447354e824a98a45d93e4f5e05 3 | timeCreated: 1520248253 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/CommonNNs/Trainers.GAN.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7762c9b7641ed5d4c81ad6df380bc6fd 3 | timeCreated: 1519814549 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 662f12becdb847d44b359599ecbe2cc0 3 | folderAsset: yes 4 | timeCreated: 1520526407 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/DQL.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2142399f2a947e44dbf22047053af5b4 3 | folderAsset: yes 4 | timeCreated: 1521103035 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/DQL/DQLModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | 6 | using CNTK; 7 | using UnityCNTK.LayerDefinitions; 8 | using MathNet.Numerics.Distributions; 9 | 10 | namespace UnityCNTK.ReinforcementLearning 11 | { 12 | public class DQLModel 13 | { 14 | 15 | public QNetwork Network { get; protected set; } 16 | public int StateSize { get { return Network.StateSize; } } 17 | public int ActionSize { get { return Network.ActionSize; } } 18 | public DeviceDescriptor Device { get { return Network.Device; } } 19 | 20 | 21 | //---variables for training 22 | public Variable InputOldAction { get; protected set; } 23 | public Variable InputState { get { return Network.InputState; } } 24 | public Variable InputTargetQ { get; protected set; } 25 | 26 | public Variable OutputLoss { get; protected set; } 27 | public Variable OutputAction { get; protected set; } 28 | public Variable OutputQs { get { return Network.OutputQs; } } 29 | public Variable OutputMaxQ { get; protected set; } 30 | 31 | //test 32 | Variable outputTargetQ; 33 | 34 | public Function CNTKFunction { get; protected set; } 35 | 36 | //public Variable testOutputProb; 37 | 38 | public DQLModel(QNetwork network) 39 | { 40 | Network = network; 41 | 42 | InputOldAction = CNTKLib.InputVariable(new int[] { 1 }, DataType.Float); 43 | 44 | InputTargetQ = CNTKLib.InputVariable(new int[] { 1 }, DataType.Float); 45 | 46 | var oneHotOldAction = CNTKLib.OneHotOp(InputOldAction, (uint)ActionSize, false, new Axis(0)); 47 | outputTargetQ = CNTKLib.ReduceSum(CNTKLib.ElementTimes(OutputQs, oneHotOldAction), Axis.AllStaticAxes()); 48 | //OutputLoss = CNTKLib.Square(CNTKLib.Minus(outputTargetQ, InputTargetQ),"Loss"); 49 | OutputLoss = Layers.HuberLoss(outputTargetQ, InputTargetQ, Device); 50 | 51 | OutputAction = CNTKLib.Argmax(OutputQs, new Axis(0)); 52 | OutputMaxQ = CNTKLib.ReduceMax(OutputQs, new Axis(0)); 53 | 54 | CNTKFunction = Function.Combine(new List() { OutputLoss, OutputAction, OutputMaxQ }); 55 | } 56 | 57 | public byte[] Save() 58 | { 59 | return CNTKFunction.Save(); 60 | } 61 | 62 | public void Restore(byte[] data) 63 | { 64 | Function f = Function.Load(data, Device); 65 | CNTKFunction.RestoreParametersByName(f); 66 | } 67 | 68 | 69 | public int[] EvaluateAction(float[] state, out float[] maxQs) 70 | { 71 | //input data maps 72 | var inputDataMap = new Dictionary(); 73 | 74 | Value inputStatedata = Value.CreateBatch(Network.InputState.Shape, state, Network.Device, true); 75 | inputDataMap.Add(Network.InputState, inputStatedata); 76 | //test 77 | //inputDataMap.Add(InputOldAction, Value.CreateBatch(new int[] { 1 }, new float[] { 2 }, Network.Device, true)); 78 | 79 | 80 | //output datamaps 81 | var outputDataMap = new Dictionary(); 82 | outputDataMap.Add(OutputMaxQ, null); 83 | outputDataMap.Add(OutputAction, null); 84 | //outputDataMap.Add(OutputQs, null);//test 85 | //outputDataMap.Add(outputTargetQ, null);//test 86 | 87 | CNTKFunction.Evaluate(inputDataMap, outputDataMap, Device); 88 | 89 | var maxQ = outputDataMap[OutputMaxQ].GetDenseData(OutputMaxQ); 90 | var action = outputDataMap[OutputAction].GetDenseData(OutputAction); 91 | //var Qs = outputDataMap[OutputQs].GetDenseData(OutputQs);//test 92 | //var tarQ = outputDataMap[outputTargetQ].GetDenseData(outputTargetQ);//test 93 | int batchSize = maxQ.Count; 94 | 95 | int[] actions = new int[batchSize]; 96 | maxQs = new float[batchSize]; 97 | for (int i = 0; i < batchSize; ++i) 98 | { 99 | actions[i] = (int)action[i][0]; 100 | maxQs[i] = maxQ[i][0]; 101 | } 102 | return actions; 103 | } 104 | } 105 | 106 | 107 | 108 | 109 | 110 | 111 | } -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/DQL/DQLModel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ec4127fc3bb22f649bf838ffa144a3e8 3 | timeCreated: 1521103047 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/DQL/QNetworks.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0246dd55e47920c4d809b5595e73a2d2 3 | timeCreated: 1521805020 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/DQL/Trainers.DQL.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eab0f9935e951a84e97f55d28643874b 3 | timeCreated: 1520692147 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 784cff57695ccd94185260693ad45ded 3 | folderAsset: yes 4 | timeCreated: 1520852739 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c57269a5091115a45af7aa2d299c4618 3 | folderAsset: yes 4 | timeCreated: 1520852794 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7238e36c134c43f4cbd5c8c31f1e2c5f 3 | folderAsset: yes 4 | timeCreated: 1520855054 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Materials/ball.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: ball 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _EMISSION 12 | m_LightmapFlags: 1 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0 64 | - _GlossyReflections: 1 65 | - _Metallic: 1 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 0.59607846, b: 0, a: 1} 76 | - _EmissionColor: {r: 0.29411763, g: 0.21966352, b: 0.08650518, a: 1} 77 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Materials/ball.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: edd958d75ed1448138de86f3335ea4fa 3 | timeCreated: 1497123463 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Materials/logo 1.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: logo 1 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _ALPHAPREMULTIPLY_ON 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: 3000 16 | stringTagMap: 17 | RenderType: Transparent 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 2800000, guid: 0d342588c0383439e92173c7356b6e4c, type: 3} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 10 63 | - _GlossMapScale: 1 64 | - _Glossiness: 1 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 3 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _UVSec: 0 74 | - _ZWrite: 0 75 | m_Colors: 76 | - _Color: {r: 1, g: 1, b: 1, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Materials/logo 1.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e35c6159207d7448e988c8cf0c137ab6 3 | timeCreated: 1501267793 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Materials/logo.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: logo 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 0.96, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 0.96, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0, g: 0.15686275, b: 0.20784314, a: 1} 76 | - _EmissionColor: {r: 0.1544118, g: 0.1544118, b: 0.1544118, a: 1} 77 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Materials/logo.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8f8a9c03cd1f4fdbb7a3e95be9ea341 3 | timeCreated: 1501267188 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Materials/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Materials/logo.png -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Materials/logo.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d342588c0383439e92173c7356b6e4c 3 | timeCreated: 1501268935 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: 0 37 | wrapV: 0 38 | wrapW: 0 39 | nPOTScale: 0 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 1 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 1 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | - buildTarget: Standalone 67 | maxTextureSize: 2048 68 | textureFormat: -1 69 | textureCompression: 1 70 | compressionQuality: 50 71 | crunchedCompression: 0 72 | allowsAlphaSplitting: 0 73 | overridden: 0 74 | - buildTarget: WebGL 75 | maxTextureSize: 2048 76 | textureFormat: -1 77 | textureCompression: 1 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | spriteSheet: 83 | serializedVersion: 2 84 | sprites: [] 85 | outline: [] 86 | physicsShape: [] 87 | spritePackingTag: 88 | userData: 89 | assetBundleName: 90 | assetBundleVariant: 91 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7f76e451b3030e54eac0f7c5488d22e9 3 | folderAsset: yes 4 | timeCreated: 1506066534 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Prefabs/Game.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff026d63a00abdc48ad6ddcff89aba04 3 | timeCreated: 1506066551 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a83e830ec5bcd4b1db836428921d59b0 3 | timeCreated: 1497054080 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1aca8883d579a491ca2a55ea7a8127c3 3 | folderAsset: yes 4 | timeCreated: 1503455136 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Scripts/Ball3DEnviroment.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aaba48bf82bee4751aa7b89569e57f73 3 | timeCreated: 1502223572 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Scripts/Ball3DRunner.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | using UnityCNTK.ReinforcementLearning; 6 | using UnityCNTK; 7 | using CNTK; 8 | using UnityEngine.UI; 9 | using System.IO; 10 | 11 | public class Ball3DRunner : MonoBehaviour { 12 | public Text scoreUI; 13 | public Ball3DEnviroment environment; 14 | public string saveDataPath; 15 | public float learningRate = 0.001f; 16 | protected PPOModel model; 17 | protected TrainerPPOSimple trainer; 18 | 19 | public int episodesThisTrain = 0; 20 | public int trainedCount = 0; 21 | 22 | public int episodeToRunForEachTrain = 30; 23 | public int iterationForEachTrain = 50; 24 | public int minibatch = 32; 25 | 26 | [Range(0,100)] 27 | public float timeScale; 28 | public bool training = true; 29 | 30 | protected AutoAverage loss; 31 | protected AutoAverage episodePointAve; 32 | protected float episodePoint; 33 | 34 | // Use this for initialization 35 | void Start () { 36 | PPONetworkContinuousSimple network; 37 | if (environment.is3D) 38 | { 39 | network = new PPONetworkContinuousSimple(8, 2, 2, 32, DeviceDescriptor.CPUDevice, 0.01f); 40 | model = new PPOModel(network); 41 | trainer = new TrainerPPOSimple(model, LearnerDefs.AdamLearner(learningRate),1, 10000, 200); 42 | trainer.ClipEpsilon = 0.1f; 43 | } 44 | else 45 | { 46 | network = new PPONetworkContinuousSimple(5, 2, 2, 32, DeviceDescriptor.CPUDevice, 0.01f); 47 | model = new PPOModel(network); 48 | trainer = new TrainerPPOSimple(model, LearnerDefs.AdamLearner(learningRate),1, 10000, 200); 49 | } 50 | 51 | 52 | 53 | //test 54 | //trainer.RewardDiscountFactor = 0.5f; 55 | 56 | loss = new AutoAverage(iterationForEachTrain); 57 | episodePointAve = new AutoAverage(episodeToRunForEachTrain); 58 | } 59 | 60 | // Update is called once per frame 61 | void Update () { 62 | Time.timeScale = timeScale; 63 | trainer.SetLearningRate(learningRate); 64 | } 65 | 66 | 67 | private void FixedUpdate() 68 | { 69 | RunStep(); 70 | } 71 | 72 | 73 | protected void RunStep() 74 | { 75 | trainer.Step(environment); 76 | bool reset = trainer.Record(environment); 77 | episodePoint += environment.LastReward(); 78 | 79 | //reset if end 80 | if (reset && training) 81 | { 82 | environment.Reset(); 83 | episodesThisTrain++; 84 | episodePointAve.AddValue(episodePoint); 85 | if (episodePointAve.JustUpdated) 86 | { 87 | scoreUI.text = "Average points:" + episodePointAve.Average; 88 | } 89 | episodePoint = 0; 90 | 91 | if (episodesThisTrain >= episodeToRunForEachTrain) 92 | { 93 | 94 | trainer.TrainAllData(minibatch, iterationForEachTrain); 95 | //record and print the loss 96 | print("Training Loss:" + trainer.LastLoss); 97 | trainedCount++; 98 | trainer.ClearData(); 99 | episodesThisTrain = 0; 100 | } 101 | }else if (environment.IsEnd()) 102 | { 103 | environment.Reset(); 104 | } 105 | } 106 | 107 | public void Save() 108 | { 109 | var data = model.Save(); 110 | File.WriteAllBytes(saveDataPath, data); 111 | } 112 | public void Load() 113 | { 114 | var bytes = File.ReadAllBytes(saveDataPath); 115 | model.Restore(bytes); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/3DBall/Scripts/Ball3DRunner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d416905fa308e74c8a0dc2967a76bc7 3 | timeCreated: 1520855214 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Maze.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50daaeee004afa4439af18740192e5f0 3 | folderAsset: yes 4 | timeCreated: 1521648603 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Maze/MazeBlock.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1001 &100100000 4 | Prefab: 5 | m_ObjectHideFlags: 1 6 | serializedVersion: 2 7 | m_Modification: 8 | m_TransformParent: {fileID: 0} 9 | m_Modifications: [] 10 | m_RemovedComponents: [] 11 | m_ParentPrefab: {fileID: 0} 12 | m_RootGameObject: {fileID: 1703424236563172} 13 | m_IsPrefabParent: 1 14 | --- !u!1 &1703424236563172 15 | GameObject: 16 | m_ObjectHideFlags: 0 17 | m_PrefabParentObject: {fileID: 0} 18 | m_PrefabInternal: {fileID: 100100000} 19 | serializedVersion: 5 20 | m_Component: 21 | - component: {fileID: 4056819875528000} 22 | - component: {fileID: 212986659424911492} 23 | m_Layer: 0 24 | m_Name: MazeBlock 25 | m_TagString: Untagged 26 | m_Icon: {fileID: 0} 27 | m_NavMeshLayer: 0 28 | m_StaticEditorFlags: 0 29 | m_IsActive: 1 30 | --- !u!4 &4056819875528000 31 | Transform: 32 | m_ObjectHideFlags: 1 33 | m_PrefabParentObject: {fileID: 0} 34 | m_PrefabInternal: {fileID: 100100000} 35 | m_GameObject: {fileID: 1703424236563172} 36 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 37 | m_LocalPosition: {x: 1434.2501, y: 113.409485, z: 0} 38 | m_LocalScale: {x: 1, y: 1, z: 1} 39 | m_Children: [] 40 | m_Father: {fileID: 0} 41 | m_RootOrder: 0 42 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 43 | --- !u!212 &212986659424911492 44 | SpriteRenderer: 45 | m_ObjectHideFlags: 1 46 | m_PrefabParentObject: {fileID: 0} 47 | m_PrefabInternal: {fileID: 100100000} 48 | m_GameObject: {fileID: 1703424236563172} 49 | m_Enabled: 1 50 | m_CastShadows: 0 51 | m_ReceiveShadows: 0 52 | m_DynamicOccludee: 1 53 | m_MotionVectors: 1 54 | m_LightProbeUsage: 1 55 | m_ReflectionProbeUsage: 1 56 | m_Materials: 57 | - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 58 | m_StaticBatchInfo: 59 | firstSubMesh: 0 60 | subMeshCount: 0 61 | m_StaticBatchRoot: {fileID: 0} 62 | m_ProbeAnchor: {fileID: 0} 63 | m_LightProbeVolumeOverride: {fileID: 0} 64 | m_ScaleInLightmap: 1 65 | m_PreserveUVs: 0 66 | m_IgnoreNormalsForChartDetection: 0 67 | m_ImportantGI: 0 68 | m_StitchLightmapSeams: 0 69 | m_SelectedEditorRenderState: 0 70 | m_MinimumChartSize: 4 71 | m_AutoUVMaxDistance: 0.5 72 | m_AutoUVMaxAngle: 89 73 | m_LightmapParameters: {fileID: 0} 74 | m_SortingLayerID: 0 75 | m_SortingLayer: 0 76 | m_SortingOrder: 0 77 | m_Sprite: {fileID: 21300000, guid: 4137edeadcb9a9043983b6acf66b2fbd, type: 3} 78 | m_Color: {r: 1, g: 1, b: 1, a: 1} 79 | m_FlipX: 0 80 | m_FlipY: 0 81 | m_DrawMode: 0 82 | m_Size: {x: 1, y: 1} 83 | m_AdaptiveModeThreshold: 0.5 84 | m_SpriteTileMode: 0 85 | m_WasSpriteAssigned: 1 86 | m_MaskInteraction: 0 87 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Maze/MazeBlock.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7eeed6412190fa4199630885d87c19e 3 | timeCreated: 1521648605 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 0 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Maze/MazeDQLRunner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a1ac94c4d29c5346b161a105a9c5f69 3 | timeCreated: 1521703413 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Maze/MazeEnvironment.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4489ca5e08ea2824d8ac1255bf3e4264 3 | timeCreated: 1503355437 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Maze/MazeGame.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 15aa491af789f0448ae56ac9e228c4b7 3 | timeCreated: 1504127824 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Maze/MazeViewer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class MazeViewer : MonoBehaviour { 6 | public MazeEnvironment mazeEnvironment; 7 | 8 | public bool enableUpdate = true; 9 | public float blockDimension = 1.0f; 10 | public GameObject blockPrefab; 11 | 12 | public SpriteRenderer[,] blocks; 13 | 14 | 15 | // Use this for initialization 16 | void Start() 17 | { 18 | InitializeGraphic(); 19 | 20 | } 21 | 22 | // Update is called once per frame 23 | void Update() 24 | { 25 | if (enableUpdate) 26 | UpdateGraphics(mazeEnvironment.map); 27 | 28 | } 29 | 30 | 31 | public void UpdateGraphics(float[,] map) 32 | { 33 | for (int i = 0; i < mazeEnvironment.mazeDimension.x; ++i) 34 | { 35 | for (int j = 0; j < mazeEnvironment.mazeDimension.y; ++j) 36 | { 37 | blocks[i, j].color = ChooseColor((int)map[i, j]); 38 | } 39 | } 40 | } 41 | 42 | 43 | private Color ChooseColor(int blockType) 44 | { 45 | if (blockType == mazeEnvironment.WallInt) 46 | { 47 | return Color.red; 48 | } 49 | else if (blockType == mazeEnvironment.GoalInt) 50 | { 51 | return Color.green; 52 | } 53 | else if (blockType == mazeEnvironment.PlayerInt) 54 | { 55 | return Color.yellow; 56 | } 57 | else 58 | { 59 | return Color.black; 60 | } 61 | } 62 | 63 | private void InitializeGraphic() 64 | { 65 | blocks = new SpriteRenderer[mazeEnvironment.mazeDimension.x, mazeEnvironment.mazeDimension.y]; 66 | 67 | for (int i = 0; i < mazeEnvironment.mazeDimension.x; ++i) 68 | { 69 | for (int j = 0; j < mazeEnvironment.mazeDimension.y; ++j) 70 | { 71 | GameObject obj = GameObject.Instantiate(blockPrefab, new Vector3(i * blockDimension, j * blockDimension), Quaternion.identity, this.transform); 72 | blocks[i, j] = obj.GetComponent(); 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Maze/MazeViewer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49ca709d8583b3b41a2ac12e72e2eb8f 3 | timeCreated: 1498641782 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pole.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db220a4e83b95334dbd564547177cb19 3 | folderAsset: yes 4 | timeCreated: 1520942573 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pole/PoleDQLRunner.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | using UnityCNTK.ReinforcementLearning; 6 | using UnityCNTK; 7 | using CNTK; 8 | using UnityEngine.UI; 9 | using System.IO; 10 | 11 | public class PoleDQLRunner : MonoBehaviour { 12 | public Text scoreUI; 13 | public PoleGameEnviroment environment; 14 | public string saveDataPath; 15 | protected DQLModel model; 16 | protected DQLModel modelTarget; 17 | protected TrainerDQLSimple trainer; 18 | 19 | [Header("Training Settings")] 20 | public int experienceBufferSize = 5000000; 21 | public int batchSize = 64; 22 | public float discountFactor = 0.98f; 23 | public int trainingStepInterval = 10; 24 | public int stepsBeforeTrain = 100000; 25 | [Header("Changing RL")] 26 | public int changeRLSteps = 3000000; 27 | public float startLearningRate = 0.4f, endLearningRate = 0.05f; 28 | public float CurrentLearningRate { get { 29 | return startLearningRate + (endLearningRate - startLearningRate)*Mathf.Clamp01(((float)Steps - stepsBeforeTrain)/changeRLSteps); 30 | } } 31 | [Header("Random action settings")] 32 | public float randomChanceStart = 1.0f; 33 | public float randomChanceEnd = 0.05f; 34 | public int randomChanceDropSteps = 1000000; 35 | 36 | [Range(0,100)] 37 | public float timeScale = 1; 38 | public bool training = true; 39 | 40 | 41 | public int Steps { get { return trainer.Steps; } } 42 | [Header("Information")] 43 | public int currentEpisode = 0; 44 | public AutoAverage rewardEpiAve = new AutoAverage(50); 45 | protected float rewardOneEpi = 0; 46 | public AutoAverage loss = new AutoAverage(500); 47 | // Use this for initialization 48 | void Start () { 49 | environment.isContinuou = false; 50 | QNetworkSimple network = new QNetworkSimple(2,2,2,64,DeviceDescriptor.CPUDevice,0.4f); 51 | model = new DQLModel(network); 52 | //QNetworkSimple networkTarget = new QNetworkSimple(2, 2, 2, 64, DeviceDescriptor.CPUDevice, 1f); 53 | //modelTarget = new DQLModel(networkTarget); 54 | //trainer = new TrainerDQLSimple(model, null, LearnerDefs.MomentumSGDLearner(startLearningRate,0.9f),1, experienceBufferSize, 500); 55 | trainer = new TrainerDQLSimple(model, modelTarget, LearnerDefs.AdamLearner(startLearningRate), 1, experienceBufferSize, 500); 56 | //Save();//test 57 | } 58 | 59 | // Update is called once per frame 60 | void Update () { 61 | 62 | scoreUI.text = "(DQL,Discrete action) Average Reward:"+rewardEpiAve.Average.ToString(); 63 | Time.timeScale = timeScale; 64 | UpdateAllParameters(); 65 | } 66 | 67 | 68 | private void FixedUpdate() 69 | { 70 | RunStep(); 71 | } 72 | 73 | 74 | protected void RunStep() 75 | { 76 | trainer.Step(environment); 77 | rewardOneEpi += environment.LastReward(0); 78 | bool reset = trainer.Record(environment); 79 | 80 | //training 81 | if(trainer.Steps >= stepsBeforeTrain && trainer.Steps% trainingStepInterval == 0) 82 | { 83 | trainer.TrainRandomBatch(batchSize); 84 | 85 | //log the loss 86 | loss.AddValue(trainer.LastLoss); 87 | if (loss.JustUpdated) 88 | { 89 | print("Loss:" + loss.Average); 90 | } 91 | } 92 | //reset if end 93 | if (environment.IsEnd() || (reset && training)) 94 | { 95 | currentEpisode++; 96 | rewardEpiAve.AddValue(rewardOneEpi); 97 | rewardOneEpi = 0; 98 | environment.Reset(); 99 | } 100 | } 101 | 102 | public void Save() 103 | { 104 | var data = model.Save(); 105 | File.WriteAllBytes(saveDataPath, data); 106 | } 107 | public void Load() 108 | { 109 | var bytes = File.ReadAllBytes(saveDataPath); 110 | model.Restore(bytes); 111 | } 112 | 113 | 114 | public void UpdateAllParameters() 115 | { 116 | trainer.DiscountFactor = discountFactor; 117 | 118 | trainer.SetLearningRate(CurrentLearningRate); 119 | 120 | trainer.RandomChanceDropStepInterval = randomChanceDropSteps; 121 | trainer.StartRandomChance = randomChanceStart; 122 | trainer.EndRandomChance = randomChanceEnd; 123 | } 124 | 125 | 126 | } 127 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pole/PoleDQLRunner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c004a270f7f09840a8874182abdaecc 3 | timeCreated: 1520855214 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pole/PoleGameEnviroment.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityCNTK; 5 | using UnityCNTK.ReinforcementLearning; 6 | 7 | public class PoleGameEnviroment : MonoBehaviour, IRLEnvironment 8 | { 9 | 10 | public bool isContinuou = true; 11 | public float deltaTime = 0.02f; 12 | public float damp = 0.01f; 13 | public int framesPerStep = 5; 14 | public float gravity = 1; 15 | protected float reward = 0; 16 | protected bool done; 17 | protected int step = 0; 18 | 19 | 20 | public float velR; 21 | public float angleR; //in radian 22 | 23 | public GameObject poleObjectRef; 24 | 25 | private void Start() 26 | { 27 | Physics.autoSimulation = false; 28 | Reset(); 29 | } 30 | 31 | 32 | private void Update() 33 | { 34 | poleObjectRef.transform.rotation = Quaternion.Euler(0, 0, angleR * Mathf.Rad2Deg + 180); 35 | } 36 | 37 | public float[] CurrentState(int actor = 0) 38 | { 39 | var state = new float[2]; 40 | state[0] = velR; 41 | state[1] = angleR; 42 | return state; 43 | } 44 | public int CurrentStep() 45 | { 46 | return step; 47 | } 48 | 49 | public bool IsResolved() 50 | { 51 | return true; 52 | } 53 | 54 | public void Step(params float[][] act) 55 | { 56 | Step(act[0]); 57 | } 58 | public void Step(float[] act) 59 | { 60 | reward = 0; 61 | for (int i = 0; i < framesPerStep; ++i) 62 | { 63 | float gavityTorque = Mathf.Sin(angleR); 64 | float torque = 0; 65 | float dampeTorque = -velR * velR * damp*Mathf.Sign(velR); 66 | if (isContinuou) 67 | { 68 | torque = act[0]; 69 | torque = Mathf.Clamp(torque, -3, 3); 70 | } 71 | else 72 | { 73 | torque = (act[0] ==0 ?-3.0f:3.0f); 74 | } 75 | velR += deltaTime * (torque + gavityTorque + dampeTorque); 76 | angleR += deltaTime * velR; 77 | 78 | if (angleR < -Mathf.PI) { 79 | angleR = angleR + 2 * Mathf.PI; 80 | }else if(angleR > Mathf.PI) 81 | { 82 | angleR = angleR - 2 * Mathf.PI; 83 | } 84 | 85 | reward = -Mathf.Abs(angleR)+Mathf.PI/2 - Mathf.Abs(velR); 86 | reward /= framesPerStep*10; 87 | } 88 | 89 | step++; 90 | } 91 | 92 | 93 | public float LastReward(int actor = 0) 94 | { 95 | return reward; 96 | } 97 | 98 | public bool IsEnd() 99 | { 100 | return done; 101 | } 102 | 103 | // to be implemented by the developer 104 | public void Reset() 105 | { 106 | angleR = Random.Range(-Mathf.PI/2, Mathf.PI/2); 107 | velR = Random.Range(0, 0); 108 | done = false; 109 | reward = 0; 110 | step = 0; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pole/PoleGameEnviroment.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 629398b1fe841004eb035ac0b219e2eb 3 | timeCreated: 1520942617 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pole/PoleRunner.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityCNTK; 5 | using CNTK; 6 | using UnityEngine.UI; 7 | using System.IO; 8 | using UnityCNTK.ReinforcementLearning; 9 | 10 | public class PoleRunner : MonoBehaviour { 11 | 12 | public Text scoreUI; 13 | public PoleGameEnviroment environment; 14 | public string saveDataPath = "PolePendulum.bytes"; 15 | public float learningRate = 0.001f; 16 | protected PPOModel model; 17 | protected TrainerPPOSimple trainer; 18 | 19 | public int episodesThisTrain = 0; 20 | public int trainedCount = 0; 21 | 22 | public int episodeToRunForEachTrain = 30; 23 | public int iterationForEachTrain = 50; 24 | public int minibatch = 32; 25 | public bool training = true; 26 | [Range(0, 100)] 27 | public float timeScale; 28 | 29 | protected AutoAverage loss; 30 | protected AutoAverage episodePointAve; 31 | protected float episodePoint; 32 | 33 | // Use this for initialization 34 | void Start() 35 | { 36 | var network = new PPONetworkContinuousSimple(2, 1, 4, 64, DeviceDescriptor.GPUDevice(0),0.01f); 37 | model = new PPOModel(network); 38 | trainer = new TrainerPPOSimple(model, LearnerDefs.AdamLearner(learningRate), 1,10000, 500); 39 | 40 | //test 41 | //trainer.RewardDiscountFactor = 0.5f; 42 | 43 | loss = new AutoAverage(iterationForEachTrain); 44 | episodePointAve = new AutoAverage(episodeToRunForEachTrain); 45 | } 46 | 47 | // Update is called once per frame 48 | void Update() 49 | { 50 | Time.timeScale = timeScale; 51 | trainer.SetLearningRate(learningRate); 52 | } 53 | 54 | private void FixedUpdate() 55 | { 56 | RunStep(); 57 | } 58 | 59 | protected void RunStep() 60 | { 61 | trainer.Step(environment); 62 | bool reset = trainer.Record(environment); 63 | episodePoint += environment.LastReward(); 64 | 65 | //reset if end 66 | if (reset && training) 67 | { 68 | environment.Reset(); 69 | episodesThisTrain++; 70 | episodePointAve.AddValue(episodePoint); 71 | if (episodePointAve.JustUpdated) 72 | { 73 | scoreUI.text = "(PPO, Continuous) Average Reward:" + episodePointAve.Average; 74 | } 75 | episodePoint = 0; 76 | 77 | if (episodesThisTrain >= episodeToRunForEachTrain) 78 | { 79 | 80 | trainer.TrainAllData(minibatch, iterationForEachTrain); 81 | //record and print the loss 82 | print("Training Loss:" + trainer.LastLoss); 83 | trainedCount++; 84 | trainer.ClearData(); 85 | episodesThisTrain = 0; 86 | } 87 | 88 | } 89 | } 90 | public void Save() 91 | { 92 | var data = model.Save(); 93 | File.WriteAllBytes(saveDataPath, data); 94 | } 95 | public void Load() 96 | { 97 | var bytes = File.ReadAllBytes(saveDataPath); 98 | model.Restore(bytes); 99 | } 100 | } 101 | 102 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pole/PoleRunner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f196009007bdaa14c8bc38d2a9f45ed9 3 | timeCreated: 1520943796 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pole/Scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf0226c4312698f4bae87c3a11a15f7f 3 | timeCreated: 1497054080 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pole/Square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pole/Square.png -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pole/Square.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4137edeadcb9a9043983b6acf66b2fbd 3 | timeCreated: 1520943674 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 0 38 | wrapV: 0 39 | wrapW: 0 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 3 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 4 50 | alphaUsage: 1 51 | alphaIsTransparency: 0 52 | spriteTessellationDetail: -1 53 | textureType: 8 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: 4 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | spriteSheet: 70 | serializedVersion: 2 71 | sprites: [] 72 | outline: 73 | - - {x: -2, y: -2} 74 | - {x: -2, y: 2} 75 | - {x: 2, y: 2} 76 | - {x: 2, y: -2} 77 | physicsShape: 78 | - - {x: -2, y: -2} 79 | - {x: -2, y: 2} 80 | - {x: 2, y: 2} 81 | - {x: 2, y: -2} 82 | spritePackingTag: 83 | userData: 84 | assetBundleName: 85 | assetBundleVariant: 86 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a4c20fa68d29ee4ea5752af8e1a3eca 3 | folderAsset: yes 4 | timeCreated: 1521117124 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/PongDQLRunner.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | 6 | using UnityCNTK; 7 | using CNTK; 8 | using UnityCNTK.ReinforcementLearning; 9 | using UnityEngine.UI; 10 | using System.IO; 11 | 12 | public class PongDQLRunner : MonoBehaviour { 13 | public PongEnvironment environment; 14 | public string saveDataPath; 15 | protected DQLModel model; 16 | protected DQLModel modelTarget; 17 | protected TrainerDQLSimple trainer; 18 | 19 | [Header("Training Settings")] 20 | public int experienceBufferSize = 5000000; 21 | public int batchSize = 64; 22 | public float discountFactor = 0.98f; 23 | public int trainingStepInterval = 10; 24 | public int stepsBeforeTrain = 100000; 25 | [Header("Changing RL")] 26 | public int changeRLSteps = 3000000; 27 | public float startLearningRate = 0.4f, endLearningRate = 0.05f; 28 | public float CurrentLearningRate { get { 29 | return startLearningRate + (endLearningRate - startLearningRate)*Mathf.Clamp01(((float)Steps - stepsBeforeTrain)/changeRLSteps); 30 | } } 31 | [Header("Random action settings")] 32 | public float randomChanceStart = 1.0f; 33 | public float randomChanceEnd = 0.05f; 34 | public int randomChanceDropSteps = 1000000; 35 | 36 | [Range(0,100)] 37 | public float timeScale = 1; 38 | public bool training = true; 39 | 40 | 41 | public int Steps { get { return trainer!= null?trainer.Steps:0; } } 42 | [Header("Information")] 43 | public int currentEpisode = 0; 44 | public int leftWin = 0; 45 | public int rightWin = 0; 46 | public AutoAverage winningRate50Left = new AutoAverage(50); 47 | public AutoAverage reward50EpiLeft = new AutoAverage(50); 48 | protected float rewardLeftOneEpi = 0; 49 | public AutoAverage loss = new AutoAverage(500); 50 | // Use this for initialization 51 | void Start () { 52 | QNetworkSimple network = new QNetworkSimple(6,3,2,64,DeviceDescriptor.GPUDevice(0),0.4f); 53 | model = new DQLModel(network); 54 | QNetworkSimple networkTarget = new QNetworkSimple(6, 3, 2, 64, DeviceDescriptor.GPUDevice(0), 0.4f); 55 | modelTarget = new DQLModel(networkTarget); 56 | //trainer = new TrainerDQLSimple(model, null, LearnerDefs.SGDLearner(startLearningRate),1, experienceBufferSize, 2048); 57 | trainer = new TrainerDQLSimple(model, modelTarget, LearnerDefs.AdamLearner(startLearningRate), 1, experienceBufferSize, experienceBufferSize); 58 | //Save();//test 59 | } 60 | 61 | // Update is called once per frame 62 | void Update () { 63 | Time.timeScale = timeScale; 64 | UpdateAllParameters(); 65 | } 66 | 67 | 68 | private void FixedUpdate() 69 | { 70 | RunStep(); 71 | } 72 | 73 | 74 | protected void RunStep() 75 | { 76 | trainer.Step(environment); 77 | rewardLeftOneEpi += environment.LastReward(0); 78 | bool reset = trainer.Record(environment); 79 | 80 | //training 81 | if(trainer.Steps >= stepsBeforeTrain && trainer.Steps% trainingStepInterval == 0) 82 | { 83 | trainer.TrainRandomBatch(batchSize); 84 | 85 | //log the loss 86 | loss.AddValue(trainer.LastLoss); 87 | if (loss.JustUpdated) 88 | { 89 | print("Loss:" + loss.Average); 90 | } 91 | } 92 | //reset if end 93 | if (environment.IsEnd() || (reset && training)) 94 | { 95 | currentEpisode++; 96 | if(environment.GameWinPlayer == 0) 97 | { 98 | leftWin++; 99 | winningRate50Left.AddValue(1); 100 | } 101 | else 102 | { 103 | rightWin++; 104 | winningRate50Left.AddValue(0); 105 | } 106 | reward50EpiLeft.AddValue(rewardLeftOneEpi); 107 | rewardLeftOneEpi = 0; 108 | environment.Reset(); 109 | } 110 | } 111 | 112 | public void Save() 113 | { 114 | var data = model.Save(); 115 | File.WriteAllBytes(saveDataPath, data); 116 | } 117 | public void Load() 118 | { 119 | var bytes = File.ReadAllBytes(saveDataPath); 120 | model.Restore(bytes); 121 | } 122 | 123 | 124 | public void UpdateAllParameters() 125 | { 126 | trainer.DiscountFactor = discountFactor; 127 | 128 | trainer.SetLearningRate(CurrentLearningRate); 129 | 130 | trainer.RandomChanceDropStepInterval = randomChanceDropSteps; 131 | trainer.StartRandomChance = randomChanceStart; 132 | trainer.EndRandomChance = randomChanceEnd; 133 | } 134 | 135 | 136 | } 137 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/PongDQLRunner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ffb7fe231e647340a187057fb47bd88 3 | timeCreated: 1520855214 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/PongEnvironment.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 72cb54d5ddbeef2448cb472e2231a0c7 3 | timeCreated: 1521117357 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/PongGameGraphic.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class PongGameGraphic : MonoBehaviour 6 | { 7 | public PongEnvironment pongGameToView; 8 | public bool enableUpdate = true; 9 | public GameObject wallPref; 10 | public GameObject ballPref; 11 | public GameObject racketPref; 12 | public float wallThickness; 13 | public float racketThickness; 14 | public float ballRadius; 15 | 16 | private GameObject[] walls; 17 | private GameObject ball; 18 | private GameObject racketLeft; 19 | private GameObject racketRight; 20 | // Use this for initialization 21 | void Start() 22 | { 23 | Initialize(); 24 | 25 | } 26 | 27 | // Update is called once per frame 28 | void Update() 29 | { 30 | if (enableUpdate) 31 | UpdateGraphics(); 32 | 33 | } 34 | 35 | private void UpdateGraphics() 36 | { 37 | PongEnvironment.GameState gameState = pongGameToView.CurrentGameState; 38 | 39 | walls[0].transform.localScale = new Vector3(pongGameToView.arenaSize.x, wallThickness, 1); 40 | walls[1].transform.localScale = new Vector3(pongGameToView.arenaSize.x, wallThickness, 1); 41 | walls[2].transform.localScale = new Vector3(wallThickness, pongGameToView.arenaSize.y, 1); 42 | walls[3].transform.localScale = new Vector3(wallThickness, pongGameToView.arenaSize.y, 1); 43 | 44 | walls[0].transform.position = new Vector3(0, pongGameToView.arenaSize.y / 2 + wallThickness / 2, 0); 45 | walls[1].transform.position = new Vector3(0, -pongGameToView.arenaSize.y / 2 - wallThickness / 2, 0); 46 | walls[2].transform.position = new Vector3(pongGameToView.arenaSize.x / 2 + wallThickness / 2, 0, 0); 47 | walls[3].transform.position = new Vector3(-pongGameToView.arenaSize.x / 2 - wallThickness / 2, 0, 0); 48 | 49 | ball.transform.localScale = Vector3.one * ballRadius * 2; 50 | ball.transform.position = new Vector3(gameState.ballPosition.x, gameState.ballPosition.y, 0); 51 | 52 | racketLeft.transform.localScale = new Vector3(racketThickness, pongGameToView.racketWidth, 1); 53 | racketLeft.transform.position = new Vector3(pongGameToView.leftStartX - racketThickness / 2, gameState.leftY, 0); 54 | racketRight.transform.localScale = new Vector3(racketThickness, pongGameToView.racketWidth, 1); 55 | racketRight.transform.position = new Vector3(pongGameToView.rightStartX + racketThickness / 2, gameState.rightY, 0); 56 | } 57 | 58 | private void Initialize() 59 | { 60 | walls = new GameObject[4]; 61 | walls[0] = Instantiate(wallPref); 62 | walls[1] = Instantiate(wallPref); 63 | walls[2] = Instantiate(wallPref); 64 | walls[3] = Instantiate(wallPref); 65 | 66 | ball = Instantiate(ballPref); 67 | racketLeft = Instantiate(racketPref); 68 | racketRight = Instantiate(racketPref); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/PongGameGraphic.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: afc31bcbc38c6f64ca3646d13478c506 3 | timeCreated: 1521117276 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/PongPPORunner.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | using UnityCNTK.ReinforcementLearning; 6 | using UnityCNTK; 7 | using CNTK; 8 | using UnityEngine.UI; 9 | using System.IO; 10 | 11 | public class PongPPORunner : MonoBehaviour { 12 | public PongEnvironment environment; 13 | public string saveDataPath = "PongPPO.bytes"; 14 | public float learningRate = 0.001f; 15 | protected PPOModel model; 16 | protected TrainerPPOSimple trainer; 17 | 18 | public int episodesThisTrain = 0; 19 | public int trainedCount = 0; 20 | 21 | public int episodeToRunForEachTrain = 30; 22 | public int iterationForEachTrain = 50; 23 | public int minibatch = 32; 24 | public bool training = true; 25 | [Range(0, 100)] 26 | public float timeScale; 27 | 28 | public int Steps { get { return trainer.Steps; } } 29 | [Header("info")] 30 | public int currentEpisode = 0; 31 | public int leftWin = 0; 32 | public int rightWin = 0; 33 | 34 | public AutoAverage winningRate50Left = new AutoAverage(50); 35 | protected AutoAverage loss; 36 | public AutoAverage episodePointAve; 37 | protected float episodePoint; 38 | 39 | // Use this for initialization 40 | void Start() 41 | { 42 | var network = new PPONetworkDiscreteSimple(6, 3, 4, 64, DeviceDescriptor.CPUDevice, 0.01f); 43 | model = new PPOModel(network); 44 | trainer = new TrainerPPOSimple(model, LearnerDefs.AdamLearner(learningRate),1, 50000, 2000); 45 | 46 | //test 47 | //trainer.RewardDiscountFactor = 0.5f; 48 | 49 | loss = new AutoAverage(iterationForEachTrain); 50 | episodePointAve = new AutoAverage(episodeToRunForEachTrain); 51 | } 52 | 53 | // Update is called once per frame 54 | void Update() 55 | { 56 | Time.timeScale = timeScale; 57 | trainer.SetLearningRate(learningRate); 58 | } 59 | 60 | private void FixedUpdate() 61 | { 62 | RunStep(); 63 | } 64 | 65 | protected void RunStep() 66 | { 67 | trainer.Step(environment); 68 | bool reset = trainer.Record(environment); 69 | episodePoint += environment.LastReward(); 70 | 71 | //reset if end 72 | if (reset && training) 73 | { 74 | currentEpisode++; 75 | if (environment.GameWinPlayer == 0) 76 | { 77 | leftWin++; 78 | winningRate50Left.AddValue(1); 79 | } 80 | else 81 | { 82 | rightWin++; 83 | winningRate50Left.AddValue(0); 84 | } 85 | 86 | 87 | environment.Reset(); 88 | episodesThisTrain++; 89 | episodePointAve.AddValue(episodePoint); 90 | episodePoint = 0; 91 | 92 | if (episodesThisTrain >= episodeToRunForEachTrain) 93 | { 94 | 95 | trainer.TrainAllData(minibatch, iterationForEachTrain); 96 | //record and print the loss 97 | print("Training Loss:" + trainer.LastLoss); 98 | trainedCount++; 99 | trainer.ClearData(); 100 | episodesThisTrain = 0; 101 | } 102 | 103 | } 104 | } 105 | public void Save() 106 | { 107 | var data = model.Save(); 108 | File.WriteAllBytes(saveDataPath, data); 109 | } 110 | public void Load() 111 | { 112 | var bytes = File.ReadAllBytes(saveDataPath); 113 | model.Restore(bytes); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/PongPPORunner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9a71a671b5d2034699f9d52347c989f 3 | timeCreated: 1520855214 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5b0814fabc4a634e8d5d7726f6ab1a3 3 | folderAsset: yes 4 | timeCreated: 1521117227 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/Prefabs/Ball.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1001 &100100000 4 | Prefab: 5 | m_ObjectHideFlags: 1 6 | serializedVersion: 2 7 | m_Modification: 8 | m_TransformParent: {fileID: 0} 9 | m_Modifications: [] 10 | m_RemovedComponents: [] 11 | m_ParentPrefab: {fileID: 0} 12 | m_RootGameObject: {fileID: 1201227418953210} 13 | m_IsPrefabParent: 1 14 | --- !u!1 &1201227418953210 15 | GameObject: 16 | m_ObjectHideFlags: 0 17 | m_PrefabParentObject: {fileID: 0} 18 | m_PrefabInternal: {fileID: 100100000} 19 | serializedVersion: 5 20 | m_Component: 21 | - component: {fileID: 4644345676987554} 22 | - component: {fileID: 212494166564958346} 23 | m_Layer: 0 24 | m_Name: Ball 25 | m_TagString: Untagged 26 | m_Icon: {fileID: 0} 27 | m_NavMeshLayer: 0 28 | m_StaticEditorFlags: 0 29 | m_IsActive: 1 30 | --- !u!4 &4644345676987554 31 | Transform: 32 | m_ObjectHideFlags: 1 33 | m_PrefabParentObject: {fileID: 0} 34 | m_PrefabInternal: {fileID: 100100000} 35 | m_GameObject: {fileID: 1201227418953210} 36 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 37 | m_LocalPosition: {x: 1.472, y: 0.086, z: 0} 38 | m_LocalScale: {x: 1, y: 1, z: 1} 39 | m_Children: [] 40 | m_Father: {fileID: 0} 41 | m_RootOrder: 0 42 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 43 | --- !u!212 &212494166564958346 44 | SpriteRenderer: 45 | m_ObjectHideFlags: 1 46 | m_PrefabParentObject: {fileID: 0} 47 | m_PrefabInternal: {fileID: 100100000} 48 | m_GameObject: {fileID: 1201227418953210} 49 | m_Enabled: 1 50 | m_CastShadows: 0 51 | m_ReceiveShadows: 0 52 | m_DynamicOccludee: 1 53 | m_MotionVectors: 1 54 | m_LightProbeUsage: 1 55 | m_ReflectionProbeUsage: 1 56 | m_Materials: 57 | - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 58 | m_StaticBatchInfo: 59 | firstSubMesh: 0 60 | subMeshCount: 0 61 | m_StaticBatchRoot: {fileID: 0} 62 | m_ProbeAnchor: {fileID: 0} 63 | m_LightProbeVolumeOverride: {fileID: 0} 64 | m_ScaleInLightmap: 1 65 | m_PreserveUVs: 0 66 | m_IgnoreNormalsForChartDetection: 0 67 | m_ImportantGI: 0 68 | m_StitchLightmapSeams: 0 69 | m_SelectedEditorRenderState: 0 70 | m_MinimumChartSize: 4 71 | m_AutoUVMaxDistance: 0.5 72 | m_AutoUVMaxAngle: 89 73 | m_LightmapParameters: {fileID: 0} 74 | m_SortingLayerID: 0 75 | m_SortingLayer: 0 76 | m_SortingOrder: 0 77 | m_Sprite: {fileID: 21300000, guid: 4137edeadcb9a9043983b6acf66b2fbd, type: 3} 78 | m_Color: {r: 0.4852941, g: 1, b: 0.48884377, a: 1} 79 | m_FlipX: 0 80 | m_FlipY: 0 81 | m_DrawMode: 0 82 | m_Size: {x: 1, y: 1} 83 | m_AdaptiveModeThreshold: 0.5 84 | m_SpriteTileMode: 0 85 | m_WasSpriteAssigned: 1 86 | m_MaskInteraction: 0 87 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/Prefabs/Ball.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22a16ae0ecbcf0449b025d8e6c4f2d29 3 | timeCreated: 1498644748 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/Prefabs/Racket.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1001 &100100000 4 | Prefab: 5 | m_ObjectHideFlags: 1 6 | serializedVersion: 2 7 | m_Modification: 8 | m_TransformParent: {fileID: 0} 9 | m_Modifications: [] 10 | m_RemovedComponents: [] 11 | m_ParentPrefab: {fileID: 0} 12 | m_RootGameObject: {fileID: 1975003033902114} 13 | m_IsPrefabParent: 1 14 | --- !u!1 &1975003033902114 15 | GameObject: 16 | m_ObjectHideFlags: 0 17 | m_PrefabParentObject: {fileID: 0} 18 | m_PrefabInternal: {fileID: 100100000} 19 | serializedVersion: 5 20 | m_Component: 21 | - component: {fileID: 4448845194486528} 22 | - component: {fileID: 212283258840072408} 23 | m_Layer: 0 24 | m_Name: Racket 25 | m_TagString: Untagged 26 | m_Icon: {fileID: 0} 27 | m_NavMeshLayer: 0 28 | m_StaticEditorFlags: 0 29 | m_IsActive: 1 30 | --- !u!4 &4448845194486528 31 | Transform: 32 | m_ObjectHideFlags: 1 33 | m_PrefabParentObject: {fileID: 0} 34 | m_PrefabInternal: {fileID: 100100000} 35 | m_GameObject: {fileID: 1975003033902114} 36 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 37 | m_LocalPosition: {x: 0, y: 0, z: 0} 38 | m_LocalScale: {x: 1, y: 1, z: 1} 39 | m_Children: [] 40 | m_Father: {fileID: 0} 41 | m_RootOrder: 0 42 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 43 | --- !u!212 &212283258840072408 44 | SpriteRenderer: 45 | m_ObjectHideFlags: 1 46 | m_PrefabParentObject: {fileID: 0} 47 | m_PrefabInternal: {fileID: 100100000} 48 | m_GameObject: {fileID: 1975003033902114} 49 | m_Enabled: 1 50 | m_CastShadows: 0 51 | m_ReceiveShadows: 0 52 | m_DynamicOccludee: 1 53 | m_MotionVectors: 1 54 | m_LightProbeUsage: 1 55 | m_ReflectionProbeUsage: 1 56 | m_Materials: 57 | - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 58 | m_StaticBatchInfo: 59 | firstSubMesh: 0 60 | subMeshCount: 0 61 | m_StaticBatchRoot: {fileID: 0} 62 | m_ProbeAnchor: {fileID: 0} 63 | m_LightProbeVolumeOverride: {fileID: 0} 64 | m_ScaleInLightmap: 1 65 | m_PreserveUVs: 0 66 | m_IgnoreNormalsForChartDetection: 0 67 | m_ImportantGI: 0 68 | m_StitchLightmapSeams: 0 69 | m_SelectedEditorRenderState: 0 70 | m_MinimumChartSize: 4 71 | m_AutoUVMaxDistance: 0.5 72 | m_AutoUVMaxAngle: 89 73 | m_LightmapParameters: {fileID: 0} 74 | m_SortingLayerID: 0 75 | m_SortingLayer: 0 76 | m_SortingOrder: 0 77 | m_Sprite: {fileID: 21300000, guid: 4137edeadcb9a9043983b6acf66b2fbd, type: 3} 78 | m_Color: {r: 0.4419334, g: 0.82790697, b: 0.9852941, a: 1} 79 | m_FlipX: 0 80 | m_FlipY: 0 81 | m_DrawMode: 0 82 | m_Size: {x: 1, y: 1} 83 | m_AdaptiveModeThreshold: 0.5 84 | m_SpriteTileMode: 0 85 | m_WasSpriteAssigned: 1 86 | m_MaskInteraction: 0 87 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/Prefabs/Racket.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ed7a52445ab3c049a3a8f62991b2738 3 | timeCreated: 1498646492 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/Prefabs/ShowInfoPong.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2177005d1a2a92d4c9731b085eca9275 3 | timeCreated: 1521119843 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 100100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/Prefabs/Wall.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1001 &100100000 4 | Prefab: 5 | m_ObjectHideFlags: 1 6 | serializedVersion: 2 7 | m_Modification: 8 | m_TransformParent: {fileID: 0} 9 | m_Modifications: [] 10 | m_RemovedComponents: [] 11 | m_ParentPrefab: {fileID: 0} 12 | m_RootGameObject: {fileID: 1293932126161144} 13 | m_IsPrefabParent: 1 14 | --- !u!1 &1293932126161144 15 | GameObject: 16 | m_ObjectHideFlags: 0 17 | m_PrefabParentObject: {fileID: 0} 18 | m_PrefabInternal: {fileID: 100100000} 19 | serializedVersion: 5 20 | m_Component: 21 | - component: {fileID: 4046632056673478} 22 | - component: {fileID: 212010830281008886} 23 | m_Layer: 0 24 | m_Name: Wall 25 | m_TagString: Untagged 26 | m_Icon: {fileID: 0} 27 | m_NavMeshLayer: 0 28 | m_StaticEditorFlags: 0 29 | m_IsActive: 1 30 | --- !u!4 &4046632056673478 31 | Transform: 32 | m_ObjectHideFlags: 1 33 | m_PrefabParentObject: {fileID: 0} 34 | m_PrefabInternal: {fileID: 100100000} 35 | m_GameObject: {fileID: 1293932126161144} 36 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 37 | m_LocalPosition: {x: 0, y: 0, z: 0} 38 | m_LocalScale: {x: 1, y: 1, z: 1} 39 | m_Children: [] 40 | m_Father: {fileID: 0} 41 | m_RootOrder: 0 42 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 43 | --- !u!212 &212010830281008886 44 | SpriteRenderer: 45 | m_ObjectHideFlags: 1 46 | m_PrefabParentObject: {fileID: 0} 47 | m_PrefabInternal: {fileID: 100100000} 48 | m_GameObject: {fileID: 1293932126161144} 49 | m_Enabled: 1 50 | m_CastShadows: 0 51 | m_ReceiveShadows: 0 52 | m_DynamicOccludee: 1 53 | m_MotionVectors: 1 54 | m_LightProbeUsage: 1 55 | m_ReflectionProbeUsage: 1 56 | m_Materials: 57 | - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 58 | m_StaticBatchInfo: 59 | firstSubMesh: 0 60 | subMeshCount: 0 61 | m_StaticBatchRoot: {fileID: 0} 62 | m_ProbeAnchor: {fileID: 0} 63 | m_LightProbeVolumeOverride: {fileID: 0} 64 | m_ScaleInLightmap: 1 65 | m_PreserveUVs: 0 66 | m_IgnoreNormalsForChartDetection: 0 67 | m_ImportantGI: 0 68 | m_StitchLightmapSeams: 0 69 | m_SelectedEditorRenderState: 0 70 | m_MinimumChartSize: 4 71 | m_AutoUVMaxDistance: 0.5 72 | m_AutoUVMaxAngle: 89 73 | m_LightmapParameters: {fileID: 0} 74 | m_SortingLayerID: 0 75 | m_SortingLayer: 0 76 | m_SortingOrder: 0 77 | m_Sprite: {fileID: 21300000, guid: 4137edeadcb9a9043983b6acf66b2fbd, type: 3} 78 | m_Color: {r: 1, g: 1, b: 1, a: 1} 79 | m_FlipX: 0 80 | m_FlipY: 0 81 | m_DrawMode: 0 82 | m_Size: {x: 1, y: 1} 83 | m_AdaptiveModeThreshold: 0.5 84 | m_SpriteTileMode: 0 85 | m_WasSpriteAssigned: 1 86 | m_MaskInteraction: 0 87 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/Prefabs/Wall.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d7d76c06369635045af004fdc5257797 3 | timeCreated: 1498644468 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/Scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df0ed21544b460247a164208fe057675 3 | timeCreated: 1521117171 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/ShowInfoPong.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | public class ShowInfoPong : MonoBehaviour { 7 | public PongDQLRunner DQLrunner; 8 | public PongPPORunner PPOrunner; 9 | public PongEnvironment environment; 10 | public Text stepsText; 11 | public Text episodeText; 12 | public Text leftWinText; 13 | public Text rightWinText; 14 | public Text leftWinPerText; 15 | public Text leftHitPercText; 16 | public Text infoText; 17 | // Use this for initialization 18 | void Start () { 19 | 20 | } 21 | 22 | // Update is called once per frame 23 | void Update() { 24 | if (DQLrunner && DQLrunner.isActiveAndEnabled) 25 | { 26 | stepsText.text = "Total Steps: " + DQLrunner.Steps.ToString(); 27 | episodeText.text = "Total Episodes: " + DQLrunner.currentEpisode.ToString(); 28 | leftWinText.text = DQLrunner.leftWin.ToString(); 29 | rightWinText.text = DQLrunner.rightWin.ToString(); 30 | leftWinPerText.text = "Win Rate: " + (DQLrunner.winningRate50Left.Average).ToString(); 31 | leftHitPercText.text = "Ave Reward: " + DQLrunner.reward50EpiLeft.Average.ToString(); 32 | infoText.gameObject.SetActive(false); 33 | } 34 | else if (PPOrunner && PPOrunner.isActiveAndEnabled) 35 | { 36 | stepsText.text = "Total Steps: " + PPOrunner.Steps.ToString(); 37 | episodeText.text = "Total Episodes: " + PPOrunner.currentEpisode.ToString(); 38 | leftWinText.text = PPOrunner.leftWin.ToString(); 39 | rightWinText.text = PPOrunner.rightWin.ToString(); 40 | leftWinPerText.text = "Win Rate: " + (PPOrunner.winningRate50Left.Average).ToString(); 41 | leftHitPercText.text = "Ave Reward: " + PPOrunner.episodePointAve.Average.ToString(); 42 | infoText.gameObject.SetActive(true); 43 | infoText.text = "PPO not working for this yet"; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/Examples/Pong/ShowInfoPong.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 446a4ef7306250c4d9fef43f9fdd79a1 3 | timeCreated: 1509477885 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/PPO.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 29c05745e66518940870ca8475164879 3 | folderAsset: yes 4 | timeCreated: 1520526416 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/PPO/PPOModel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 859c2afef1fd0b64487e81c424e0b28b 3 | timeCreated: 1520526450 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/PPO/PPONetworks.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 046e8da78f4822642976f24fbb4d39b4 3 | timeCreated: 1520526450 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/PPO/Trainers.PPO.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a45fe044285685f4cb0217340f3afb8d 3 | timeCreated: 1520692147 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/ReinforcementLearning/PPO/readme.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0dbbb75e56b4ef64e88f9afaa9b6f2fe 3 | timeCreated: 1521102647 4 | licenseType: Free 5 | TextScriptImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/UniversalStyleTransfer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 241309aea195e1d45b28a43763e4474f 3 | folderAsset: yes 4 | timeCreated: 1513246713 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/UniversalStyleTransfer/Data.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4242af60cef92fc4f890663bb6d76563 3 | folderAsset: yes 4 | timeCreated: 1513253209 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/UniversalStyleTransfer/Data/UST_combined.bytes: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:8f585ad7000015197344ada33e4b2a236259e8460216c10692d72d4d81362cbf 3 | size 120347888 4 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/UniversalStyleTransfer/Data/UST_combined.bytes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0c5f420ba7f3c464f81a25af23c5d091 3 | timeCreated: 1515657680 4 | licenseType: Free 5 | TextScriptImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/UniversalStyleTransfer/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 549101575c7af41488de770e622132e6 3 | folderAsset: yes 4 | timeCreated: 1517488570 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/UniversalStyleTransfer/Editor/StyleTransferBatchInspector.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEditor; 4 | using UnityEngine; 5 | 6 | namespace UnityCNTK 7 | { 8 | 9 | [CustomEditor(typeof(StyleTransferBatchHelper))] 10 | public class StyleTransferBatchInspector : UnityEditor.Editor 11 | { 12 | StyleTransferBatchHelper transferHelper; 13 | 14 | private void OnEnable() 15 | { 16 | transferHelper = (StyleTransferBatchHelper)target; 17 | } 18 | 19 | public override void OnInspectorGUI() 20 | { 21 | 22 | Undo.RecordObject(transferHelper, "StyleTransfer"); 23 | 24 | 25 | if(GUILayout.Button("Update Materials")) 26 | { 27 | transferHelper.UpdateMaterialList(); 28 | } 29 | 30 | //effected materials 31 | EditorGUILayout.LabelField("Effected materials"); 32 | List keys = new List(transferHelper.matTextureDic.Keys); 33 | foreach(var m in keys) 34 | { 35 | EditorGUILayout.BeginHorizontal(); 36 | EditorGUILayout.ObjectField(m, typeof(Material),true); 37 | if (GUILayout.Button("Remove")) 38 | { 39 | transferHelper.matTextureDic.Remove(m); 40 | } 41 | EditorGUILayout.EndHorizontal(); 42 | } 43 | 44 | //for test, show the texutre dics 45 | /*EditorGUILayout.LabelField("Texture old new dic"); 46 | List texKeys = new List(transferHelper.oldNewTextureDic.Keys); 47 | foreach (var t in texKeys) 48 | { 49 | EditorGUILayout.BeginHorizontal(); 50 | EditorGUILayout.ObjectField(t, typeof(Texture2D), true); 51 | EditorGUILayout.EndHorizontal(); 52 | }*/ 53 | 54 | transferHelper.styleTexture = EditorGUILayout.ObjectField("Style Texture",transferHelper.styleTexture, typeof(Texture2D), true) as Texture2D; 55 | transferHelper.styleTransferModelData = EditorGUILayout.ObjectField("NN data",transferHelper.styleTransferModelData, typeof(TextAsset), true) as TextAsset; 56 | 57 | //transfor parameters 58 | EditorGUILayout.LabelField("Transfer parameters"); 59 | foreach (var t in transferHelper.styleTransferParams) 60 | { 61 | t.BlendFactor = EditorGUILayout.Slider("Blend Strength", t.BlendFactor,0,1); 62 | } 63 | 64 | if (GUILayout.Button("Transfer All")) 65 | { 66 | transferHelper.TransferAll(); 67 | } 68 | } 69 | } 70 | 71 | } -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/UniversalStyleTransfer/Editor/StyleTransferBatchInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 78b5606da60d7a3449b42a0773ea6d7b 3 | timeCreated: 1518266936 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/UniversalStyleTransfer/Editor/StyleTransferBatchWindow.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | using UnityCNTK.Tools.StyleAndTexture; 5 | using System.Collections.Generic; 6 | using System.Threading.Tasks; 7 | using CNTK; 8 | using System; 9 | 10 | namespace UnityCNTK.Editor 11 | { 12 | 13 | /// 14 | /// This is not used yet as a window. 15 | /// 16 | public class StyleTransferBatch 17 | { 18 | 19 | } 20 | 21 | 22 | } -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/UniversalStyleTransfer/Editor/StyleTransferBatchWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d127e774fb1b0774f8cacbd88c2fd5d5 3 | timeCreated: 1518020953 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: 9 | - m_PersistentViewDataDictionary: {instanceID: 0} 10 | - showImageMat: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 11 | - styleTransferModelData: {fileID: 4900000, guid: 0c5f420ba7f3c464f81a25af23c5d091, 12 | type: 3} 13 | executionOrder: 0 14 | icon: {instanceID: 0} 15 | userData: 16 | assetBundleName: 17 | assetBundleVariant: 18 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/UniversalStyleTransfer/Editor/StyleTransferWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe486b8c02f36cb4ca7208c921e16271 3 | timeCreated: 1518020953 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: 9 | - m_PersistentViewDataDictionary: {instanceID: 0} 10 | - showImageMat: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 11 | - styleTransferModelData: {fileID: 4900000, guid: 0c5f420ba7f3c464f81a25af23c5d091, 12 | type: 3} 13 | executionOrder: 0 14 | icon: {instanceID: 0} 15 | userData: 16 | assetBundleName: 17 | assetBundleVariant: 18 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/UniversalStyleTransfer/StyleTransferBatchHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1724ae38c11888443bfc04cd4a0c92ff 3 | timeCreated: 1518269034 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: 9 | - styleTexture: {instanceID: 0} 10 | - styleTransferModelData: {fileID: 4900000, guid: 0c5f420ba7f3c464f81a25af23c5d091, 11 | type: 3} 12 | executionOrder: 0 13 | icon: {instanceID: 0} 14 | userData: 15 | assetBundleName: 16 | assetBundleVariant: 17 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/UniversalStyleTransfer/UniversalStyleTransfer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 239eb4a4927cb9e499f8784092f2fd26 3 | timeCreated: 1513246744 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/UniversalStyleTransfer/readme.md: -------------------------------------------------------------------------------- 1 | # Universal Style Transfer 2 | 3 | ## Overview 4 | Here is the original paper: https://arxiv.org/pdf/1705.08086.pdf 5 | 6 | The implementation here is somehow based on this: https://github.com/eridgd/WCT-TF and this:https://github.com/sunshineatnoon/PytorchWCT and this: https://github.com/Yijunmaverick/UniversalStyleTransfer 7 | 8 | See https://www.youtube.com/watch?v=v1oWke0Qf1E for a brief explanation. 9 | 10 | ## Some notes of the algorithm 11 | This section of helpful if you want to want to know what does the parameters mean in this algorithm. Please make sure you understand the youtube video above before you read the following. 12 | ### VGG 13 | Universal Style Transfer uses [VGG](https://gist.github.com/ksimonyan/3785162f95cd2d5fee77) as the encoder. The output of different layers of VGG represent the feature map of the input image with different receptive field. For example, a number from a deeper layer's output might mean whether a 64x64 patch on the original image has a dog shape while one from a shallower layer might mean whether a 3x3 patch on the original image has a vertical line. 14 | ### Feature Transform 15 | Universal Style Transfer uses Whitening and Coloring operation on the output feature maps from VGG to blend the style and content image. (Whitening and Coloring is nothing about color) 16 | 17 | Whitening(https://en.wikipedia.org/wiki/Whitening_transformation/) basically means to apply matrix multipliacations to a bunch of data point so that those data's covariance matrix is identity matrix, so that those data is uncorrelated. 18 | 19 | Coloring is the inverse of Whitening. 20 | 21 | UST does whitening on content image's feature maps and color the whitened feature maps with the style image's transform matrices. The new feature map then transfered. The new feature map will be linearly blended with the original content feature map, and then decoded to a output image using the decoder. 22 | ### Multi-level Stylization 23 | Universal Style Transfer does the encoding-whitening/coloring-decoding multiple times with different depth of VGG encoder to achieve a better looking result. See the figure below: 24 | ![style transfer pipeline](https://github.com/tcmxx/CNTKUnityTools/blob/master/Docs/Images/UST-pipeline.png) 25 | 26 | ## Usage: 27 | ### Unity Editor Tool 28 | In Unity Editor menu go to Window/UnityDeepLearningTools/StyleTransferTool 29 | 30 | ### C# API 31 | 32 | ```csharp 33 | //create the model. the styleTransferModelData.bytes is the binary files provided that contains all needed pretrained data of the network. 34 | var styleTransferModel = new UniversalStyleTransferModel(CNTK.DeviceDescriptor.GPUDevice(0), styleTransferModelData.bytes); 35 | //build it with specified dimentions 36 | styleTransferModel.CreateModelWithDimensions(contentSize, styleSize); 37 | 38 | // Get the raw data of content and style imagefrom the Unity Texture2D object using helper functions. 39 | var tempContentTexture = Images.GetReadableTextureFromUnreadable(contentTexture); 40 | byte[] contentBytes = tempContentTexture.GetRGB24FromTexture2D(contentResize); 41 | 42 | var tempStyleTexture = Images.GetReadableTextureFromUnreadable(styleTexture); 43 | byte[] styleBytes = tempStyleTexture.GetRGB24FromTexture2D(styleResize); 44 | //destroy the tempeary texture if you want. 45 | DestroyImmediate(tempStyleTexture); 46 | DestroyImmediate(tempContentTexture); 47 | 48 | //specify the which passes to run and what are the parameters in each pass 49 | //PassIndex 1 means transfer with the VGG deepest level. 50 | var styleTransferParams = new List(); 51 | for (int i = 0; i < 5; ++i) 52 | { 53 | styleTransferParams.Insert(0, new UniversalStyleTransferModel.ParameterSet((UniversalStyleTransferModel.PassIndex)i)); 54 | } 55 | //execute the transfer and get the result image data 56 | byte[] result = styleTransferModel.TransferStyle(contentBytes, styleBytes, styleTransferParams.ToArray()); 57 | //put it on a new texture 58 | Texture2D tex = new Texture2D(contentResize.x, contentResize.y, TextureFormat.RGB24, false); 59 | tex.LoadRawTextureData(result); 60 | tex.Apply(); 61 | ``` 62 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/Assets/UnityCNTK/Tools/UniversalStyleTransfer/readme.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a8ac2d4fc9671d429485083fe55b522 3 | timeCreated: 1521102647 4 | licenseType: Free 5 | TextScriptImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_EnablePCM: 1 18 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 19 | m_AutoSimulation: 1 20 | m_AutoSyncTransforms: 1 21 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_ExternalVersionControlSupport: Hidden Meta Files 8 | m_SerializationMode: 2 9 | m_DefaultBehaviorMode: 0 10 | m_SpritePackerMode: 0 11 | m_SpritePackerPaddingPower: 1 12 | m_EtcTextureCompressorBehavior: 1 13 | m_EtcTextureFastCompressor: 1 14 | m_EtcTextureNormalCompressor: 2 15 | m_EtcTextureBestCompressor: 4 16 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 17 | m_ProjectGenerationRootNamespace: 18 | m_UserGeneratedProjectSuffix: 19 | m_CollabEditorSettings: 20 | inProgressEnabled: 1 21 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AutoSyncTransforms: 1 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2017.3.1f1 2 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /DeepLearningToolsForUnity/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate 14 | m_Enabled: 0 15 | m_CaptureEditorExceptions: 1 16 | UnityPurchasingSettings: 17 | m_Enabled: 0 18 | m_TestMode: 0 19 | UnityAnalyticsSettings: 20 | m_Enabled: 0 21 | m_InitializeOnStartup: 1 22 | m_TestMode: 0 23 | m_TestEventUrl: 24 | m_TestConfigUrl: 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /Docs/Images/UST-pipeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/Docs/Images/UST-pipeline.png -------------------------------------------------------------------------------- /Docs/Images/advantage-equation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcmxx/CNTKUnityTools/aabec5db467e1df6bc0b67b828de3e583624a1a5/Docs/Images/advantage-equation.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # AI and Deep learning tools for Unity using CNTK 3 | 4 | ## Note 5 | This project was developed for Aalto University's Computational Intelligence in Games course material. 6 | 7 | The development is stopped now, because we decided to use Tensorflowsharp with Unity MLAgent instead of CNTK for multiplatform support. The new project will be in public soon. [Here](https://github.com/tcmxx/UnityTensorflowKeras). 8 | 9 | ## Content 10 | This rep contains some useful deep learning related tools implemented primarily using CNTK C# library. 11 | Current contents: 12 | - Helper functions to build/train neural network layers. (https://docs.microsoft.com/en-us/cognitive-toolkit/) 13 | - Layers definitions 14 | - Simple neural network 15 | - cGAN 16 | - Universal Style Transfer(https://arxiv.org/pdf/1705.08086.pdf) 17 | - Reinforcement Learning 18 |  - Proximal Policy Optimization(PPO)(https://arxiv.org/pdf/1707.06347.pdf) 19 | - Deep Q-Learning(DQL)(https://arxiv.org/abs/1312.5602) 20 | 21 | ## Platform and Installation 22 | Currently it only works on Windows. If you need to use GPU for NN, you also need a proper Nvidia graphic card. 23 | Installation steps: 24 | 1. Download the repo(Unity project) 25 | 2. Download the zip that includes necessary dlls https://drive.google.com/open?id=1VWEiXJw3PSdeXfBrimPevdCWdbUyHd_0 26 | 3. Put the dlls in correct places: (Adapted from https://github.com/aiunderstand/unity-cntk/blob/master/README.md.) 27 | - Put those files/folders into any Plugins folder under /DeepLearningToolsForUnity/Assets. 28 | * Cntk.Core.Managed-2.4.dll 29 | * MathNet.Numerics.dll 30 | * MathNet.Numerics.MKL.dll 31 | * System.Drawing.dll 32 | * Accord folder 33 | - Copy the other dlls(not folders), and put them DIRECTLY under /DeepLearningToolsForUnity folder, or another place where Windows can find those dlls. 34 | 4. Done. 35 | 36 | Note that the file Assets/UnityCNTK/Tools/UniversalStyleTransfer/Data/UST_combined.bytes uses Git LFS, be sure you download it correctly (It should be larger than 100MB) 37 | 38 | ## Documentation 39 | Go to [Wiki](https://github.com/tcmxx/CNTKUnityTools/wiki) to see detailed documentaion. 40 | --------------------------------------------------------------------------------