Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

代码相关问题 #2

Open
tianqiwanlaiqiu12 opened this issue Sep 9, 2021 · 5 comments
Open

代码相关问题 #2

tianqiwanlaiqiu12 opened this issue Sep 9, 2021 · 5 comments

Comments

@tianqiwanlaiqiu12
Copy link

您好,最近在研究oltr方法,发现您的代码当中netbuilder.py这个脚本当设置attmodule=True时运行报错,是什么原因呢?脚本里边data_shape设置是做什么的?期盼您的回复,万分感谢

@ma-xu
Copy link
Owner

ma-xu commented Sep 9, 2021

@tianqiwanlaiqiu12 Could you please post the errors here so that I can debug for you.

For thr data_shape, it is used for the attention module in OLTR, since there is a spatial flatten operation in the module. We can set the value to 4 if using cifar dataset and set the value to 7 if using ImageNet.

@tianqiwanlaiqiu12
Copy link
Author

@tianqiwanlaiqiu12能否请您在此处发布错误,以便我为您调试。

对于 thr data_shape,它用于 OLTR 中的注意力模块,因为该模块中有空间展平操作。如果使用 cifar 数据集,我们可以将值设置为 4,如果使用 ImageNet,我们可以将值设置为 7。

非常感谢回复,我用的是mnist数据,data_shape=4,在运行netbuilder.py脚本的以下代码时报错
def demo():
x = torch.rand([1, 1, 28, 28])
net = Network('LeNetPlus', 2, 50, use_fc=False, attmodule=True, classifier='metaembedding')
y, fea, feature_maps, x = net(x)
print(y.shape)
demo()
报错如下:
1631240996
希望您能帮忙看一下什么原因,万分感谢

@tianqiwanlaiqiu12
Copy link
Author

@tianqiwanlaiqiu12 Could you please post the errors here so that I can debug for you.

For thr data_shape, it is used for the attention module in OLTR, since there is a spatial flatten operation in the module. We can set the value to 4 if using cifar dataset and set the value to 7 if using ImageNet.

@tianqiwanlaiqiu12能否请您在此处发布错误,以便我为您调试。
对于 thr data_shape,它用于 OLTR 中的注意力模块,因为该模块中有空间展平操作。如果使用 cifar 数据集,我们可以将值设置为 4,如果使用 ImageNet,我们可以将值设置为 7。

非常感谢回复,我用的是mnist数据,data_shape=4,在运行netbuilder.py脚本的以下代码时报错
def demo():
x = torch.rand([1, 1, 28, 28])
net = Network('LeNetPlus', 2, 50, use_fc=False, attmodule=True, classifier='metaembedding')
y, fea, feature_maps, x = net(x)
print(y.shape)
demo()
报错如下:
1631240996
希望您能帮忙看一下什么原因,万分感谢

我在调试的时候当data_shape=1时是没有报错的,但是不知道这个参数是做什么的,可不可以设置为1?

@ma-xu
Copy link
Owner

ma-xu commented Sep 13, 2021

@tianqiwanlaiqiu12能否请您在此处发布错误,以便我为您调试。
对于 thr data_shape,它用于 OLTR 中的注意力模块,因为该模块中有空间展平操作。如果使用 cifar 数据集,我们可以将值设置为 4,如果使用 ImageNet,我们可以将值设置为 7。

非常感谢回复,我用的是mnist数据,data_shape=4,在运行netbuilder.py脚本的以下代码时报错
def demo():
x = torch.rand([1, 1, 28, 28])
net = Network('LeNetPlus', 2, 50, use_fc=False, attmodule=True, classifier='metaembedding')
y, fea, feature_maps, x = net(x)
print(y.shape)
demo()
报错如下:
1631240996
希望您能帮忙看一下什么原因,万分感谢

@tianqiwanlaiqiu12 很抱歉恢复的比较迟。 我更新了测试样本,请查看。支持三种数据集:mnist(backbone LeNet), cifar, ImageNet. 三种数据集经过backbone网络后产生的feature的solution分别是1x1, 4x4, 和7x7。这就是data_shape的作用,因为OLTR的attention module是将特征拉平的。希望能够解决你的困惑。

@tianqiwanlaiqiu12
Copy link
Author

@tianqiwanlaiqiu12能否请您在此处发布错误,以便我为您调试。
对于 thr data_shape,它用于 OLTR 中的注意力模块,因为该模块中有空间展平操作。如果使用 cifar 数据集,我们可以将值设置为 4,如果使用 ImageNet,我们可以将值设置为 7。

非常感谢回复,我用的是mnist数据,data_shape=4,在运行netbuilder.py脚本的以下代码时报错
def demo():
x = torch.rand([1, 1, 28, 28])
net = Network('LeNetPlus', 2, 50, use_fc=False, attmodule=True, classifier='metaembedding')
y, fea, feature_maps, x = net(x)
print(y.shape)
demo()
报错如下:
1631240996
希望您能帮忙看一下什么原因,万分感谢

@tianqiwanlaiqiu12 很抱歉恢复的比较迟。 我更新了测试样本,请查看。支持三种数据集:mnist(backbone LeNet), cifar, ImageNet. 三种数据集经过backbone网络后产生的feature的solution分别是1x1, 4x4, 和7x7。这就是data_shape的作用,因为OLTR的attention module是将特征拉平的。希望能够解决你的困惑。

非常感谢您的耐心解答,给我提供了很大的帮助

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants