예제 #1
0
        public void SerializeEntry(SynthEntry e)
        {
            lock (fileLoc_)
            {
                registryCsvFileWriter_.WriteLine(
                    e.datasetName + "," +
                    e.origPngName + "," +
                    e.origLabel + "," +
                    e.synthPngName + "," +
                    e.synthLabel + "," +
                    e.lInfDist + "," +
                    e.l1Dist + "," +
                    e.confOrig + "," +
                    e.sndBestDiffOrig + "," +
                    e.confSynth + "," +
                    e.sndBestDiffSynth);

                registryCsvFileWriter_.Flush();
            }
        }
예제 #2
0
        public void RecordAtomically(
            String datasetName,
            int datasetIndex,
            LabelWithConfidence origLab,
            LabelWithConfidence synthLab,
            double scale, double offset,
            int numRows, int numCols, bool isColor, bool isRowOrder = true)
        {
            SynthEntry e = new SynthEntry();

            e.datasetName = datasetName;

            e.origPngName = CreatePnG("orig", datasetName, datasetIndex, origLab.datum, scale, offset, numRows, numCols, isColor, isRowOrder);
            e.origLabel   = origLab.actualLabel;

            e.synthPngName = CreatePnG("snth", datasetName, datasetIndex, synthLab.datum, scale, offset, numRows, numCols, isColor, isRowOrder);
            e.synthLabel   = synthLab.actualLabel;

            double[] diff = new double[origLab.datum.Length];
            for (int i = 0; i < origLab.datum.Length; i++)
            {
                diff[i] = 5 * (origLab.datum[i] - synthLab.datum[i]) + 100; // -20 ... 20 -> -100 .. 100 -> 0 .. 200
            }

            CreatePnG("diffx5o100", datasetName, datasetIndex, diff, scale, offset, numRows, numCols, isColor, isRowOrder);

            Console.WriteLine("Orig path  =" + e.origPngName);
            Console.WriteLine("Synth path =" + e.synthPngName);


            e.lInfDist = Utils.UMath.LInfinityDistance(origLab.datum, synthLab.datum);
            e.l1Dist   = Utils.UMath.L1Distance(origLab.datum, synthLab.datum);

            e.confOrig  = origLab.softMaxValue;
            e.confSynth = synthLab.softMaxValue;

            e.sndBestDiffOrig  = origLab.diffFromSecondBest;
            e.sndBestDiffSynth = synthLab.diffFromSecondBest;

            SerializeEntry(e);
        }