Ejemplo n.º 1
0
    private hogwartsHouse ConvertIdx(int idx)
    {
        hogwartsHouse house = hogwartsHouse.Gryffindor;

        if (idx == 0)
        {
            house = hogwartsHouse.Gryffindor;
        }
        else if (idx == 1)
        {
            house = hogwartsHouse.Hufflpuff;
        }
        else if (idx == 2)
        {
            house = hogwartsHouse.Ravenclaw;
        }
        else if (idx == 3)
        {
            house = hogwartsHouse.Slytherin;
        }

        return(house);
    }
Ejemplo n.º 2
0
    public bool Sort(Mat inputData, ref hogwartsHouse house, ref float value)
    {
        Mat blob = Dnn.blobFromImage(inputData);

        if (blob == null)
        {
            return(false);
        }

        net.setInput(blob);
        Mat prob = net.forward();

        if (prob == null)
        {
            return(false);
        }

        int idx = 0;

        (idx, value) = get_max_idx(prob);
        house        = ConvertIdx(idx);

        return(true);
    }