Ejemplo n.º 1
0
        //Evaluo la segmentacion con las medidas RandIndex, VI and NMI y dejo los resultados en el prob. Evaluo contra el mejor ground-truth y el promedio contra todos.
        private void EvaluateMatrixSegmentation(Segmentation segm)
        {
            RandIndexSegSim rand = new RandIndexSegSim();
            NMISegSim       nmi  = new NMISegSim();
            VISegSim        vi   = new VISegSim();

            //Calcular el rand
            double min = double.MaxValue;
            double ave = 0;
            double aux = 0;

            for (int i = 0; i < this.prob.GroundTruths.Count; i++)
            {
                aux = 1 - rand.Process(segm, this.prob.GroundTruths[i]);
                if (aux < min)
                {
                    min = aux;
                }
                ave += aux;
            }
            ave = ave / this.prob.GroundTruths.Count;
            this.prob.Best_RandEvaluation = min;
            this.prob.Ave_RandEvaluation  = ave;

            //Calcular NMI
            min = double.MaxValue;
            ave = 0;
            aux = 0;
            for (int i = 0; i < this.prob.GroundTruths.Count; i++)
            {
                aux = 1 - nmi.Process(segm, this.prob.GroundTruths[i]);
                if (aux < min)
                {
                    min = aux;
                }
                ave += aux;
            }
            ave = ave / this.prob.GroundTruths.Count;
            this.prob.Best_NMIEvaluation = min;
            this.prob.Ave_NMIEvaluation  = ave;

            //Calcular VI
            min = double.MaxValue;
            ave = 0;
            aux = 0;
            for (int i = 0; i < this.prob.GroundTruths.Count; i++)
            {
                aux = vi.Process(segm, this.prob.GroundTruths[i]);
                if (aux < min)
                {
                    min = aux;
                }
                ave += aux;
            }
            ave = ave / this.prob.GroundTruths.Count;
            this.prob.Best_VIEvaluation = min;
            this.prob.Ave_VIEvaluation  = ave;
        }
Ejemplo n.º 2
0
        //Evaluo la segmentacion con las medidas RandIndex, VI and NMI y dejo los resultados en el prob. Evaluo contra el mejor ground-truth y el promedio contra todos.
        private void EvaluateMatrixSegmentation(Segmentation segm)
        {
            RandIndexSegSim rand = new RandIndexSegSim();
            NMISegSim nmi = new NMISegSim();
            VISegSim vi = new VISegSim();

            //Calcular el rand
            double min = double.MaxValue;
            double ave = 0;
            double aux = 0;
            for (int i = 0; i < this.prob.GroundTruths.Count; i++)
            {
                aux = 1 - rand.Process(segm, this.prob.GroundTruths[i]);
                if (aux < min)
                    min = aux;
                ave += aux;
            }
            ave = ave / this.prob.GroundTruths.Count;
            this.prob.Best_RandEvaluation = min;
            this.prob.Ave_RandEvaluation = ave;

            //Calcular NMI
            min = double.MaxValue;
            ave = 0;
            aux = 0;
            for (int i = 0; i < this.prob.GroundTruths.Count; i++)
            {
                aux = 1 - nmi.Process(segm, this.prob.GroundTruths[i]);
                if (aux < min)
                    min = aux;
                ave += aux;
            }
            ave = ave / this.prob.GroundTruths.Count;
            this.prob.Best_NMIEvaluation = min;
            this.prob.Ave_NMIEvaluation = ave;

            //Calcular VI
            min = double.MaxValue;
            ave = 0;
            aux = 0;
            for (int i = 0; i < this.prob.GroundTruths.Count; i++)
            {
                aux = vi.Process(segm, this.prob.GroundTruths[i]);
                if (aux < min)
                    min = aux;
                ave += aux;
            }
            ave = ave / this.prob.GroundTruths.Count;
            this.prob.Best_VIEvaluation = min;
            this.prob.Ave_VIEvaluation = ave;
        }