Skip to content

Commit 45ce330

Browse files
committed
a bunch of polishing and fixes
1 parent 9e3e34d commit 45ce330

File tree

49 files changed

+1855
-490
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1855
-490
lines changed

Assets/UnityTensorflow/Common/Utils/StatsLogger.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@ public void AddData(string name, float datapoint, int logAverageFrequency = 1)
3838
averageCounter[name] = new AutoAverage(logAverageFrequency);
3939
}
4040

41-
data[name].Add(datapoint);
41+
4242
averageCounter[name].AddValue(datapoint);
43+
if (averageCounter[name].JustUpdated)
44+
{
45+
data[name].Add(averageCounter[name].Average);
46+
}
4347
if (LogToGrapher && averageCounter[name].JustUpdated)
4448
{
4549
#if UNITY_EDITOR

Assets/UnityTensorflow/Examples/GAN2DPlane/GANTest.unity

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ MonoBehaviour:
258258
m_ObjectArgument: {fileID: 0}
259259
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
260260
m_IntArgument: 100
261-
m_FloatArgument: 0.3
261+
m_FloatArgument: 0.05
262262
m_StringArgument:
263263
m_BoolArgument: 0
264264
m_CallState: 2
@@ -1194,7 +1194,7 @@ MonoBehaviour:
11941194
dataPointShader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
11951195
dataPointTexture: {fileID: 10912, guid: 0000000000000000f000000000000000, type: 0}
11961196
dataPointMesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
1197-
drawScale: 0.2
1197+
drawScale: 0.03
11981198
shaderColorVarName: _Color
11991199
shaderTextureVarName: _MainTex
12001200
drawLayer:

Assets/UnityTensorflow/Examples/GAN2DPlane/Scripts/DataPlane2D.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void RenderAll()
3939
var points = dataset[i];
4040
foreach(var p in points)
4141
{
42-
var matP = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one);
42+
var matP = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale);
4343

4444
Matrix4x4 mat = matP * Matrix4x4.TRS(new Vector3(p.x, p.y, -0.01f), Quaternion.identity, Vector3.one * drawScale);
4545
Graphics.DrawMesh(dataPointMesh, mat, mats[i], drawLayer);
@@ -161,22 +161,22 @@ public void Generate4GuassianData(float s)
161161
for (int i = 0; i < 1000; ++i)
162162
{
163163
Vector2 pos = new Vector2(MathUtils.NextGaussianFloat()* s, MathUtils.NextGaussianFloat() * s);
164-
AddDatapoint(pos + new Vector2(-2,-2), 0);
164+
AddDatapoint(pos + new Vector2(-0.25f,-0.25f), 0);
165165
}
166166
for (int i = 0; i < 1000; ++i)
167167
{
168168
Vector2 pos = new Vector2(MathUtils.NextGaussianFloat() * s, MathUtils.NextGaussianFloat() * s);
169-
AddDatapoint(pos + new Vector2(2, -2), 0);
169+
AddDatapoint(pos + new Vector2(0.25f, -0.25f), 0);
170170
}
171171
for (int i = 0; i < 1000; ++i)
172172
{
173173
Vector2 pos = new Vector2(MathUtils.NextGaussianFloat() * s, MathUtils.NextGaussianFloat() * s);
174-
AddDatapoint(pos + new Vector2(2, 2), 0);
174+
AddDatapoint(pos + new Vector2(0.25f, 0.25f), 0);
175175
}
176176
for (int i = 0; i < 1000; ++i)
177177
{
178178
Vector2 pos = new Vector2(MathUtils.NextGaussianFloat() * s, MathUtils.NextGaussianFloat() * s);
179-
AddDatapoint(pos + new Vector2(-2, 2), 0);
179+
AddDatapoint(pos + new Vector2(-0.25f, 0.25f), 0);
180180
}
181181
}
182182
}

Assets/UnityTensorflow/Examples/GAN2DPlane/Scripts/DataPlane2DTrainHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void TrainOnce(int episodes)
6363

