예제 #1
0
        /// <summary>
        /// Initialize the ImageSet by creating the master list of images, starting its background image loading thread, and then creating the master index that maps the organization of the dataset.
        /// </summary>
        /// <param name="bSilentLoad">Specifies to load the data silently without status output.</param>
        /// <param name="bUseUniqueLabelIndexes">Optionally, specifies to use unique label indexes which is slightly slower, but ensures each label is hit per epoch equally (default = true).</param>
        /// <param name="bUseUniqueImageIndexes">Optionally, specifies to use unique image indexes which is slightly slower, but ensures each image is hit per epoch (default = true).</param>
        /// <param name="nMaxLoadCount">Optionally, specifies to automaticall start the image refresh which only applies when the number of images loaded into memory is less than the actual number of images (default = false).</param>
        /// <returns>Once initialized, the default query state for the image set is returned.  This method may be called multiple times and each time returns a new QueryState.</returns>
        public QueryState Initialize(bool bSilentLoad, bool bUseUniqueLabelIndexes = true, bool bUseUniqueImageIndexes = true, int nMaxLoadCount = 0)
        {
            if (m_masterList == null)
            {
                m_masterList = new MasterList(m_random, m_log, m_src, m_factory, m_rgAbort, nMaxLoadCount);

                if (OnCalculateImageMean != null)
                {
                    m_masterList.OnCalculateImageMean += OnCalculateImageMean;
                }

                if (m_loadMethod == IMAGEDB_LOAD_METHOD.LOAD_ALL || m_loadMethod == IMAGEDB_LOAD_METHOD.LOAD_EXTERNAL || m_loadMethod == IMAGEDB_LOAD_METHOD.LOAD_ON_DEMAND_BACKGROUND)
                {
                    m_masterList.Load(bSilentLoad);
                }
            }

            if (m_masterIdx == null || m_masterIdx.LoadLimit != nMaxLoadCount)
            {
                m_masterIdx = new MasterIndexes(m_random, m_src, nMaxLoadCount);
            }

            QueryState state = new QueryState(m_masterIdx, bUseUniqueLabelIndexes, bUseUniqueImageIndexes);

            if (m_loadMethod == IMAGEDB_LOAD_METHOD.LOAD_ALL)
            {
                m_masterList.WaitForLoadingToComplete(m_rgAbort);
            }

            return(state);
        }
예제 #2
0
        /// <summary>
        /// Releases the resouces used.
        /// </summary>
        /// <param name="bDisposing">Set to <i>true</i> when called by Dispose()</param>
        protected override void Dispose(bool bDisposing)
        {
            m_evtCancel.Set();

            if (m_masterIdx != null)
            {
                m_masterIdx.Dispose();
                m_masterIdx = null;
            }

            if (m_masterList != null)
            {
                m_masterList.Dispose();
                m_masterList = null;
            }

            base.Dispose(bDisposing);
        }