为什么NumSharp的np.meshgrid仅返回第一个值

时间:2020-08-01 15:06:44

标签: c#

帮助解决错误最后一行np.meshgrid仅返回第一个值(box_widths) 代码

(scales, ratios) = np.meshgrid(np.array(scales), np.array(ratios));
        scales = scales.flatten();
        ratios = ratios.flatten();
        // Enumerate heights and widths from scales and ratios
        var heights = scales / np.sqrt(ratios);
        var widths = scales * np.sqrt(ratios);
        //Enumerate shifts in feature space
        var shifts_y = np.arange(0, shape[0], anchor_stride) * feature_stride;
        var shifts_x = np.arange(0, shape[1], anchor_stride) * feature_stride;
        (shifts_x, shifts_y) = np.meshgrid(shifts_x, shifts_y);
        // Enumerate combinations of shifts, widths, and heights
        var (box_widths, box_centers_x) = np.meshgrid(widths, shifts_x);
        var (box_heights, box_centers_y) = np.meshgrid(heights, shifts_y);
        // Reshape to get a list of (y, x) and a list of (h, w)
        var box_centers = np.stack(new[] { box_centers_y, box_centers_x }, 2).reshape(new[] { -1, 2 });

0 个答案:

没有答案
相关问题