[英]how to accelerate the training of RPN or SSD neuron network
We know that in SSD, there are three output feature maps.我们知道,在 SSD 中,有三个 output 特征图。 During training, I have to caculate the loss between the output of the SDD and the ground truth every pixel.
在训练过程中,我必须计算 SDD 的 output 和 ground truth 每个像素之间的损失。 So how can I complete this "from pixel to pixel operation" quickly?
那么如何才能快速完成这个“从像素到像素的运算”呢? Now I use the nested for loop to complete the caculation of loss, but it is extremely slow.
现在我使用嵌套的for循环来完成loss的计算,但是速度极慢。 Say another example, there is an output map indicating the probability whether there is an object or not, say the size is 100×100, and I set the threshould 0.5.
再举一个例子,有一个output map 表示是否有一个object的概率,说大小是100×100,我设置第5个。 So how can I know which pixel of the output map has a value above 0.5?
那我怎么知道output map的哪个像素值大于0.5呢? Now I use the for loop, like
for i in range(100): for y in range(100): if map[i][y]>0.5 do something
,it is too slow?现在我使用 for 循环,比如
for i in range(100): for y in range(100): if map[i][y]>0.5 do something
,太慢了? So how can I solve it?那么我该如何解决呢?
Given the information in your question, you could use the numpy
library to work with numpy.ndarray
, you would then be able to perform a wide range of element-wise operations without the need for loops.鉴于您问题中的信息,您可以使用
numpy
库与numpy.ndarray
一起使用,然后您将能够执行各种元素操作而无需循环。
For instance, with map
a 2d numpy.ndarray
, map > 0.5
returns a boolean array of the same size as map
, indicating which elements are greater than 0.5. For instance, with
map
a 2d numpy.ndarray
, map > 0.5
returns a boolean array of the same size as map
, indicating which elements are greater than 0.5. You could then use this to perform your computations only with the relevant elements.然后,您可以使用它仅使用相关元素执行计算。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.