Efficient-Computing icon indicating copy to clipboard operation
Efficient-Computing copied to clipboard

您好,最近拜读您的DAFL 代码

Open tongchangD opened this issue 3 years ago • 4 comments

介绍是 无需训练数据的网络压缩技术 DAFL 但我在看代码的时候发现 在 DAFL-train.py中 有 行代码为

teacher = torch.load(opt.teacher_dir + 'teacher').cuda()  # 获得教师网络

而此处的teacher 是加载的 teacher-train.py 中保存的代码,请问是否需要先训练teacher ,然后再根据teacher 训练student

对于这篇论文我的理解是 先创建一个大参数网络teacher,然后再定义一个小网络student,再利用一个生成器Generator,将随机数转换为图片格式, 经过teacher和student 两个网络不断拟合结果,让student和teacher的输出尽量一致.最终保存student作为压缩网络.

但是 下面 的代码我又没看太懂,想哭

        pred = outputs_T.data.max(1)[1]
        loss_activation = -features_T.abs().mean()  # 激活损失
        loss_one_hot = criterion(outputs_T,pred)  # 交叉熵计算损失
        softmax_o_T = torch.nn.functional.softmax(outputs_T, dim=1).mean(dim=0)
        loss_information_entropy = (softmax_o_T * torch.log10(softmax_o_T)).sum()  # 损失信息熵
        loss = loss_one_hot * opt.oh + loss_information_entropy * opt.ie + loss_activation * opt.a  # 损失 加权重

请问对吗?刚刚接触网络压缩,如有不准确,烦请指导下我. 非常感谢

tongchangD avatar Sep 06 '21 11:09 tongchangD

而此处的teacher 是加载的 teacher-train.py 中保存的代码,请问是否需要先训练teacher ,然后再根据teacher 训练student

是的

对于这篇论文我的理解是 先创建一个大参数网络teacher,然后再定义一个小网络student,再利用一个生成器Generator,将随机数转换为图片格式, 经过teacher和student 两个网络不断拟合结果,让student和teacher的输出尽量一致.最终保存student作为压缩网络.

是的

        pred = outputs_T.data.max(1)[1]
        loss_activation = -features_T.abs().mean()  # 激活损失
        loss_one_hot = criterion(outputs_T,pred)  # 交叉熵计算损失
        softmax_o_T = torch.nn.functional.softmax(outputs_T, dim=1).mean(dim=0)
        loss_information_entropy = (softmax_o_T * torch.log10(softmax_o_T)).sum()  # 损失信息熵
        loss = loss_one_hot * opt.oh + loss_information_entropy * opt.ie + loss_activation * opt.a  # 损失 加权重

请问对吗?刚刚接触网络压缩,如有不准确,烦请指导下我.

这部分代码是计算生成器训练的损失,从而训练生成器使得其可以生成较好的样本。

HantingChen avatar Sep 07 '21 02:09 HantingChen

谢谢您的回复 再者请问 为什么 说 DAFL无法在大数据集上使用,我是看的这篇文章 地址

tongchangD avatar Sep 07 '21 02:09 tongchangD

谢谢您的回复 再者请问 为什么 说 DAFL无法在大数据集上使用,我是看的这篇文章 地址

DAFL在大数据集上生成图片耗时较长(因为数据太多)。

HantingChen avatar Sep 07 '21 02:09 HantingChen

谢谢您的回复 再者请问 为什么 说 DAFL无法在大数据集上使用,我是看的这篇文章 地址

DAFL在大数据集上生成图片耗时较长(因为数据太多)。

谢谢您的解答

tongchangD avatar Sep 07 '21 02:09 tongchangD