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); } } } }
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(); }