我正在使用旧的 Unity 项目进行培训,但遇到了几个问题:
- 我能够进行培训并生成
.nn
文件,但是每当我将文件放入大脑时,它都会显示错误消息,上面写着argumentexception off-axis dimensions must match
.
Unity 控制台中显示以下内容:
ArgumentException: Off-axis dimensions must match
Barracuda.TensorExtensions.Concat (Barracuda.TensorShape[] shapes, System.Int32 axis) (at <1071b9a446b04698af9605e3e272de23>:0)
Barracuda.ModelAnalyzer.ListTemporaryTensorShapes (Barracuda.Model model, System.Collections.Generic.IDictionary`2[TKey,TValue] inputShapes, System.Collections.Generic.IDictionary`2[System.String,Barracuda.TensorShape]& shapesByName) (at <1071b9a446b04698af9605e3e272de23>:0)
Barracuda.ModelAnalyzer.TryGetOutputTensorShape (Barracuda.Model model, System.Collections.Generic.IDictionary`2[TKey,TValue] inputShapes, System.String output, Barracuda.TensorShape& shape) (at <1071b9a446b04698af9605e3e272de23>:0)
Barracuda.ModelAnalyzer.TryGetOutputTensorShape (Barracuda.Model model, System.String output, Barracuda.TensorShape& shape) (at <1071b9a446b04698af9605e3e272de23>:0)
Barracuda.ModelMetadataExtensions.GetShapeByName (Barracuda.Model model, System.String name) (at <1071b9a446b04698af9605e3e272de23>:0)
MLAgents.InferenceBrain.BarracudaModelParamLoader.CheckOutputTensorShape (MLAgents.InferenceBrain.BarracudaModelParamLoader+ModelActionType isContinuous, System.Int32 modelActionSize) (at Assets/ml-agents-master/UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/BarracudaModelParamLoader.cs:476)
MLAgents.InferenceBrain.BarracudaModelParamLoader.GenerateChecks () (at Assets/ml-agents-master/UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/BarracudaModelParamLoader.cs:186)
MLAgents.InferenceBrain.BarracudaModelParamLoader.GetLoaderAndCheck (Barracuda.IWorker engine, Barracuda.Model model, MLAgents.BrainParameters brainParameters) (at Assets/ml-agents-master/UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/BarracudaModelParamLoader.cs:46)
MLAgents.LearningBrain.ReloadModel (System.Int32 seed) (at Assets/ml-agents-master/UnitySDK/Assets/ML-Agents/Scripts/LearningBrain.cs:126)
MLAgents.LearningBrainEditor.OnInspectorGUI () (at Assets/ml-agents-master/UnitySDK/Assets/ML-Agents/Editor/LearningBrainEditor.cs:60)
UnityEditor.InspectorWindow.DoOnInspectorGUI (System.Boolean rebuildOptimizedGUIBlock, UnityEditor.Editor editor, System.Boolean wasVisible, UnityEngine.Rect& contentRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1625)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
- 我尝试训练“球平衡”示例并且也能够进行训练部分,但是当 python 尝试将
.pb
文件转换为.nn
文件时发生错误。(.nn
示例提供的文件虽然工作得很好)
Converting ./models/test-0/3DBallLearning/frozen_graph_def.pb to ./models/test-0/3DBallLearning.nn
IGNORED: Cast unknown layer
IGNORED: Range unknown layer
IGNORED: Transpose unknown layer
IGNORED: Shape unknown layer
IGNORED: TensorArrayV3 unknown layer
IGNORED: TensorArrayV3 unknown layer
IGNORED: Shape unknown layer
IGNORED: Range unknown layer
IGNORED: TensorArrayScatterV3 unknown layer
IGNORED: Enter unknown layer
IGNORED: Enter unknown layer
IGNORED: Enter unknown layer
IGNORED: Enter unknown layer
IGNORED: Enter unknown layer
IGNORED: Merge unknown layer
IGNORED: Merge unknown layer
IGNORED: Merge unknown layer
IGNORED: Merge unknown layer
IGNORED: Merge unknown layer
IGNORED: Less unknown layer
IGNORED: Enter unknown layer
IGNORED: Less unknown layer
IGNORED: Enter unknown layer
IGNORED: LogicalAnd unknown layer
IGNORED: LoopCond unknown layer
IGNORED: Switch unknown layer
IGNORED: Switch unknown layer
IGNORED: Switch unknown layer
IGNORED: Switch unknown layer
IGNORED: Switch unknown layer
IGNORED: TensorArrayReadV3 unknown layer
IGNORED: Enter unknown layer
IGNORED: Enter unknown layer
IGNORED: Enter unknown layer
IGNORED: Enter unknown layer
IGNORED: Split unknown layer
IGNORED: TensorArrayWriteV3 unknown layer
IGNORED: Enter unknown layer
IGNORED: NextIteration unknown layer
IGNORED: NextIteration unknown layer
IGNORED: NextIteration unknown layer
IGNORED: NextIteration unknown layer
IGNORED: NextIteration unknown layer
IGNORED: Exit unknown layer
IGNORED: Exit unknown layer
IGNORED: Exit unknown layer
IGNORED: TensorArraySizeV3 unknown layer
IGNORED: Range unknown layer
IGNORED: TensorArrayGatherV3 unknown layer
IGNORED: Range unknown layer
IGNORED: Transpose unknown layer
IGNORED: Range unknown layer
IGNORED: Transpose unknown layer
IGNORED: Shape unknown layer
IGNORED: TensorArrayV3 unknown layer
IGNORED: TensorArrayV3 unknown layer
IGNORED: Shape unknown layer
IGNORED: Range unknown layer
IGNORED: TensorArrayScatterV3 unknown layer
IGNORED: Enter unknown layer
IGNORED: Enter unknown layer
IGNORED: Enter unknown layer
IGNORED: Enter unknown layer
IGNORED: Enter unknown layer
IGNORED: Merge unknown layer
IGNORED: Merge unknown layer
IGNORED: Merge unknown layer
IGNORED: Merge unknown layer
IGNORED: Merge unknown layer
IGNORED: Less unknown layer
IGNORED: Enter unknown layer
IGNORED: Less unknown layer
IGNORED: Enter unknown layer
IGNORED: LogicalAnd unknown layer
IGNORED: LoopCond unknown layer
IGNORED: Switch unknown layer
IGNORED: Switch unknown layer
IGNORED: Switch unknown layer
IGNORED: Switch unknown layer
IGNORED: Switch unknown layer
IGNORED: TensorArrayReadV3 unknown layer
IGNORED: Enter unknown layer
IGNORED: Enter unknown layer
IGNORED: Enter unknown layer
IGNORED: Enter unknown layer
IGNORED: Split unknown layer
IGNORED: TensorArrayWriteV3 unknown layer
IGNORED: Enter unknown layer
IGNORED: NextIteration unknown layer
IGNORED: NextIteration unknown layer
IGNORED: NextIteration unknown layer
IGNORED: NextIteration unknown layer
IGNORED: NextIteration unknown layer
IGNORED: Exit unknown layer
IGNORED: Exit unknown layer
IGNORED: Exit unknown layer
IGNORED: TensorArraySizeV3 unknown layer
IGNORED: Range unknown layer
IGNORED: TensorArrayGatherV3 unknown layer
IGNORED: Range unknown layer
IGNORED: Transpose unknown layer
IGNORED: StopGradient unknown layer
Traceback (most recent call last):
File "C:\Users\chick\anaconda3\envs\ml-agents\Scripts\mlagents-learn-script.py", line 33, in <module>
sys.exit(load_entry_point('mlagents', 'console_scripts', 'mlagents-learn')())
File "e:\ml car\assets\ml-agents-master\ml-agents\mlagents\trainers\learn.py", line 262, in main
run_training(0, run_seed, options, Queue())
File "e:\ml car\assets\ml-agents-master\ml-agents\mlagents\trainers\learn.py", line 95, in run_training
tc.start_learning(env, trainer_config)
File "e:\ml car\assets\ml-agents-master\ml-agents\mlagents\trainers\trainer_controller.py", line 235, in start_learning
self._export_graph()
File "e:\ml car\assets\ml-agents-master\ml-agents\mlagents\trainers\trainer_controller.py", line 120, in _export_graph
self.trainers[brain_name].export_model()
File "e:\ml car\assets\ml-agents-master\ml-agents\mlagents\trainers\trainer.py", line 171, in export_model
self.policy.export_model()
File "e:\ml car\assets\ml-agents-master\ml-agents\mlagents\trainers\policy.py", line 203, in export_model
tf2bc.convert(self.model_path + '/frozen_graph_def.pb', self.model_path + '.nn')
File "e:\ml car\assets\ml-agents-master\ml-agents\mlagents\trainers\tensorflow_to_barracuda.py", line 1007, in convert
o_model.inputs = {i:o_input_shapes[i] for l in o_model.layers for i in l.inputs if i not in all_layers and i not in o_model.memories}
File "e:\ml car\assets\ml-agents-master\ml-agents\mlagents\trainers\tensorflow_to_barracuda.py", line 1007, in <dictcomp>
o_model.inputs = {i:o_input_shapes[i] for l in o_model.layers for i in l.inputs if i not in all_layers and i not in o_model.memories}
KeyError: 'lstm_policy/rnn/while/Switch:1'
我正在使用 Unity 2018.3.11 和 ML-agent 0.8.1
我已添加ENABLE_BARRACUDA
到我的项目设置中,但它似乎不起作用。