Browse Source

Action Mask and working cozmo

Development
Tobi 5 years ago
parent
commit
ecd9ad491d

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

cameraResolutions: cameraResolutions:
- width: 80 - width: 80
height: 30 height: 30
blackAndWhite: 0
blackAndWhite: 1
vectorActionDescriptions: vectorActionDescriptions:
- -
vectorActionSpaceType: 0 vectorActionSpaceType: 0
model: {fileID: 0}
model: {fileID: 11400000, guid: 24baaa8c605c1a74785880885cf04847, type: 3}
inferenceDevice: 0 inferenceDevice: 0

BIN
Assets/Brains/CozmoLearningBrain.nn View File


+ 10
- 0
Assets/Brains/CozmoLearningBrain.nn.meta View File

fileFormatVersion: 2
guid: 24baaa8c605c1a74785880885cf04847
ScriptedImporter:
fileIDToRecycleName:
11400000: Assets/Brains/CozmoLearningBrain.nn
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 83221ad3db87f4b3b91b041047cb2bc5, type: 3}

BIN
Assets/Brains/CozmoTrainedBrain.nn View File


+ 10
- 0
Assets/Brains/CozmoTrainedBrain.nn.meta View File

fileFormatVersion: 2
guid: c9717311ba788544a9b6db7dd147300d
ScriptedImporter:
fileIDToRecycleName:
11400002: Assets/Brains/CozmoTrainedBrain.nn
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 83221ad3db87f4b3b91b041047cb2bc5, type: 3}

+ 265
- 0
Assets/Prefabs/CozmoBot/Cozmo.prefab View File

%YAML 1.1 %YAML 1.1
%TAG !u! tag:unity3d.com,2011: %TAG !u! tag:unity3d.com,2011:
--- !u!1 &891713638
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 891713639}
- component: {fileID: 891713640}
- component: {fileID: 891713641}
m_Layer: 0
m_Name: RenderTextureCamera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &891713639
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 891713638}
m_LocalRotation: {x: 0.30070576, y: 0, z: 0, w: 0.953717}
m_LocalPosition: {x: 0, y: 0.037, z: 0.0319}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7570006595835424293}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 35, y: 0, z: 0}
--- !u!20 &891713640
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 891713638}
m_Enabled: 0
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.01
far clip plane: 2
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 8400000, guid: 196f45b12806aaa449adc2ee1ca3b091, type: 2}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!114 &891713641
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 891713638}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b940f59f459dc49479614595d02dcbbc, type: 3}
m_Name:
m_EditorClassIdentifier:
renderTextureCropped: {fileID: 8400000, guid: 8bf12f4401860c043a77209428e97b29,
type: 2}
processedImageRenderer: {fileID: 0}
processedImageRendererCropped: {fileID: 0}
--- !u!1 &7536190859451953316
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6557257430302465736}
- component: {fileID: 6829507564963703646}
m_Layer: 0
m_Name: Camera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6557257430302465736
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7536190859451953316}
m_LocalRotation: {x: 0.30070576, y: 0, z: 0, w: 0.953717}
m_LocalPosition: {x: 0, y: 0.037, z: 0.0319}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7570006595835424293}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 35, y: 0, z: 0}
--- !u!20 &6829507564963703646
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7536190859451953316}
m_Enabled: 0
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.01
far clip plane: 2
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!1 &7570006595835424292 --- !u!1 &7570006595835424292
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 7570006595835424293} - component: {fileID: 7570006595835424293}
- component: {fileID: 7570006596986120127}
- component: {fileID: 7570006596986120126}
- component: {fileID: 7570006596986120125}
- component: {fileID: 7570006596986120128}
- component: {fileID: 7570006596986120129}
- component: {fileID: 7570006596986120130}
m_Layer: 0 m_Layer: 0
m_Name: Cozmo m_Name: Cozmo
m_TagString: Untagged m_TagString: Untagged
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 1857425275648181110} - {fileID: 1857425275648181110}
- {fileID: 891713639}
- {fileID: 6557257430302465736}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!54 &7570006596986120127
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7570006595835424292}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 84
m_CollisionDetection: 0
--- !u!65 &7570006596986120126
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7570006595835424292}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.05, y: 0.07, z: 0.08}
m_Center: {x: 0, y: 0.035, z: 0}
--- !u!114 &7570006596986120125
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7570006595835424292}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 234fd6e10ef55ad4b82b3153890ab5d9, type: 3}
m_Name:
m_EditorClassIdentifier:
brain: {fileID: 11400000, guid: 0d9d5ce547064a648b466ad7f208cf3d, type: 2}
agentParameters:
agentCameras: []
agentRenderTextures:
- {fileID: 8400000, guid: 8bf12f4401860c043a77209428e97b29, type: 2}
maxStep: 5000
resetOnDone: 1
onDemandDecision: 1
numberOfActionsBetweenDecisions: 1
renderCamera: {fileID: 891713640}
movementController: {fileID: 7570006596986120130}
timeBetweenDecisionsAtInference: 0.15
--- !u!114 &7570006596986120128
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7570006595835424292}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d2056048a78a0cc4c97e7899ba1c0e31, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Speed: 0.0535
m_TurnSpeed: 55
--- !u!114 &7570006596986120129
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7570006595835424292}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4265d0764c65d26409f0f920e5293c82, type: 3}
m_Name:
m_EditorClassIdentifier:
testState: 1
isTesting: 0
--- !u!114 &7570006596986120130
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7570006595835424292}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d3ecda30187828846b48edbee97aebd7, type: 3}
m_Name:
m_EditorClassIdentifier:
currentMovementState: 0
--- !u!1001 &1857425275647793654 --- !u!1001 &1857425275647793654
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

