Example #1
0
 /// <summary>
 /// The constructor.
 /// </summary>
 public SsdSampler(CudaDnn <T> cuda, Log log)
 {
     m_log      = log;
     m_cuda     = cuda;
     m_blobWork = new Blob <T>(cuda, log, false);
     m_util     = new BBoxUtility <T>(cuda, log);
 }
Example #2
0
        /** @copydoc Layer::dispose */
        protected override void dispose()
        {
            if (m_blobBboxPreds != null)
            {
                m_blobBboxPreds.Dispose();
                m_blobBboxPreds = null;
            }

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

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

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

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

            base.dispose();
        }
Example #3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="cuda">Cuda engine.</param>
        /// <param name="log">General log.</param>
        /// <param name="p">provides MultiBoxLossParameter multiboxloss_param
        /// with MultiBoxLossLayer.
        /// </param>
        public MultiBoxLossLayer(CudaDnn <T> cuda, Log log, LayerParameter p)
            : base(cuda, log, p)
        {
            m_type = LayerParameter.LayerType.MULTIBOX_LOSS;

            m_blobLocPred      = new Blob <T>(cuda, log);
            m_blobLocPred.Name = m_param.name + " loc_pred";
            m_blobLocGt        = new Blob <T>(cuda, log);
            m_blobLocGt.Name   = m_param.name + " loc_gt";
            m_blobLocLoss      = new Blob <T>(cuda, log);
            m_blobLocLoss.Name = m_param.name + " loc_loss";

            m_blobConfPred      = new Blob <T>(cuda, log);
            m_blobConfPred.Name = m_param.name + " conf_pred";
            m_blobConfGt        = new Blob <T>(cuda, log);
            m_blobConfGt.Name   = m_param.name + " conf_gt";
            m_blobConfLoss      = new Blob <T>(cuda, log);
            m_blobConfLoss.Name = m_param.name + " conf_loss";

            m_bboxUtil = new BBoxUtility <T>(cuda, log);

            m_hostConf = new HostBuffer <T>(cuda);
            m_hostLoc  = new HostBuffer <T>(cuda);
            m_hostGt   = new HostBuffer <T>(cuda);
            m_hostPrio = new HostBuffer <T>(cuda);
        }
Example #4
0
        /// <summary>
        /// Release any resources used.
        /// </summary>
        protected override void dispose()
        {
            dispose(ref m_blobLocPred);
            dispose(ref m_blobLocGt);
            dispose(ref m_blobLocLoss);
            dispose(ref m_blobConfPred);
            dispose(ref m_blobConfGt);
            dispose(ref m_blobConfLoss);

            if (m_hSsd != 0)
            {
                m_cuda.FreeSSD(m_hSsd);
                m_hSsd = 0;
            }

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

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

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

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

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

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

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

            base.dispose();
        }
Example #5
0
        /** @copydoc Layer::dispose */
        protected override void dispose()
        {
            if (m_bboxUtil != null)
            {
                m_bboxUtil.Dispose();
                m_bboxUtil = null;
            }

            base.dispose();
        }
Example #6
0
 /// <summary>
 /// The DetectionOutputLayer constructor.
 /// </summary>
 /// <param name="cuda">Specifies the CudaDnn connection to Cuda.</param>
 /// <param name="log">Specifies the Log for output.</param>
 /// <param name="p">Specifies the LayerParameter of type DETECTION_OUTPUT with parameter detection_output_param.
 /// </param>
 public DetectionOutputLayer(CudaDnn <T> cuda, Log log, LayerParameter p)
     : base(cuda, log, p)
 {
     m_type                 = LayerParameter.LayerType.DETECTION_OUTPUT;
     m_blobBboxPreds        = new Blob <T>(cuda, log);
     m_blobBboxPreds.Name   = m_param.name + " bbox preds";
     m_blobBboxPermute      = new Blob <T>(cuda, log);
     m_blobBboxPermute.Name = m_param.name + " bbox permute";
     m_blobConfPermute      = new Blob <T>(cuda, log);
     m_blobConfPermute.Name = m_param.name + " bbox conf";
     m_bboxUtil             = new BBoxUtility <T>(cuda, log);
 }
Example #7
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="cuda">Cuda engine.</param>
        /// <param name="log">General log.</param>
        /// <param name="p">provides MultiBoxLossParameter multiboxloss_param
        /// with MultiBoxLossLayer.
        /// </param>
        public MultiBoxLossLayer(CudaDnn <T> cuda, Log log, LayerParameter p)
            : base(cuda, log, p)
        {
            m_type = LayerParameter.LayerType.MULTIBOX_LOSS;

            m_blobLocPred = new Blob <T>(cuda, log);
            m_blobLocGt   = new Blob <T>(cuda, log);
            m_blobLocLoss = new Blob <T>(cuda, log);

            m_blobConfPred = new Blob <T>(cuda, log);
            m_blobConfGt   = new Blob <T>(cuda, log);
            m_blobConfLoss = new Blob <T>(cuda, log);

            m_bboxUtil = new BBoxUtility <T>(cuda, log);
        }
Example #8
0
        /// <summary>
        /// The DataTransformer constructor.
        /// </summary>
        /// <param name="cuda">Specifies the connection to the CudaDnn dll which is only needed when using the bbox or image transformation functionality.</param>
        /// <param name="log">Specifies the Log used for output.</param>
        /// <param name="p">Specifies the TransformationParameter used to create the DataTransformer.</param>
        /// <param name="phase">Specifies the Phase under which the DataTransformer is run.</param>
        /// <param name="nC">Specifies the channels.</param>
        /// <param name="nH">Specifies the height.</param>
        /// <param name="nW">Specifies the width.</param>
        /// <param name="imgMean">Optionally, specifies the image mean to use.</param>
        public DataTransformer(CudaDnn <T> cuda, Log log, TransformationParameter p, Phase phase, int nC, int nH, int nW, SimpleDatum imgMean = null)
        {
            m_log = log;

            int nDataSize = nC * nH * nW;

            m_param = p;
            InitRand();

            m_phase         = phase;
            m_bbox          = new BBoxUtility <T>(cuda, log);
            m_imgTransforms = new ImageTransforms <T>(cuda, log, m_random);

            Update(nDataSize, imgMean);
        }
Example #9
0
 /// <summary>
 /// The DetectionEvaluateLayer constructor.
 /// </summary>
 /// <param name="cuda">Specifies the CudaDnn connection to Cuda.</param>
 /// <param name="log">Specifies the Log for output.</param>
 /// <param name="p">Specifies the LayerParameter of type PERMUTE with parameter permute_param,
 /// with options:
 ///   - order Specifies the order of the permuations.
 /// </param>
 public DetectionEvaluateLayer(CudaDnn <T> cuda, Log log, LayerParameter p)
     : base(cuda, log, p)
 {
     m_type     = LayerParameter.LayerType.DETECTION_EVALUATE;
     m_bboxUtil = new BBoxUtility <T>(cuda, log);
 }