我的代码中使用了什么样的规范化?

时间:2014-02-27 04:56:05

标签: c# neural-network normalization

我试图了解如何工作this code

public class UnPoint 
{
    public int X, Y;
    public float x, y;
    public float v;

    public static float X_MIN = -1f;
    public static float X_MAX = 1f;
    public static float Y_MIN = 0f;
    public static float Y_MAX = 1f;

    public UnPoint(int XX, int YY, int w, int h) 
    {
        X = XX;
        Y = YY;
        x = (X_MAX-X_MIN) / ( (float)(w-1) ) * ( (float)X ) + X_MIN;
        y = (Y_MAX-Y_MIN)/((float)(h-1))*((float)((h-1) - Y)) + Y_MIN;
    }
}

什么是 x,y ?我认为,这是某种规范化。但我找不到这种类型。

我很乐意接受任何建议。

1 个答案:

答案 0 :(得分:2)

此代码将值XX从区间[0 w-1]规范化为区间[-1 +1],将值YY从区间[0 h-1]归一化到反向位置在[0 1]区间内。

E.g。它可以将屏幕坐标从左上角的(0,0)标准化到右下角的(w-1,h-1),因此屏幕的左边缘为X_MIN( - 1) ,屏幕右边缘为X_MAX(+1),屏幕上边缘为Y_MAX(1),屏幕下边缘为Y_MIN(0)。

相关问题