+ 55
- 352
Assets/Scenes/CozmoTraining.unity View File

m_Component: m_Component:
- component: {fileID: 99578049} - component: {fileID: 99578049}
m_Layer: 0 m_Layer: 0
m_Name: Environment
m_Name: Environment_0
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
- {fileID: 2078653368} - {fileID: 2078653368}
- {fileID: 435986020} - {fileID: 435986020}
- {fileID: 712179487} - {fileID: 712179487}
- {fileID: 7570006596986120124}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 1
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &125995086 --- !u!1 &125995086
GameObject: GameObject:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 0.1, y: 0.1, z: 0.1} m_Size: {x: 0.1, y: 0.1, z: 0.1}
m_Center: {x: 0, y: 0, z: 0.030643802} m_Center: {x: 0, y: 0, z: 0.030643802}
--- !u!1 &589453881
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 589453883}
- component: {fileID: 589453882}
m_Layer: 0
m_Name: Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!20 &589453882
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 589453881}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.01
far clip plane: 2
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &589453883
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 589453881}
m_LocalRotation: {x: 0.30070576, y: 0, z: 0, w: 0.953717}
m_LocalPosition: {x: 0, y: 0.037, z: 0.0319}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7570006596986120124}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 35, y: 0, z: 0}
--- !u!1 &712179486 --- !u!1 &712179486
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
- {fileID: 774534267} - {fileID: 774534267}
- {fileID: 380448016} - {fileID: 380448016}
- {fileID: 1159195260} - {fileID: 1159195260}
- {fileID: 0}
- {fileID: 0}
--- !u!4 &776834971 --- !u!4 &776834971
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &827847801 --- !u!1 &827847801
GameObject: GameObject:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 827847801} m_GameObject: {fileID: 827847801}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &891713638
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 891713639}
- component: {fileID: 891713640}
- component: {fileID: 891713641}
m_Layer: 0
m_Name: RenderTextureCamera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &891713639
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 891713638}
m_LocalRotation: {x: 0.30070576, y: 0, z: 0, w: 0.953717}
m_LocalPosition: {x: 0, y: 0.037, z: 0.0319}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7570006596986120124}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 35, y: 0, z: 0}
--- !u!20 &891713640
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 891713638}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.01
far clip plane: 2
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 8400000, guid: 196f45b12806aaa449adc2ee1ca3b091, type: 2}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!114 &891713641
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 891713638}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b940f59f459dc49479614595d02dcbbc, type: 3}
m_Name:
m_EditorClassIdentifier:
renderTextureCropped: {fileID: 8400000, guid: 8bf12f4401860c043a77209428e97b29,
type: 2}
processedImageRenderer: {fileID: 1863707383}
processedImageRendererCropped: {fileID: 712179489}
--- !u!1 &918537782 --- !u!1 &918537782
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
- {fileID: 11400000, guid: 0d9d5ce547064a648b466ad7f208cf3d, type: 2} - {fileID: 11400000, guid: 0d9d5ce547064a648b466ad7f208cf3d, type: 2}
_brainsToControl: _brainsToControl:
- {fileID: 0} - {fileID: 0}
- {fileID: 11400000, guid: 0d9d5ce547064a648b466ad7f208cf3d, type: 2}
maxSteps: 1000
maxSteps: 1500
trainingConfiguration: trainingConfiguration:
width: 80 width: 80
height: 30 height: 30
qualityLevel: 1 qualityLevel: 1
timeScale: 10
timeScale: 2
targetFrameRate: -1 targetFrameRate: -1
inferenceConfiguration: inferenceConfiguration:
width: 320
height: 120
width: 1280
height: 920
qualityLevel: 5 qualityLevel: 5
timeScale: 1 timeScale: 1
targetFrameRate: 60 targetFrameRate: 60
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 2
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1159195260 --- !u!1 &1159195260
GameObject: GameObject:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1863707380} m_GameObject: {fileID: 1863707380}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1957393249
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1957393252}
- component: {fileID: 1957393251}
- component: {fileID: 1957393250}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1957393250
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1957393249}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1957393251
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1957393249}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &1957393252
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1957393249}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2078653367 --- !u!1 &2078653367
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 2 serializedVersion: 2
m_Modification: m_Modification:
m_TransformParent: {fileID: 0}
m_TransformParent: {fileID: 99578049}
m_Modifications: m_Modifications:
- target: {fileID: 7570006595835424292, guid: 0f97dac5215d69a4795763340d82925d, - target: {fileID: 7570006595835424292, guid: 0f97dac5215d69a4795763340d82925d,
type: 3} type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Cozmo value: Cozmo
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7570006595835424292, guid: 0f97dac5215d69a4795763340d82925d,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7570006595835424292, guid: 0f97dac5215d69a4795763340d82925d,
type: 3}
propertyPath: m_Icon
value:
objectReference: {fileID: 0}
- target: {fileID: 1857425275647696726, guid: 0f97dac5215d69a4795763340d82925d,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7570006595835424293, guid: 0f97dac5215d69a4795763340d82925d, - target: {fileID: 7570006595835424293, guid: 0f97dac5215d69a4795763340d82925d,
type: 3} type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
- target: {fileID: 7570006595835424293, guid: 0f97dac5215d69a4795763340d82925d, - target: {fileID: 7570006595835424293, guid: 0f97dac5215d69a4795763340d82925d,
type: 3} type: 3}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
value: 0
value: -0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7570006595835424293, guid: 0f97dac5215d69a4795763340d82925d, - target: {fileID: 7570006595835424293, guid: 0f97dac5215d69a4795763340d82925d,
type: 3} type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
value: 0
value: -0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7570006595835424293, guid: 0f97dac5215d69a4795763340d82925d, - target: {fileID: 7570006595835424293, guid: 0f97dac5215d69a4795763340d82925d,
type: 3} type: 3}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
value: 0
value: -0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7570006595835424293, guid: 0f97dac5215d69a4795763340d82925d, - target: {fileID: 7570006595835424293, guid: 0f97dac5215d69a4795763340d82925d,
type: 3} type: 3}
- target: {fileID: 7570006595835424293, guid: 0f97dac5215d69a4795763340d82925d, - target: {fileID: 7570006595835424293, guid: 0f97dac5215d69a4795763340d82925d,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 3
value: 7
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7570006595835424293, guid: 0f97dac5215d69a4795763340d82925d, - target: {fileID: 7570006595835424293, guid: 0f97dac5215d69a4795763340d82925d,
type: 3} type: 3}
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7570006596986120125, guid: 0f97dac5215d69a4795763340d82925d,
type: 3}
propertyPath: agentParameters.maxStep
value: 1500
objectReference: {fileID: 0}
- target: {fileID: 7570006596986120125, guid: 0f97dac5215d69a4795763340d82925d,
type: 3}
propertyPath: timeBetweenDecisionsAtInference
value: 0.04
objectReference: {fileID: 0}
- target: {fileID: 891713638, guid: 0f97dac5215d69a4795763340d82925d, type: 3}
propertyPath: m_TagString
value: Untagged
objectReference: {fileID: 0}
- target: {fileID: 891713638, guid: 0f97dac5215d69a4795763340d82925d, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 891713640, guid: 0f97dac5215d69a4795763340d82925d, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 891713641, guid: 0f97dac5215d69a4795763340d82925d, type: 3}
propertyPath: processedImageRenderer
value:
objectReference: {fileID: 1863707383}
- target: {fileID: 891713641, guid: 0f97dac5215d69a4795763340d82925d, type: 3}
propertyPath: processedImageRendererCropped
value:
objectReference: {fileID: 712179489}
- target: {fileID: 589453881, guid: 0f97dac5215d69a4795763340d82925d, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6829507564963703646, guid: 0f97dac5215d69a4795763340d82925d,
type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 0f97dac5215d69a4795763340d82925d, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 0f97dac5215d69a4795763340d82925d, type: 3}
--- !u!1 &7570006596986120123 stripped --- !u!1 &7570006596986120123 stripped
type: 3} type: 3}
m_PrefabInstance: {fileID: 7570006596986120122} m_PrefabInstance: {fileID: 7570006596986120122}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!114 &7570006596986120125
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7570006596986120123}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 234fd6e10ef55ad4b82b3153890ab5d9, type: 3}
m_Name:
m_EditorClassIdentifier:
brain: {fileID: 11400000, guid: 0d9d5ce547064a648b466ad7f208cf3d, type: 2}
agentParameters:
agentCameras: []
agentRenderTextures:
- {fileID: 8400000, guid: 8bf12f4401860c043a77209428e97b29, type: 2}
maxStep: 5000
resetOnDone: 1
onDemandDecision: 1
numberOfActionsBetweenDecisions: 1
renderCamera: {fileID: 891713640}
movementController: {fileID: 7570006596986120130}
timeBetweenDecisionsAtInference: 0.15
--- !u!65 &7570006596986120126
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7570006596986120123}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.05, y: 0.07, z: 0.08}
m_Center: {x: 0, y: 0.035, z: 0}
--- !u!54 &7570006596986120127
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7570006596986120123}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 84
m_CollisionDetection: 0
--- !u!114 &7570006596986120128
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7570006596986120123}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d2056048a78a0cc4c97e7899ba1c0e31, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Speed: 0.0535
m_TurnSpeed: 55
--- !u!114 &7570006596986120129
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7570006596986120123}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4265d0764c65d26409f0f920e5293c82, type: 3}
m_Name:
m_EditorClassIdentifier:
testState: 1
isTesting: 0
--- !u!114 &7570006596986120130
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7570006596986120123}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d3ecda30187828846b48edbee97aebd7, type: 3}
m_Name:
m_EditorClassIdentifier:
currentMovementState: 0