6464
public void UseGAN(int generatedNumber)
6565
{
66-
float[,] generated = (float[,])modelRef.GenerateBatch(null, MathUtils.GenerateWhiteNoise(generatedNumber, -1, 1, modelRef.inputNoiseShape));
66+
float[,] generated = (float[,])modelRef.GenerateBatch(null, MathUtils.GenerateWhiteNoise(generatedNumber, -1f, 1f, modelRef.inputNoiseShape));
6767

6868
dataPlane.RemovePointsOfType(1);
6969
for (int i = 0; i < generatedNumber; ++i)

Assets/UnityTensorflow/Examples/IntelligentPool/BilliardMAESOnly-OneShot-UseMAESDirectly.unity

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,21 @@ NavMeshSettings:
113113
debug:
114114
m_Flags: 0
115115
m_NavMeshData: {fileID: 0}
116+
--- !u!1 &89133528 stripped
117+
GameObject:
118+
m_PrefabParentObject: {fileID: 1191541447028974, guid: 938e363109f3bd143903f0b192439d85,
119+
type: 2}
120+
m_PrefabInternal: {fileID: 713657354}
116121
--- !u!20 &132445805 stripped
117122
Camera:
118123
m_PrefabParentObject: {fileID: 20162049599415638, guid: 61c28c3b413277a48bd7a8243798695a,
119124
type: 2}
120125
m_PrefabInternal: {fileID: 644482134}
126+
--- !u!1 &557095905 stripped
127+
GameObject:
128+
m_PrefabParentObject: {fileID: 1331902089308288, guid: 938e363109f3bd143903f0b192439d85,
129+
type: 2}
130+
m_PrefabInternal: {fileID: 713657354}
121131
--- !u!1001 &644482134
122132
Prefab:
123133
m_ObjectHideFlags: 0
@@ -332,6 +342,16 @@ Prefab:
332342
propertyPath: m_AnchorMax.y
333343
value: 0
334344
objectReference: {fileID: 0}
345+
- target: {fileID: 114263354044584962, guid: 938e363109f3bd143903f0b192439d85,
346+
type: 2}
347+
propertyPath: startOptButtonRef
348+
value:
349+
objectReference: {fileID: 557095905}
350+
- target: {fileID: 114263354044584962, guid: 938e363109f3bd143903f0b192439d85,
351+
type: 2}
352+
propertyPath: endOptButtonRef
353+
value:
354+
objectReference: {fileID: 89133528}
335355
m_RemovedComponents: []
336356
m_ParentPrefab: {fileID: 100100000, guid: 938e363109f3bd143903f0b192439d85, type: 2}
337357
m_IsPrefabParent: 0
@@ -491,7 +511,7 @@ MonoBehaviour:
491511
initialStepSize: 1
492512
mode: 1
493513
maxIteration: 100
494-
targetValue: 2
514+
targetValue: 1.9
495515
evaluationBatchSize: 8
496516
iteration: 0
497517
--- !u!1001 &1363941755

Assets/UnityTensorflow/Examples/IntelligentPool/BilliardMAESOnly-OneShot-UseTrainer.unity

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,14 @@ Prefab:
562562
propertyPath: m_AnchorMax.y
563563
value: 0
564564
objectReference: {fileID: 0}
565+
- target: {fileID: 1986365504759340, guid: db0f163ff1982d64985f44d81eaf13d1, type: 2}
566+
propertyPath: m_IsActive
567+
value: 0
568+
objectReference: {fileID: 0}
569+
- target: {fileID: 1202550805354182, guid: db0f163ff1982d64985f44d81eaf13d1, type: 2}
570+
propertyPath: m_IsActive
571+
value: 0
572+
objectReference: {fileID: 0}
565573
m_RemovedComponents: []
566574
m_ParentPrefab: {fileID: 100100000, guid: db0f163ff1982d64985f44d81eaf13d1, type: 2}
567575
m_IsPrefabParent: 0
@@ -697,6 +705,16 @@ Prefab:
697705
propertyPath: brain
698706
value:
699707
objectReference: {fileID: 1327012119}
708+
- target: {fileID: 114924759199247932, guid: 21bdff36071a0444eae34d1a5f0211ba,
709+
type: 2}
710+
propertyPath: targetValue
711+
value: 1.8
712+
objectReference: {fileID: 0}
713+
- target: {fileID: 114924759199247932, guid: 21bdff36071a0444eae34d1a5f0211ba,
714+
type: 2}
715+
propertyPath: maxIteration
716+
value: 50
717+
objectReference: {fileID: 0}
700718
m_RemovedComponents: []
701719
m_ParentPrefab: {fileID: 100100000, guid: 21bdff36071a0444eae34d1a5f0211ba, type: 2}
702720
m_IsPrefabParent: 0

Assets/UnityTensorflow/Examples/IntelligentPool/BilliardRL-OneShot.unity

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,17 @@ MonoBehaviour:
768768
m_Script: {fileID: 11500000, guid: 80885700eae055d47977cc84fd00de74, type: 3}
769769
m_Name:
770770
m_EditorClassIdentifier:
771+
checkpointTOLoad: {fileID: 0}
772+
trainingEnabled: 0
771773
network: {fileID: 11400000, guid: 0d4457cfcce2a624d9e661e4e79a870b, type: 2}
774+
optimizer:
775+
optimizerType: 0
776+
parameterList:
777+
- 0.001
778+
- 0.9
779+
- 0.999
780+
- 0.00000001
781+
- 0
772782
--- !u!1 &824392021
773783
GameObject:
774784
m_ObjectHideFlags: 0
@@ -2099,13 +2109,12 @@ MonoBehaviour:
20992109
m_Script: {fileID: 11500000, guid: 6d491f9276717f244b7c13d65e0cb335, type: 3}
21002110
m_Name:
21012111
m_EditorClassIdentifier:
2102-
academyRef: {fileID: 1415431052}
2103-
isTraining: 1
21042112
modelRef: {fileID: 791075477}
2113+
isTraining: 1
21052114
parameters: {fileID: 11400000, guid: 063d746d40cfc3f4fa8e859ecf679eda, type: 2}
2106-
steps: 0
21072115
continueFromCheckpoint: 1
2108-
checkpointPath: Assets\UnityTensorflow\Examples\IntelligentPool\Data\PPOOneshotCheckpoint.bytes
2116+
checkpointPath: Assets\UnityTensorflow\Examples\IntelligentPool\Data\BilliardRL-OneShot.bytes
2117+
steps: 0
21092118
--- !u!114 &1567260242
21102119
MonoBehaviour:
21112120
m_ObjectHideFlags: 0
@@ -2237,7 +2246,7 @@ MonoBehaviour:
22372246
m_Name: (Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)
22382247
m_EditorClassIdentifier:
22392248
brain: {fileID: 1327012119}
2240-
trainer: {fileID: 1485033538}
2249+
trainer: {fileID: 0}
22412250
--- !u!1001 &1766243107
22422251
Prefab:
22432252
m_ObjectHideFlags: 0

Assets/UnityTensorflow/Examples/IntelligentPool/BilliardSLAndMAES-MultiShot.unity

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ MonoBehaviour:
511511
isTraining: 1
512512
parameters: {fileID: 11400000, guid: 2891adc9117296a4faec323f41fa9afb, type: 2}
513513
continueFromCheckpoint: 1
514-
checkpointPath: Assets\UnityTensorflow\Examples\IntelligentPool\Data\supervisedLMultishotCheckpoint.bytes
514+
checkpointPath: Assets\UnityTensorflow\Examples\IntelligentPool\Data\BilliardSLAndMAES-MultiShot.bytes
515515
steps: 0
516516
isCollectingData: 1
517517
dataBufferCount: 0
@@ -677,6 +677,10 @@ Prefab:
677677
propertyPath: m_IsActive
678678
value: 0
679679
objectReference: {fileID: 0}
680+
- target: {fileID: 1151558439856468, guid: db0f163ff1982d64985f44d81eaf13d1, type: 2}
681+
propertyPath: m_IsActive
682+
value: 0
683+
objectReference: {fileID: 0}
680684
m_RemovedComponents: []
681685
m_ParentPrefab: {fileID: 100100000, guid: db0f163ff1982d64985f44d81eaf13d1, type: 2}
682686
m_IsPrefabParent: 0
@@ -698,7 +702,7 @@ MonoBehaviour:
698702
m_Name: (Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)
699703
m_EditorClassIdentifier:
700704
brain: {fileID: 1327012119}
701-
trainer: {fileID: 949524764}
705+
trainer: {fileID: 0}
702706
--- !u!1 &1327012118
703707
GameObject:
704708
m_ObjectHideFlags: 0

Assets/UnityTensorflow/Examples/IntelligentPool/BilliardSLAndMAES-OneShot.unity

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,10 @@ Prefab:
630630
propertyPath: m_IsActive
631631
value: 1
632632
objectReference: {fileID: 0}
633+
- target: {fileID: 1202550805354182, guid: db0f163ff1982d64985f44d81eaf13d1, type: 2}
634+
propertyPath: m_IsActive
635+
value: 0
636+
objectReference: {fileID: 0}
633637
m_RemovedComponents: []
634638
m_ParentPrefab: {fileID: 100100000, guid: db0f163ff1982d64985f44d81eaf13d1, type: 2}
635639
m_IsPrefabParent: 0
@@ -739,6 +743,21 @@ Prefab:
739743
propertyPath: agentParameters.resetOnDone
740744
value: 0
741745
objectReference: {fileID: 0}
746+
- target: {fileID: 114988921453423414, guid: 516fb5a9405a3b141b40831dd2ba3441,
747+
type: 2}
748+
propertyPath: autoRequestDecision
749+
value: 0
750+
objectReference: {fileID: 0}
751+
- target: {fileID: 114988921453423414, guid: 516fb5a9405a3b141b40831dd2ba3441,
752+
type: 2}
753+
propertyPath: resetAfterOneShot
754+
value: 0
755+
objectReference: {fileID: 0}
756+
- target: {fileID: 114988921453423414, guid: 516fb5a9405a3b141b40831dd2ba3441,
757+
type: 2}
758+
propertyPath: targetValue
759+
value: 2
760+
objectReference: {fileID: 0}
742761
m_RemovedComponents: []
743762
m_ParentPrefab: {fileID: 100100000, guid: 516fb5a9405a3b141b40831dd2ba3441, type: 2}
744763
m_IsPrefabParent: 0
@@ -802,7 +821,7 @@ MonoBehaviour:
802821
width: 1280
803822
height: 720
804823
qualityLevel: 5
805-
timeScale: 1
824+
timeScale: 10
806825
targetFrameRate: 60
807826
resetParameters:
808827
resetParameters: []

0 commit comments

Comments
 (0)