فهرست منبع

ConvolutionFeature: changed scaling procedure (cur. deactivated)

Sven Sickert 10 سال پیش
والد
کامیت
c1241dc7d7
1فایلهای تغییر یافته به همراه30 افزوده شده و 20 حذف شده
  1. 30 20
      features/fpfeatures/ConvolutionFeature.cpp

+ 30 - 20
features/fpfeatures/ConvolutionFeature.cpp

@@ -213,7 +213,7 @@ double ConvolutionFeature::val ( const Example *example ) const
     y = example->y;
     y = example->y;
 
 
     const int colorStep = window_size_x*window_size_y;
     const int colorStep = window_size_x*window_size_y;
-    const int scalingSteps = 3;
+    const int scalingSteps = 1;
 
 
     int halfwsx = std::floor ( window_size_x / 2 );
     int halfwsx = std::floor ( window_size_x / 2 );
     int halfwsy = std::floor ( window_size_y / 2 );
     int halfwsy = std::floor ( window_size_y / 2 );
@@ -221,30 +221,40 @@ double ConvolutionFeature::val ( const Example *example ) const
 
 
     for ( int s = 0; s < scalingSteps; s++ )
     for ( int s = 0; s < scalingSteps; s++ )
     {
     {
-        int k = 1;
-        for ( int v = -halfwsy; v <= halfwsy; v+=wScale )
-            for ( int u = -halfwsx; u <= halfwsx; u+=wScale, k++ )
-            {
-                int uu = u;
-                int vv = v;
-                if (x+u < 0 || x+u >= xsize) uu=-u;
-                if (y+v < 0 || y+v >= ysize) vv=-v;
-                if ( x+uu > 0
-                     && x+uu < xsize
-                     && y+vv > 0
-                     && y+vv < ysize
-                     && k < beta->size() )
+        for ( int c = 0; c < numChannels; c++ )
+        {
+            int paramIdx = 1;
+            int pxIdx = 0;
+            for ( int v = -halfwsy; v <= halfwsy; v++ )
+                for ( int u = -halfwsx; u <= halfwsx; u++, pxIdx++ )
                 {
                 {
-                    for ( int c = 0; c < numChannels; c++ )
-                        val1 += imgD->get(x+uu,y+vv,c) * beta->operator [](k+c*colorStep);
+                    if (pxIdx % wScale == 0) paramIdx++;
+
+                    int colorShift = paramIdx + c*colorStep;
+                    int uu = u;
+                    int vv = v;
+
+                    if (x+u < 0 || x+u >= xsize) uu=-u;
+                    if (y+v < 0 || y+v >= ysize) vv=-v;
+
+                    if ( x+uu > 0
+                         && x+uu < xsize
+                         && y+vv > 0
+                         && y+vv < ysize
+                         && paramIdx < beta->size() )
+                    {
+                        val1 += imgD->get(x+uu,y+vv,c)
+                                * beta->operator [](colorShift)
+                                / wScale * wScale;
+                    }
 
 
                 }
                 }
-            }
+        }
 
 
         // increase scaling
         // increase scaling
-        halfwsx *= 2;
-        halfwsy *= 2;
-        wScale *= 2;
+        halfwsx *= 3;
+        halfwsy *= 3;
+        wScale *= 3;
     }
     }
 
 
     // normalize scaling
     // normalize scaling