+ 65
- 6
Assets/Scripts/ML Cozmo/CozmoAgent.cs View File

private ImageProcessor imageProcessor; // reference to the ImageProcessor private ImageProcessor imageProcessor; // reference to the ImageProcessor
private int nearAreaLimit = 0; // X coordinate limit for the near to the imagecenter area private int nearAreaLimit = 0; // X coordinate limit for the near to the imagecenter area
private int centerOfImageX = 0; // Middle of the image in x direction private int centerOfImageX = 0; // Middle of the image in x direction
private MovementState lastChosenMovement = MovementState.Stop; // The last action/movement that was executed

private double startTime = Time.time;


private void Start() private void Start()
{ {
} }




public override void CollectObservations()
{
SetMask();
}

// Set ActionMask for training
private void SetMask()
{
switch (lastChosenMovement)
{
// Do not allow stop decision after a stop
case (MovementState.Stop):
SetActionMask(STOP);
break;
// Do not allow stop after forward
case (MovementState.Forward):
SetActionMask(STOP);
break;
// Do not allow stop & left after right
case (MovementState.Right):
SetActionMask(STOP);
SetActionMask(LEFT);
break;
// Do not allow stop & right after left
case (MovementState.Left):
SetActionMask(STOP);
SetActionMask(RIGHT);
break;
default:
throw new ArgumentException("Invalid MovementState.");
}
}

