mxnet-ssd icon indicating copy to clipboard operation
mxnet-ssd copied to clipboard

about priorbox

Open junxigauss opened this issue 7 years ago • 3 comments

inline void MultiBoxPriorForward(const Tensor<cpu, 2, DType> &out, const std::vector &sizes, const std::vector &ratios, const int in_width, const int in_height, const std::vector &steps, const std::vector &offsets) { const float step_x = steps[1]; const float step_y = steps[0]; const int num_sizes = static_cast(sizes.size()); const int num_ratios = static_cast(ratios.size()); int count = 0;

for (int r = 0; r < in_height; ++r) { float center_y = (r + offsets[0]) * step_y; for (int c = 0; c < in_width; ++c) { float center_x = (c + offsets[1]) * step_x; // ratio = 1, various sizes for (int i = 0; i < num_sizes; ++i) { float size = sizes[i]; float w = size / 2; float h = size / 2; out[count][0] = center_x - w; // xmin out[count][1] = center_y - h; // ymin out[count][2] = center_x + w; // xmax out[count][3] = center_y + h; // ymax ++count; } // various ratios, size = min_size = size[0] float size = sizes[0]; for (int j = 1; j < num_ratios; ++j) { float ratio = sqrtf(ratios[j]); float w = size * ratio / 2; float h = size / ratio / 2; out[count][0] = center_x - w; // xmin out[count][1] = center_y - h; // ymin out[count][2] = center_x + w; // xmax out[count][3] = center_y + h; // ymax ++count; } } } }

code is intend to compute priorbox,I have one questions about this 1:the anchor number is num_sizes - 1 + num_ratios, different from caffe-ssd, why? @zhreshold

junxigauss avatar Sep 19 '17 03:09 junxigauss

"Different from caffe-ssd"??

zhreshold avatar Sep 23 '17 07:09 zhreshold

@zhreshold i want to detect the small objects. The default boxes detect min-size in caffe is 30. how to modify the sizes of priorBox in your code ?

315386775 avatar Sep 28 '17 08:09 315386775

@315386775 It's basically the same, just use smaller relative size

zhreshold avatar Nov 29 '17 04:11 zhreshold