0

当我尝试在 Jupyter Notebook 中运行 NiftyNet Promise12 Demo 的推理部分时出现以下错误。

   AttributeError                            Traceback (most recent call last)
<ipython-input-3-f9444ce4ad73> in <module>()
      3 import niftynet
      4 sys.argv=['', 'inference','-a','net_segment','--conf',os.path.join('demos','PROMISE12','promise12_demo_inference_config.ini')]
----> 5 niftynet.main()

~/BI/NN/NiftyNet/niftynet/__init__.py in main()
    118     app_driver = ApplicationDriver()
    119     app_driver.initialise_application(system_param, input_data_param)
--> 120     app_driver.run_application()
    121     return 0

~/BI/NN/NiftyNet/niftynet/engine/application_driver.py in run_application(self)
    254             # start samplers' threads
    255             self._run_sampler_threads(session=session)
--> 256             self.graph = self._create_graph(self.graph)
    257 
    258             # check app variables initialised and ready for starts

~/BI/NN/NiftyNet/niftynet/engine/application_driver.py in _create_graph(self, graph)
    330                         self.app.connect_data_and_network(
    331                             self.outputs_collector,
--> 332                             self.gradients_collector)
    333                         if self.is_training:
    334                             # batch norm statistics from the last device

~/BI/NN/NiftyNet/niftynet/application/segmentation_application.py in connect_data_and_network(self, outputs_collector, gradients_collector)
    288             grads = self.optimiser.compute_gradients(loss)
    289             # collecting gradients variables
--> 290             gradients_collector.add_to_collection([grads])
    291             # collecting output variables
    292             outputs_collector.add_to_collection(

    AttributeError: 'NoneType' object has no attribute 'add_to_collection'

我目前正在使用 Python 3.4 和 Tensorflow 1.4.1。我该如何解决?

4

1 回答 1

0

niftynet.main()在笔记本中调用后未正确清除应用程序状态。每次重新启动内核niftynet.main()可以避免这个问题。它也在最新版本的 NiftyNet 中得到修复。谢谢!

于 2018-04-21T16:52:05.190 回答