在niftynet上实施转移学习 [英] Implement transfer learning on niftynet

查看:55
本文介绍了在niftynet上实施转移学习的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Dense V-Net架构实现迁移学习.在搜寻如何执行此操作时,我发现此功能目前正在使用中(

I want to implement transfer learning using the Dense V-Net architecture. As I was searching on how to do this, I found that this feature is currently being worked on (How do I implement transfer learning in NiftyNet?).

尽管从该答案中可以很明显地看出,没有直接的方法可以实现它,但我还是在尝试:

Although from that answer it is quite clear that there is not a straight way to implement it, I was trying to:

1)创建密集的V-Net

1) Create the Dense V-Net

2)从.ckpt文件恢复重量

2) Restore weigths from the .ckpt file

3)独自实施迁移学习

3) Implement transfer learning on my own

要执行步骤1,我以为可以使用niftynet.network.dense_vnet模块.因此,我尝试了以下方法:

To perform step 1, I thought I could use the niftynet.network.dense_vnet module. Therefore, I tried the following:

checkpoint = '/path_to_ckpt/model.ckpt-3000.index'
x = tf.placeholder(dtype=tf.float32, shape=[None,1,144,144,144])
architecture_parameters = dict(
    use_bdo=False,
    use_prior=False,
    use_dense_connections=True,
    use_coords=False)

hyperparameters = dict(
    prior_size=12,
    n_dense_channels=(4, 8, 16),
    n_seg_channels=(12, 24, 24),
    n_input_channels=(24, 24, 24),
    dilation_rates=([1] * 5, [1] * 10, [1] * 10),
    final_kernel=3,
    augmentation_scale=0)
model_instance = DenseVNet(num_classes=9,hyperparameters=hyperparameters,
                             architecture_parameters=architecture_parameters)

model_net = DenseVNet.layer_op(model_instance, x)

但是,出现以下错误:

TypeError: Failed to convert object of type <type 'list'> to Tensor. Contents: [None, 1, 72, 72, 24]. Consider casting elements to a supported type.

所以,问题是:

有什么办法可以实现?

推荐答案

转移学习已添加到NiftyNet.

Transfer learning has been added been added to NiftyNet.

您可以通过 vars_to_restore 配置参数选择要还原的变量,以及通过 vars_to_freeze 配置参数冻结的变量.

You can select which variables you want to restore through the vars_to_restore config parameter and which variables to freeze through the vars_to_freeze config parameter.

有关更多信息,请参见此处.

See here for more information.

这篇关于在niftynet上实施转移学习的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