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

brainParameters: brainParameters:
vectorObservationSize: 0 vectorObservationSize: 0
numStackedVectorObservations: 1 numStackedVectorObservations: 1
vectorActionSize: 0200000002000000
vectorActionSize: 04000000
cameraResolutions: cameraResolutions:
- width: 320 - width: 320
height: 240 height: 240
blackAndWhite: 0 blackAndWhite: 0
vectorActionDescriptions: vectorActionDescriptions:
- forward
- rotation
-
vectorActionSpaceType: 0 vectorActionSpaceType: 0
model: {fileID: 0} model: {fileID: 0}
inferenceDevice: 0 inferenceDevice: 0

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

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

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


AddReward(-0.01f); AddReward(-0.01f);


movement.Turn(-1); movement.Turn(-1);
break; break;
default: default:
movement.Move(0);
//movement.Move(0);
throw new ArgumentException("Invalid action value. Stop movement."); throw new ArgumentException("Invalid action value. Stop movement.");
} }


// If centerOfGravity lies near to the center of the image horizontally // 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) if (centerOfGravity.X > renderCamera.targetTexture.width / 2 - nearAreaLimit && centerOfGravity.X < renderCamera.targetTexture.width / 2 + nearAreaLimit)
{ {
Done();
SetReward(1); SetReward(1);
print("Reward: +1"); print("Reward: +1");
} }
else if (centerOfGravity.X > renderCamera.targetTexture.width / 2 - farAreaLimit && centerOfGravity.X < renderCamera.targetTexture.width / 2 + farAreaLimit) 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 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