public void TestMean() { List <string> rgDs = new List <string>() { "MNIST", "CIFAR-10", "MNIST" }; IXImageDatabase db = new MyCaffeImageDatabase(); foreach (string strDs in rgDs) { SettingsCaffe settings = new SettingsCaffe(); Stopwatch sw = new Stopwatch(); sw.Start(); db.InitializeWithDsName(settings, strDs); string str = sw.ElapsedMilliseconds.ToString(); Trace.WriteLine(strDs + " Initialization Time: " + str + " ms."); DatasetDescriptor ds = db.GetDatasetByName(strDs); SimpleDatum d1 = db.QueryImageMean(ds.TrainingSource.ID); SimpleDatum d2 = db.QueryImageMeanFromDataset(ds.ID); SimpleDatum d3 = db.GetImageMean(ds.TrainingSource.ID); byte[] rgB1 = d1.ByteData; byte[] rgB2 = d2.ByteData; byte[] rgB3 = d3.ByteData; Assert.AreEqual(rgB1.Length, rgB2.Length); Assert.AreEqual(rgB2.Length, rgB3.Length); for (int i = 0; i < rgB1.Length; i++) { Assert.AreEqual(rgB1[i], rgB2[i]); Assert.AreEqual(rgB2[i], rgB3[i]); } } db.CleanUp(); IDisposable idisp = db as IDisposable; if (idisp != null) { idisp.Dispose(); } }