コード例 #1
0
        /// <summary>
        /// Returns the next label in the Index set selected based on the selection criteria.
        /// </summary>
        /// <param name="type">Specifies the selection type (e.g. RANDOM, SEQUENTIAL).</param>
        /// <param name="bBoosted">Optionally, specifies to use label sets of boosted images (default = false).</param>
        /// <returns>The next label index is returned.</returns>
        public virtual int?GetNextLabel(Index.SELECTION_TYPE type, bool bBoosted = false)
        {
            LabelIndex rgIdx = (bBoosted) ? m_rgLabelsBoosted : m_rgLabels;

            if (rgIdx.Count == 0)
            {
                return(null);
            }

            return(rgIdx.GetNextLabel(type, null, false));
        }
コード例 #2
0
        private void load(List <DbItem> rgItems)
        {
            m_index = new Index("ALL", m_random, rgItems);
            List <DbItem> rgBoosted = rgItems.Where(p => p.Boost > 0).ToList();

            m_boosted = new Index("BOOSTED", m_random, rgBoosted, -1, true);

            List <LabelDescriptor> rgLabels = m_src.Labels.OrderBy(p => p.ActiveLabel).ToList();

            m_rgLabels        = new LabelIndex("LABELED", m_random, m_src, false, rgItems);
            m_rgLabelsBoosted = new LabelIndex("LABELED BOOSTED", m_random, m_src, true, rgBoosted);
        }
コード例 #3
0
        /// <summary>
        /// The constructor used to copy another MasterIndexes and optionally specify a sorting for the indexes.
        /// </summary>
        /// <param name="idx">Specifies the MasterIndexes to copy.</param>
        /// <param name="sort">Optionally, specifies a sorting to use on the indexes.</param>
        public MasterIndexes(MasterIndexes idx, IMGDB_SORT sort)
        {
            m_sort       = sort;
            m_src        = idx.m_src;
            m_random     = idx.m_random;
            m_nLoadLimit = idx.m_nLoadLimit;
            m_factory    = new DatasetFactory(idx.m_factory);

            m_index    = idx.m_index.Clone(sort);
            m_rgLabels = new LabelIndex(idx.m_rgLabels);

            m_boosted         = idx.m_boosted.Clone(sort);
            m_rgLabelsBoosted = new LabelIndex(idx.m_rgLabelsBoosted);
        }
コード例 #4
0
ファイル: QueryState.cs プロジェクト: alllucky1996/MyCaffe
        /// <summary>
        /// Returns the next label in the Index set selected based on the selection criteria.
        /// </summary>
        /// <param name="type">Specifies the selection type (e.g. RANDOM, SEQUENTIAL).</param>
        /// <param name="bBoosted">Optionally, specifies to use label sets of boosted images (default = false).</param>
        /// <returns>The next label index is returned.</returns>
        public override int?GetNextLabel(Index.SELECTION_TYPE type, bool bBoosted = false)
        {
            LabelIndex rgIdx = (bBoosted) ? m_rgLabelsBoosted : m_rgLabels;

            if (rgIdx.Count == 0)
            {
                return(null);
            }

            int?nIdx = rgIdx.GetNextLabel(type, null, m_bUseUniqueLabelIndexes);

            if (rgIdx.IsEmpty)
            {
                rgIdx.ReLoad();
            }

            return(nIdx);
        }
コード例 #5
0
        public LabelIndex(LabelIndex idx)
        {
            m_strName     = idx.m_strName + " copy";
            m_randomLabel = idx.m_randomLabel;
            m_randomData  = idx.m_randomData;
            m_src         = idx.m_src;
            m_bBoosted    = idx.m_bBoosted;

            m_rgIdx = new List <int>();

            if (idx.m_rgLabels != null && idx.m_rgLabels.Length > 0)
            {
                m_rgLabels = new Index[idx.m_rgLabels.Length];

                bool bFillLabelMap = false;
                if (m_rgLabelToIdxMap == null || m_rgLabelToIdxMap.Count == 0 || m_rgIdxToLabelMap == null || m_rgIdxToLabelMap.Count == 0)
                {
                    m_rgLabelToIdxMap = new Dictionary <int, int>();
                    m_rgIdxToLabelMap = new Dictionary <int, int>();
                    bFillLabelMap     = true;
                }

                for (int i = 0; i < idx.m_rgLabels.Length; i++)
                {
                    m_rgLabels[i] = idx.m_rgLabels[i].Clone();
                    if (m_rgLabels[i].Count > 0)
                    {
                        m_rgIdx.Add(i);
                    }

                    if (bFillLabelMap)
                    {
                        int nLabel = m_rgLabels[i].Label;
                        m_rgLabelToIdxMap[nLabel] = i;
                        m_rgIdxToLabelMap[i]      = nLabel;
                    }
                }
            }
        }