求教:如何设置VGG的VL_PHOW中PHOW描述符的空间金字塔层级?
I’ve worked with the older PHOW library before too, so I get where you’re coming from—figuring out the new VL_phow setup can be tricky when you’re used to the old workflow. Here’s how you can configure the spatial pyramid levels for PHOW descriptors in the VLFeat implementation:
1. Command-Line Usage
If you’re using the VL_phow command-line tool, you can specify the spatial pyramid structure using the --spatial-binning flag. This parameter takes a comma-separated list defining the number of bins along the width and height for each pyramid level. For example:
vl_phow --spatial-binning 1x1,2x2,4x4 input_image.png
This sets up a 3-level spatial pyramid: the first level uses 1x1 bins (global pooling), the second splits the image into 2x2 regions, and the third uses 4x4 regions. Each level’s descriptors are concatenated to form the final PHOW feature vector.
2. MATLAB/Octave API
If you’re using the MATLAB/Octave interface, the vl_phow function accepts a 'SpatialBinning' parameter that works the same way. Here’s a code snippet:
img = imread('input_image.png'); [features, locations] = vl_phow(img, 'SpatialBinning', [1 1; 2 2; 4 4]);
The matrix [1 1; 2 2; 4 4] defines each pyramid level’s width and height bins, matching the command-line logic.
3. Python API
For the Python bindings, you can pass the spatial_binning argument to the phow function. Example:
import vlfeat import numpy as np from PIL import Image img = np.array(Image.open('input_image.png')) features, locations = vlfeat.vl_phow(img, spatial_binning=[(1,1), (2,2), (4,4)])
Quick Notes
- The number of pyramid levels is determined by how many bin pairs you provide. For a 2-level pyramid, just use
1x1,2x2(or the corresponding matrix/list in code). - Ensure your VLFeat version is up to date—older builds might not expose this parameter clearly.
- To replicate the old PHOW library’s behavior, check its default pyramid levels (usually 3 levels: 1x1, 2x2, 4x4 is standard) and mirror that in your VL_phow setup.
I hope this helps you get the spatial pyramid configured properly! Let me know if you run into any specific implementation snags.
内容的提问来源于stack exchange,提问作者Gilmario Santos

