【问题标题】:Pytorch method for conditional use of intermediate layer instead of final cnn layer output. ie: allow nn to learn to use more layers or lessPytorch 方法有条件地使用中间层而不是最终的 cnn 层输出。即:让nn学习使用更多或更少的层
【发布时间】:2019-10-15 14:35:23
【问题描述】:

我正在低延迟环境中实现残差 cnn(修改后的 xception 的较小版本)。我做了很多手动调整,以最大限度地降低网络的运行时间速度(减少过滤器的数量、删除层等)。

但现在我想尝试让我的网络在每个残差块之后的残差连接上进行分类预测(最终 fcnn 层)。

基本逻辑-

尝试以残差连接作为输入的最终预测

如果这个 fcnn 层以概率 > 一个设定的阈值预测某个类:

return fcnn output as if it was normal final layer

否则:

do next residual block like normal and try the previous conditional again unless we are already at final block

我希望这将使我的网络学会用更少的计算来解决更简单的问题,同时如果它仍然不确定分类,它仍然可以做额外的层。

所以我的基本问题是:在 pytorch 中,以允许我的 nn 在运行时决定是否进行更多处理的方式实现此条件的最佳方法是什么

目前我已经测试了在 forward 函数中的块之后返回中间 x,但我不知道如何最好地设置条件来选择返回哪个 x

另外附注:我相信我最终可能需要在残差和 fcnn 之间再添加一个 cnn 层,作为一个函数,将用于处理的内部表示转换为 fcnn 理解用于分类的表示。

【问题讨论】:

标签: python neural-network pytorch control-flow deep-residual-networks


【解决方案1】:

它已经完成并在 ICLR 2018 中展示。

似乎在 ResNets 中,前几个瓶颈学习表示(因此不能被跳过),而剩余的瓶颈会改进特征,因此可以在适度损失准确性的情况下跳过。 (Stanisław Jastrzebski、Devansh Arpit、Nicolas Ballas、Vikas Verma、Tong Che、Yoshua BengioResidual Connections Encourage Iterative Inference,ICLR 2018)。

这个想法在 Sam Leroux、Pavlo Molchanov、Pieter Simoens、Bart Dhoedt、Thomas Breuel、Jan Kautz 的瓶颈中共享权重IamNN: Iterative and Adaptive Mobile Neural Network for efficient image classification , ICLR 2018。

【讨论】:

    猜你喜欢
    • 2020-09-12
    • 2020-12-05
    • 2019-08-15
    • 2020-04-08
    • 1970-01-01
    • 1970-01-01
    • 2017-03-15
    • 2020-05-02
    • 2018-07-15
    相关资源
    最近更新 更多