deconvnet模型中自定义层中的警告

liwlm1x9  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(251)

我已经为图像分割的deconvnet模型编写了代码。关于unpol层,我使用了fabianbormann开发的代码。我称这个层为“unpolinglayer”,而他称之为“maxunpolwithargmax”。
我检查了虚拟模型(Functional api)中的非冷却层:

input_tensor = Input(shape=(128,128,1))

   pool1, pool1_argmax = Lambda(max_pool_with_argmax, name='max_pool1')(input_tensor)

   x = Conv2D(64, kernel_size=3, padding='same', kernel_initializer='he_normal', name='stage1_conv1')(pool1)

   unpool1 = UnpoolingLayer(pool1_argmax, name='unpool1')(x)
   unpool1.set_shape(pool1.get_shape())

   x = Conv2D(64, kernel_size=3, padding='same', kernel_initializer='he_normal', name='stage1_conv1')(unpool1)

   model = Model(inputs = input_tensor, outputs = x)
   model.summary()

但是,我得到以下警告:

AssertionError
Error transforming entity <bound method UnpoolingLayer.call of <__main__.UnpoolingLayer object at 0x00000166564FFC88>>
WARNING:tensorflow:AutoGraph could not transform <bound method UnpoolingLayer.call of <__main__.UnpoolingLayer object at 0x00000166564FFC88>> and will run it as-is.

以及:

Traceback (most recent call last):
  File "C:\Users\Anaconda3\envs\tf21\lib\site-packages\tensorflow_core\python\autograph\impl\api.py", line 526, in converted_call
    converted_f = conversion.convert(target_entity, program_ctx)
  File "C:\Users\Anaconda3\envs\tf21\lib\site-packages\tensorflow_core\python\autograph\impl\conversion.py", line 328, in convert
    return _instantiate(entity, converted_entity_info, free_nonglobal_var_names)
  File "C:\Users\Anaconda3\envs\tf21\lib\site-packages\tensorflow_core\python\autograph\impl\conversion.py", line 266, in _instantiate
    factory = converted_entity_info.get_factory()
  File "C:\Users\Anaconda3\envs\tf21\lib\site-packages\tensorflow_core\python\autograph\impl\conversion.py", line 92, in get_factory
    assert self.module_name in sys.modules
AssertionError

我还有几个:

INFO:tensorflow:Converted call: <bound method UnpoolingLayer.call of <__main__.UnpoolingLayer object 
at 0x00000166564FFC88>>
args: (<tf.Tensor 'stage1_conv1_1/Identity:0' shape=(None, 64, 64, 64) dtype=float32>,)
kwargs: {}

以及模型摘要:

_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
input_2 (InputLayer)         [(None, 128, 128, 1)]     0         
_________________________________________________________________
max_pool1 (Lambda)           MaxPoolWithArgmax(output= 0         
_________________________________________________________________
stage1_conv1 (Conv2D)        (None, 64, 64, 64)        640       
_________________________________________________________________
unpool1 (UnpoolingLayer)     (None, None, None, None)  0         
=================================================================
Total params: 640
Trainable params: 640
Non-trainable params: 0
_________________________________________________________________

有人知道发生了什么事吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题