pytorchx icon indicating copy to clipboard operation
pytorchx copied to clipboard

修改squeezenet输入维度后结果对比不一致。

Open jch-wang opened this issue 3 years ago • 7 comments

我修改pytorchx/squeezenet/squeezenet.py 中的第13行为: tmp = torch.ones(2, 3, 512, 512).to('cuda:0') 修改pytorchx/squeezenet/inference.py 中第15行,第21行为:

tmp = torch.ones(1, 3, 512, 512).to('cuda:0')
summary(net, (3, 512, 512))

修改tensorrtx/squeezenet/squeezenet.cpp中第12、13行

static const int INPUT_H =512;
static const int INPUT_W =512;
``
最后两者得到的输出结果不一样,我这样修改存在什么问题呀?

jch-wang avatar Oct 15 '20 07:10 jch-wang

最后一层在pytorch是adaptive pooling,这边用的固定kernel,需要根据input size改一下

wang-xinyu avatar Oct 15 '20 07:10 wang-xinyu

最后一层在pytorch是adaptive pooling,这边用的固定kernel,需要根据input size改一下

那就是说tensorrx中的输出是没有问题的? pytorch的实现里需要在哪个文件里改kernel呀?请原谅我太菜...

jch-wang avatar Oct 15 '20 07:10 jch-wang

不是,是改tensorrtx里面最后的pooling层的kernel size

wang-xinyu avatar Oct 15 '20 07:10 wang-xinyu

意思是修改tensorrtx/squeezenet/squeezenet.cpp中第137行的: IPoolingLayer* pool3 = network->addPooling(*relu2->getOutput(0), PoolingType::kAVERAGE, DimsHW{14, 14}); DimsHW的大小吗?应该修改为多少?....脑子突然不在线....

jch-wang avatar Oct 15 '20 08:10 jch-wang

对,pool3输出是1x1,所以要根据前一层的shape改

wang-xinyu avatar Oct 15 '20 09:10 wang-xinyu

对,pool3输出是1x1,所以要根据前一层的shape改

感谢,已解决~

jch-wang avatar Oct 15 '20 09:10 jch-wang

又来打扰了~ 我想将squeezenet输出由原来的1000维改成512维,squeezenet.cpp中的输出维度可以直接修改OUTPUT_SIZE参数,请问在squeezenet.py中的,我应该怎么修改呢?

jch-wang avatar Oct 16 '20 09:10 jch-wang