// 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)
{ {
double elapsedTime = Time.time - startTime;
print("Elapsed time: " + elapsedTime);
startTime = Time.time;

int action = Mathf.FloorToInt(vectorAction[0]); int action = Mathf.FloorToInt(vectorAction[0]);
Point centerOfGravity = imageProcessor.CenterOfGravity; Point centerOfGravity = imageProcessor.CenterOfGravity;


{ {
case STOP: case STOP:
movementController.currentMovementState = MovementState.Stop; movementController.currentMovementState = MovementState.Stop;
lastChosenMovement = MovementState.Stop;
//Test
SetReward(-0.1f);
break; break;
case FORWARD: case FORWARD:
movementController.currentMovementState = MovementState.Forward; movementController.currentMovementState = MovementState.Forward;
lastChosenMovement = MovementState.Forward;
//Test
SetReward(0.01f);
break; break;
case RIGHT: case RIGHT:
movementController.currentMovementState = MovementState.Right; movementController.currentMovementState = MovementState.Right;
lastChosenMovement = MovementState.Right;
//Test
SetReward(-0.02f);
break; break;
case LEFT: case LEFT:
movementController.currentMovementState = MovementState.Left; movementController.currentMovementState = MovementState.Left;
lastChosenMovement = MovementState.Left;
//Test
SetReward(-0.02f);
break; break;
default: default:
//movement.Move(0); //movement.Move(0);
float reward = 0; float reward = 0;


// Center of gravity is far away from the center (left) // Center of gravity is far away from the center (left)
if (centerOfGravityX <= centerOfImageX - nearAreaLimit)
if (centerOfGravityX <= centerOfImageX - nearAreaLimit && centerOfGravityX >= 0)
{ {
float range = centerOfImageX - nearAreaLimit; float range = centerOfImageX - nearAreaLimit;
reward = -(1 - (centerOfGravityX / range)); reward = -(1 - (centerOfGravityX / range));
// Clamp the reward to max -1 in order to handle rewards if the center of gravity is outside of the image // Clamp the reward to max -1 in order to handle rewards if the center of gravity is outside of the image
reward = Mathf.Clamp(reward, -1, 0);
reward = Mathf.Clamp(reward, -1, 0) / 2;
} }
// Center of gravity is near left of the center // Center of gravity is near left of the center
else if (centerOfGravityX <= centerOfImageX)
else if ((centerOfGravityX <= centerOfImageX) && (centerOfGravityX >= (centerOfImageX - nearAreaLimit)))
{ {
float range = centerOfImageX - (centerOfImageX - nearAreaLimit); float range = centerOfImageX - (centerOfImageX - nearAreaLimit);
float distanceToLeftFarBorder = centerOfGravityX - (centerOfImageX - nearAreaLimit); float distanceToLeftFarBorder = centerOfGravityX - (centerOfImageX - nearAreaLimit);
reward = (distanceToLeftFarBorder / range); reward = (distanceToLeftFarBorder / range);
} }
// Center of gravity is far away from the center (right) // Center of gravity is far away from the center (right)
else if (centerOfGravityX >= centerOfImageX + nearAreaLimit)
else if ((centerOfGravityX >= (centerOfImageX + nearAreaLimit)) && (centerOfGravityX <= renderCamera.targetTexture.width))
{ {
float range = renderCamera.targetTexture.width - (centerOfImageX + nearAreaLimit); float range = renderCamera.targetTexture.width - (centerOfImageX + nearAreaLimit);
reward = -(((centerOfGravityX - (centerOfImageX + nearAreaLimit)) / range)); reward = -(((centerOfGravityX - (centerOfImageX + nearAreaLimit)) / range));
// Clamp the reward to max -1 in order to handle rewards if the center of gravity is outside of the image // Clamp the reward to max -1 in order to handle rewards if the center of gravity is outside of the image
reward = Mathf.Clamp(reward, -1, 0);
reward = Mathf.Clamp(reward, -1, 0) / 2;
} }
// Center of gravity is near right of the center // Center of gravity is near right of the center
else if (centerOfGravityX >= centerOfImageX)
else if ((centerOfGravityX >= centerOfImageX) && (centerOfGravityX <= (centerOfImageX + nearAreaLimit)))
{ {
float range = (centerOfImageX + nearAreaLimit) - centerOfImageX; float range = (centerOfImageX + nearAreaLimit) - centerOfImageX;
float distanceToCenterOfImage = centerOfGravityX - centerOfImageX; float distanceToCenterOfImage = centerOfGravityX - centerOfImageX;
reward = (1 - distanceToCenterOfImage / range); reward = (1 - distanceToCenterOfImage / range);
} }
else
{
SetReward(-1);
AgentReset();
Debug.Log("Out of image range");
}


Debug.Log("Reward: " + reward);
SetReward(reward); SetReward(reward);
} }



Assets/Textures/RenderTextures/CozmoCannyCroped.renderTexture → Assets/Textures/RenderTextures/CozmoCannyCroped_0.renderTexture View File

m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: CozmoCannyCroped
m_Name: CozmoCannyCroped_0
m_ImageContentsHash: m_ImageContentsHash:
serializedVersion: 2 serializedVersion: 2
Hash: 00000000000000000000000000000000 Hash: 00000000000000000000000000000000

Assets/Textures/RenderTextures/CozmoCannyCroped.renderTexture.meta → Assets/Textures/RenderTextures/CozmoCannyCroped_0.renderTexture.meta View File


Assets/Textures/RenderTextures/TestVisualBanana.renderTexture → Assets/Textures/RenderTextures/CozmoCannyCroped_1.renderTexture View File

m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: TestVisualBanana
m_Name: CozmoCannyCroped_1
m_ImageContentsHash: m_ImageContentsHash:
serializedVersion: 2 serializedVersion: 2
Hash: 00000000000000000000000000000000 Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4 m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0 m_DownscaleFallback: 0
m_Width: 256
m_Height: 256
m_Width: 80
m_Height: 30
m_AntiAliasing: 1 m_AntiAliasing: 1
m_DepthFormat: 2 m_DepthFormat: 2
m_ColorFormat: 0 m_ColorFormat: 0

Assets/Textures/RenderTextures/TestVisualBanana.renderTexture.meta → Assets/Textures/RenderTextures/CozmoCannyCroped_1.renderTexture.meta View File

fileFormatVersion: 2 fileFormatVersion: 2
guid: 7cf95f69a56a16641b7419b518ba13ff
guid: c2570513b195a074d9ddc7c75b245858
NativeFormatImporter: NativeFormatImporter:
externalObjects: {} externalObjects: {}
mainObjectFileID: 8400000 mainObjectFileID: 8400000

Assets/Textures/RenderTextures/CozmoCannyTexture.renderTexture → Assets/Textures/RenderTextures/CozmoCannyTexture_0.renderTexture View File

m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: CozmoCannyTexture
m_Name: CozmoCannyTexture_0
m_ImageContentsHash: m_ImageContentsHash:
serializedVersion: 2 serializedVersion: 2
Hash: 00000000000000000000000000000000 Hash: 00000000000000000000000000000000

Assets/Textures/RenderTextures/CozmoCannyTexture.renderTexture.meta → Assets/Textures/RenderTextures/CozmoCannyTexture_0.renderTexture.meta View File


+ 34
- 0
Assets/Textures/RenderTextures/CozmoCannyTexture_1.renderTexture View File

%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: CozmoCannyTexture_1
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_Width: 320
m_Height: 240
m_AntiAliasing: 1
m_DepthFormat: 2
m_ColorFormat: 0
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1

+ 8
- 0
Assets/Textures/RenderTextures/CozmoCannyTexture_1.renderTexture.meta View File

fileFormatVersion: 2
guid: 55aff4f34c0a7134eae7f9be35397deb
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 8400000
userData:
assetBundleName:
assetBundleVariant:

+ 1
- 1
ConfigFiles/trainer_config.yaml View File

hidden_units: 128 hidden_units: 128
lambd: 0.95 lambd: 0.95
learning_rate: 3.0e-4 learning_rate: 3.0e-4
max_steps: 5.0e4
max_steps: 50.0e4
memory_size: 256 memory_size: 256
normalize: false normalize: false
num_epoch: 3 num_epoch: 3

+ 3
- 3
ProjectSettings/QualitySettings.asset View File

QualitySettings: QualitySettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 5 serializedVersion: 5
m_CurrentQuality: 4
m_CurrentQuality: 0
m_QualitySettings: m_QualitySettings:
- serializedVersion: 2 - serializedVersion: 2
name: Very Low name: Very Low
softVegetation: 0 softVegetation: 0
realtimeReflectionProbes: 0 realtimeReflectionProbes: 0
billboardsFaceCameraPosition: 0 billboardsFaceCameraPosition: 0
vSyncCount: 0
vSyncCount: 1
lodBias: 0.3 lodBias: 0.3
maximumLODLevel: 0 maximumLODLevel: 0
streamingMipmapsActive: 0 streamingMipmapsActive: 0
Nintendo Switch: 5 Nintendo Switch: 5
PS4: 5 PS4: 5
PSP2: 2 PSP2: 2
Standalone: 5
Standalone: 0
Tizen: 2 Tizen: 2
WebGL: 3 WebGL: 3
WiiU: 5 WiiU: 5

+ 24682
- 0
UnitySDK.log
File diff suppressed because it is too large
View File


+ 6
- 0
notebooks/.ipynb_checkpoints/Untitled-checkpoint.ipynb View File

{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}

+ 79
- 0
notebooks/Untitled.ipynb View File

{
"cells": [
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[0 1]\n",
"[1 0]\n"
]
}
],
"source": [
"import numpy as np\n",
"\n",
"y_out = [[[-0.52742714, -0.8918941 , -0.53989583, -0.874211 ]]]\n",
"\n",
"outputs = y_out[0][0]\n",
"\n",
"prob_action1 = outputs[:2]\n",
"prob_action2 = outputs[2:]\n",
"\n",
"norm_action1 = [float(i)/sum(prob_action1) for i in prob_action1]\n",
"norm_action2 = [float(i)/sum(prob_action2) for i in prob_action2]\n",
"\n",
"action1 = np.random.multinomial(1,norm_action1)\n",
"action2 = np.random.multinomial(1,norm_action2)\n",
"print(action1)\n",
"print(action2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

Loading…
Cancel
Save