/** @copydoc Layer::dispose */ protected override void dispose() { base.dispose(); if (m_rgBatchLabels != null) { m_rgBatchLabels.Dispose(); m_rgBatchLabels = null; } if (m_blobMask != null) { m_blobMask.Dispose(); m_blobMask = null; } if (m_blobMask1 != null) { m_blobMask1.Dispose(); m_blobMask1 = null; } if (m_blobDebug1 != null) { m_blobDebug1.Dispose(); m_blobDebug1 = null; } }
/// <summary> /// The DataLayer 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 data_param</param> /// <param name="db">Specifies the external database to use.</param> /// <param name="evtCancel">Specifies the CancelEvent used to cancel any pre-fetching operations.</param> public DataLayer(CudaDnn <T> cuda, Log log, LayerParameter p, IXImageDatabaseBase db, CancelEvent evtCancel) : base(cuda, log, p, db, evtCancel) { m_type = LayerParameter.LayerType.DATA; if (p.data_param.synchronize_target) { m_rgBatchLabels = new LabelCollection(); } Tuple <IMGDB_LABEL_SELECTION_METHOD, IMGDB_IMAGE_SELECTION_METHOD> kvSel = db.GetSelectionMethod(); IMGDB_IMAGE_SELECTION_METHOD imgSel = kvSel.Item2; if (m_param.data_param.enable_pair_selection.HasValue) { if (m_param.data_param.enable_pair_selection.Value) { imgSel |= IMGDB_IMAGE_SELECTION_METHOD.PAIR; } else { imgSel &= (~IMGDB_IMAGE_SELECTION_METHOD.PAIR); } } if (m_param.data_param.enable_random_selection.HasValue) { if (m_param.data_param.enable_random_selection.Value) { imgSel |= IMGDB_IMAGE_SELECTION_METHOD.RANDOM; } else { imgSel &= (~IMGDB_IMAGE_SELECTION_METHOD.RANDOM); } } db.SetSelectionMethod(null, imgSel); m_db = new data.DB <T>(db); m_db.Open(p.data_param.source); if (p.data_param.display_timing) { m_swTimerBatch = new Stopwatch(); m_swTimerTransaction = new Stopwatch(); } if (m_param.transform_param.mask_param != null && m_param.transform_param.mask_param.Active) { m_blobMask = new Blob <T>(cuda, log, false); m_blobMask1 = new Blob <T>(cuda, log, false); } if (m_param.data_param.enable_debug_output) { m_blobDebug1 = new Blob <T>(cuda, log, false); } }
/** @copydoc Layer::dispose */ protected override void dispose() { if (m_rgBatchLabels != null) { m_rgBatchLabels.Dispose(); m_rgBatchLabels = null; } base.dispose(); }