コード例 #1
0
        public void TestIndexQuery()
        {
            PreTest.Init();
            Log log = new Log("Test Dataset Factory");

            log.EnableTrace = true;

            string         strDs   = "MNIST";
            DatasetFactory factory = new DatasetFactory();
            Stopwatch      sw      = new Stopwatch();

            try
            {
                DatasetDescriptor ds = factory.LoadDataset(strDs);
                factory.Open(ds.TrainingSource.ID);

                sw.Start();
                List <DbItem> rgItems = factory.LoadImageIndexes(false);
                sw.Stop();

                log.CHECK_EQ(rgItems.Count, ds.TrainingSource.ImageCount, "The query count should match the image count!");
                factory.Close();

                log.WriteLine("Query time = " + sw.Elapsed.TotalMilliseconds.ToString("N5") + " ms.");

                sw.Restart();

                int nMin = int.MaxValue;
                int nMax = -int.MaxValue;
                for (int i = 0; i < rgItems.Count; i++)
                {
                    nMin = Math.Min(rgItems[i].Label, nMin);
                    nMax = Math.Max(rgItems[i].Label, nMax);
                }

                List <DbItem> rgBoosted = rgItems.Where(p => p.Boost > 0).ToList();

                for (int nLabel = nMin; nLabel <= nMax; nLabel++)
                {
                    List <DbItem> rgLabel = rgItems.Where(p => p.Label == nLabel).ToList();
                }

                sw.Stop();

                log.WriteLine("Query time (profile) = " + sw.Elapsed.TotalMilliseconds.ToString("N5") + " ms.");
            }
            finally
            {
                factory.Dispose();
            }
        }
コード例 #2
0
        /// <summary>
        /// The constructor.
        /// </summary>
        /// <param name="random">Specifies the random number generator.</param>
        /// <param name="src">Specifies the data source.</param>
        /// <param name="nLoadLimit">Optionally, specifies the load limit used which when set to a value > 0, limits queries to RANDOM image selection within the load limit count (default = 0).</param>
        public MasterIndexes(CryptoRandom random, SourceDescriptor src, int nLoadLimit = 0)
        {
            m_random = random;
            m_src    = src;
            m_factory.Open(src);
            m_nLoadLimit = nLoadLimit;

            if (m_nLoadLimit > src.ImageCount)
            {
                m_nLoadLimit = src.ImageCount;
            }

            m_rgImageIdx = m_factory.LoadImageIndexes(false);
            load(m_rgImageIdx.Where(p => p != null).ToList());
        }
コード例 #3
0
ファイル: MasterList.cs プロジェクト: Flavio58it/MyCaffe
 public RefreshManager(CryptoRandom random, SourceDescriptor src, DatasetFactory factory)
 {
     m_random  = random;
     m_rgItems = factory.LoadImageIndexes(false, true);
 }