@@ -518,57 +518,6 @@ class ConvolutionSKLayer : public Layer<Dtype> {
518518 int M_ , K_ , N_ ;
519519};
520520
521-
522- /* *
523- * @brief Convolves the input image for pixelwise classification.
524- *
525- * Layer introduced by Hongsheng et al.
526- */
527- template <typename Dtype>
528- class ConvolutionNDSKLayer : public Layer <Dtype> {
529- public:
530- explicit ConvolutionNDSKLayer (const LayerParameter& param)
531- : Layer<Dtype>(param) {
532- }
533-
534- virtual void LayerSetUp (const vector<Blob<Dtype>*>& bottom,
535- const vector<Blob<Dtype>*>& top);
536- virtual void Reshape (const vector<Blob<Dtype>*>& bottom,
537- const vector<Blob<Dtype>*>& top);
538-
539- virtual inline const char * type () const {
540- return " ConvolutionNDSK" ;
541- }
542-
543- protected:
544- virtual void Forward_cpu (const vector<Blob<Dtype>*>& bottom,
545- const vector<Blob<Dtype>*>& top);
546- virtual void Forward_gpu (const vector<Blob<Dtype>*>& bottom,
547- const vector<Blob<Dtype>*>& top);
548- virtual void Backward_cpu (const vector<Blob<Dtype>*>& top,
549- const vector<bool >& propagate_down,
550- const vector<Blob<Dtype>*>& bottom);
551- virtual void Backward_gpu (const vector<Blob<Dtype>*>& top,
552- const vector<bool >& propagate_down,
553- const vector<Blob<Dtype>*>& bottom);
554-
555- shared_ptr< Blob<Dtype> > col_buffer ();
556-
557- int kernel_h_, kernel_w_;
558- int stride_h_, stride_w_;
559- int channels_;
560- int group_;
561- int height_, width_;
562- int pad_h_, pad_w_;
563- int kstride_h_, kstride_w_;
564- int num_, num_output_;
565- Blob<Dtype> col_buffer_;
566- Blob<Dtype> bias_multiplier_;
567- bool bias_term_;
568- int M_ , K_ , N_ ;
569- };
570-
571-
572521/* *
573522 * @brief Convolves the input image with a bank of learned filters,
574523 * and (optionally) adds biases.
@@ -925,6 +874,63 @@ class PoolingSKLayer : public Layer<Dtype> {
925874 Blob<int > max_idx_;
926875};
927876
877+
878+ /* *
879+ * @brief Pools the input image by taking the max, average, etc. within regions.
880+ *
881+ * For whole image processing, reducing redundancy.
882+ */
883+ template <typename Dtype>
884+ class PoolingNDLayer : public Layer <Dtype> {
885+ public:
886+ explicit PoolingNDLayer (const LayerParameter& param)
887+ : Layer<Dtype>(param) {
888+ }
889+ virtual void LayerSetUp (const vector<Blob<Dtype>*>& bottom,
890+ const vector<Blob<Dtype>*>& top);
891+ virtual void Reshape (const vector<Blob<Dtype>*>& bottom,
892+ const vector<Blob<Dtype>*>& top);
893+
894+ protected:
895+ virtual void Forward_cpu (const vector<Blob<Dtype>*>& bottom,
896+ const vector<Blob<Dtype>*>& top);
897+ virtual void Forward_gpu (const vector<Blob<Dtype>*>& bottom,
898+ const vector<Blob<Dtype>*>& top);
899+ virtual void Backward_cpu (const vector<Blob<Dtype>*>& top,
900+ const vector<bool >& propagate_down,
901+ const vector<Blob<Dtype>*>& bottom);
902+ virtual void Backward_gpu (const vector<Blob<Dtype>*>& top,
903+ const vector<bool >& propagate_down,
904+ const vector<Blob<Dtype>*>& bottom);
905+
906+ virtual inline const char * type () const {
907+ return " PoolingND" ;
908+ }
909+ virtual inline int ExactNumBottomBlobs () const {
910+ return 1 ;
911+ }
912+ virtual inline int MinTopBlobs () const {
913+ return 1 ;
914+ }
915+ // MAX POOL layers can output an extra top blob for the mask;
916+ // others can only output the pooled inputs.
917+ virtual inline int MaxTopBlobs () const {
918+ return
919+ (this ->layer_param_ .pooling_param ().pool ()
920+ == PoolingParameter_PoolMethod_MAX) ? 2 : 1 ;
921+ }
922+
923+ int max_top_blobs_;
924+ int pad_h_, pad_w_;
925+ int channels_;
926+ int height_, width_;
927+ int pooled_height_, pooled_width_;
928+ int kernel_h_, kernel_w_;
929+ int stride_h_, stride_w_;
930+ int kstride_h_, kstride_w_;
931+ Blob<int > max_idx_;
932+ };
933+
928934/* *
929935 * @brief Pools the input image by taking the max, average, etc. within regions.
930936 *
0 commit comments