模型Mask_Rcnn訓練錯誤:RuntimeError: It looks like you are subclassing 'Model'


一、問題:

         最近在keras下利用兩個GPU訓練Mask_Rcnn模型的時候出現以下錯誤。

error:RuntimeError: It looks like you are subclassing 'Model'	
and you forgot to call 'super(YourClass, self).__init__()'

  二、解決方法:

         在mrcnn/parallel_model.py文件中找到class ParallelModel(KM.Model),在類里面添加super(ParallelModel, self).__init__()

class ParallelModel(KM.Model):
    def __init__(self, keras_model, gpu_count):
    """
   Class constructor.
       keras_model: The Keras model to parallelize
       gpu_count: Number of GPUs. Must be > 1
   """
   super(ParallelModel, self).__init__()
   self.inner_model = keras_model
   self.gpu_count = gpu_count
   merged_outputs = self.make_parallel()
   super(ParallelModel, self).__init__(inputs=self.inner_model.inputs, outputs=merged_outputs)

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM