Lucid可以可视化MobileNet V3压缩/激励块

我已经使用提供的MobileNet V3定义(小的)训练了许多图形,但是当我运行(张量流)Lucid生成可视化效果时,Lucid失败并出现错误。如果我修改定义以排除“挤压/激发”块,则会生成可视化效果。

在安装了Tensorflow 1.14和Lucid之后,我从此处(https://github.com/tensorflow/models/tree/master/research/slim/nets/mobilenet)下载了经过培训的MobileNet V3图形文件“ Small dm = 0.75(float)”,将文件提取到我的“ D:/ temp”中,然后运行以下代码:

import tensorflow as tf
import lucid.optvis.render as render
from lucid.modelzoo.vision_base import Model

class SSdmobilenetV3( Model ):
    def __init__( self,graph_path  ):        
        self.model_path = graph_path
        self.input_name = "input"
        self.image_shape = [ 224,224,3 ]
        self.image_value_range = ( -1,1 )
        super().__init__()

model = SSdmobilenetV3( "D:/temp/v3-small_224_0.75_float/v3-small_224_0.75_float.pb" )
model.load_graphdef()

#model.show_graph()

_ = render.render_vis( model,"MobilenetV3/expanded_conv_6/output:0" )

有很多堆栈跟踪信息,但是关键错误是:

LookupError: gradient registry has no entry for: AddV2

LookupError: No gradient defined for operation 'import/MobilenetV3/expanded_conv_6/squeeze_excite/Conv_1/add' (op type: AddV2)

然后,我尝试使用“ mobilenet_v3.py”(注册新的特征提取器)中的V3_SMALL_MINIMALISTIC定义来训练测试模型。这基本上是相同的模型,但没有插入“ squeeze_excite”(尽管我也恢复了hard_swish激活功能)。

上面的代码在新模型上运行良好,可以渲染图像。

这使我相信问题出在“ squeeze_excite”实现中(在slim / nets / mobilenet / conv_blocks.py中)。

但是我无法进一步诊断问题:是Lucid,是Squeeze / Excite块,是TensorFlow,还是仅仅是关于世界的事实?

lilipppp 回答:Lucid可以可视化MobileNet V3压缩/激励块

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3145690.html

大家都在问