Training now works / bug memory error while training
This commit is contained in:
parent
e3482a3eab
commit
82a4c23258
@ -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
|
||||
|
@ -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
Notebooks/UnitySDK.log
15742
Notebooks/UnitySDK.log
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user