コード例 #1
0
ファイル: Imageset.cs プロジェクト: Jason6583/MyCaffe
        /// <summary>
        /// Update the label boosts for a project.
        /// </summary>
        /// <param name="nProjectId">Specifies the ID of the project.</param>
        public void UpdateLabelBoosts(int nProjectId)
        {
            List <LabelBoostDescriptor> rgBoosts = m_factory.GetLabelBoosts(nProjectId, m_src.ID);

            m_rgLabelBoosts = new Dictionary <int, double>();

            m_dfLabelBoostTotal = 0;

            foreach (LabelBoostDescriptor boost in rgBoosts)
            {
                m_dfLabelBoostTotal += (double)boost.Boost;

                int    nLabel  = boost.Label;
                double dfBoost = (double)boost.Boost;

                if (!m_rgLabelBoosts.ContainsKey(nLabel))
                {
                    m_rgLabelBoosts.Add(nLabel, dfBoost);
                }
                else
                {
                    m_rgLabelBoosts[nLabel] = dfBoost;
                }
            }
        }