Browse Source

Training now works / bug memory error while training

Development
Tobi 5 years ago
parent
commit
82a4c23258

+ 2
- 3
Assets/Brains/CozmoLearningBrain.asset View File

@@ -15,14 +15,13 @@ MonoBehaviour:
brainParameters:
vectorObservationSize: 0
numStackedVectorObservations: 1
vectorActionSize: 0200000002000000
vectorActionSize: 04000000
cameraResolutions:
- width: 320
height: 240
blackAndWhite: 0
vectorActionDescriptions:
- forward
- rotation
-
vectorActionSpaceType: 0
model: {fileID: 0}
inferenceDevice: 0

+ 9
- 10
Assets/Scripts/ML Cozmo/CozmoAgent.cs View File

@@ -51,10 +51,12 @@ public class CozmoAgent : Agent
// to be implemented by the developer
public override void AgentAction(float[] vectorAction, string textAction)
{
//print("Action before FloorToInt: " + vectorAction[0]);
int action = Mathf.FloorToInt(vectorAction[0]);
Point centerOfGravity = onRenderImageTest.CenterOfGravity;
Vector3 targetPos = transform.position;
//Vector3 targetPos = transform.position;

//print("Action after FloorToInt: " + action);

AddReward(-0.01f);

@@ -73,7 +75,7 @@ public class CozmoAgent : Agent
movement.Turn(-1);
break;
default:
movement.Move(0);
//movement.Move(0);
throw new ArgumentException("Invalid action value. Stop movement.");
}

@@ -87,21 +89,18 @@ public class CozmoAgent : Agent
// If centerOfGravity lies near to the center of the image horizontally
if (centerOfGravity.X > renderCamera.targetTexture.width / 2 - nearAreaLimit && centerOfGravity.X < renderCamera.targetTexture.width / 2 + nearAreaLimit)
{
Done();
SetReward(1);
print("Reward: +1");
}
else if (centerOfGravity.X > renderCamera.targetTexture.width / 2 - farAreaLimit && centerOfGravity.X < renderCamera.targetTexture.width / 2 + farAreaLimit)
{
Done();
SetReward(-1);
print("Reward: -1");
SetReward(-0.7f);
print("Reward: -0.7");
}
else
{
Done();
SetReward(-2);
print("Reward: -2");
SetReward(-1);
print("Reward: -1");
}
}


+ 15742
- 0
Notebooks/UnitySDK.log
File diff suppressed because it is too large
View File


+ 21
- 1018
Notebooks/getting-started.ipynb
File diff suppressed because it is too large
View File


Loading…
Cancel
Save