コード例 #1
0
    public void CreateJson(ConfusionMatrixData cm_Data)
    {
        using (var ms = new MemoryStream())
        {
            using (var sr = new StreamReader(ms))
            {
                var serializer = new DataContractJsonSerializer(typeof(ConfusionMatrixData));
                serializer.WriteObject(ms, cm_Data);
                ms.Position = 0;

                var json = sr.ReadToEnd();

                using (var sw = new StreamWriter(Application.dataPath + "/cm_" + Time.time.ToString() + ".json", false, System.Text.Encoding.UTF8))
                {
                    sw.Write(json);
                }
            }
        }
    }
コード例 #2
0
    void Awake()
    {
        Random.InitState(1);
        classList    = new List <int>();
        currentIndex = 0;
        int classCount = (is4Classes) ? 4 : 2;

        for (int i = 0; i < classCount; i++)
        {
            for (int j = 0; j < imageCountPerClass; j++)
            {
                classList.Add(i);
            }
        }

        progressPresenter.maxCount = classCount * imageCountPerClass;

        classList = classList.OrderBy(i => Random.value).ToList();

        cm_Data = new ConfusionMatrixData();
    }