简体   繁体   English

深度网络如何在对象检测中接受不同比例的图像?

[英]How the deep network accepts images of different scales in object detection?

The network built with MatConvNet accepts images of different scales and evaluates it. 用MatConvNet构建的网络接受不同比例的图像并进行评估。 For example :- 例如 :-

%img is an image of size 730*860*3
%net is loaded DagNN obj
scales = [-2 -1 0 0.5 1]
for s = 2.^scales
    img = imresize(raw_img, s, 'bilinear');
    img = bsxfun(@minus, img, averageImage);
    inputs = {'data', img};
    net.eval(inputs);
end

At the time of debugging, I found img resized and evaluated every iteration of the loop. 在调试时,我发现img调整大小并评估了循环的每次迭代。 But the network( net ) was supposed to accept fixed image. 但是网络( net )应该接受固定图像。 As - 作为-

K>> net

net = 

  DagNN with properties:

                 layers: [1x319 struct]
                   vars: [1x323 struct]
                 params: [1x381 struct]
                   meta: [1x1 struct]
                      m: []
                      v: []
                   mode: 'test'
                 holdOn: 0
    accumulateParamDers: 0
         conserveMemory: 1
        parameterServer: []
                 device: 'cpu'

After loading trained network :- 加载经过训练的网络后:-

K>> net.vars(1, 1).value

ans =

     []

And inside the for loop :-(iter 1) for循环中:-( iter 1)

K>> net.vars(1, 1).value

ans =

     [64 64 3]

(iter 2) (iter 2)

K>> net.vars(1, 1).value

ans =

     [160 160 3]

and so on.... So how the DagNN is handling such input and evaluates itself?(I am new to MatConvNet and couldn't find any help in the documentation. So please answer this question and suggest how to build such things in keras) 依此类推。...那么DagNN如何处理此类输入并进行自我评估?(我是MatConvNet的新手,在文档中找不到任何帮助。因此,请回答此问题并提出如何在keras中构建此类内容的建议。 )

In general, ConvNet does not care about the input size of an image. 通常,ConvNet不在乎图像的输入大小。 All the layers are performing convolution-like operations (eg, even the poolings behave like convolution spatially). 所有的层都在执行类似卷积的操作(例如,即使池在空间上的行为也像卷积一样)。 If you provide large input, you get large output. 如果您提供大量输入,则会获得大量输出。 The only thing that cares about the input size is the loss layer. 唯一关心输入大小的是损耗层。 If you don't have a loss layer, the code wouldn't break at all. 如果没有损失层,代码将完全不会中断。 There is no such thing as fully connected layer in MatConvNet, everything is convolutional. MatConvNet中没有完全连接的层,一切都是卷积的。

BTW, that's why some people who work ConvNet early think that FCN is a funny name, because there is really no difference between a fully connected layer and a convolutional layer. 顺便说一句,这就是为什么一些早期使用ConvNet的人认为FCN是一个好笑的名字的原因,因为在完全连接的层和卷积层之间确实没有区别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM