Closed SikaStar closed 6 years ago
Hi,
Detected 3774 keypoints and 2178 affine shapes in 0.57952 sec.
Then I read first 3774 number and used it as a desired number of features.
You just use it as here, see https://github.com/ducha-aiki/affnet/blob/master/examples/hesaffnet/WBS%20demo.ipynb
LAFs, resp = det(img)
patches = detector.extract_patches_from_pyr(LAFs, PS = 32)
"Spatial transformer networks" are just differentiable bilinear image sampling. I used it, because it is GPU-accelerated, not because of gradients. So it is just a function to extract the patches.
One can do it per patch, but this would be extremely slow, especially on GPU. We have compared timings on CPU in this paper: ftp://cmp.felk.cvut.cz/pub/cmp/articles/matas/lenc-2014-features-cvww.pdf Instead one can create Gaussian pyramid, which is image, blurred by different amount of blur. And depending on scale of the feature == size of patch in original image, select proper level of the pyramid and extract patch directly from there. https://en.wikipedia.org/wiki/Pyramid_(image_processing)
I also suggest you to read original SIFT paper, where the typical pipeline for local feature extraction are explained https://www.robots.ox.ac.uk/~vgg/research/affine/det_eval_files/lowe_ijcv2004.pdf
@SikaStar code added. Comment out this line https://github.com/ducha-aiki/affnet/blob/master/examples/hesaffnet/hesaffnet.py#L26 to turn on threshold version instead of "num_features"
@SikaStar you might be interested in this https://github.com/ducha-aiki/mods-light-zmq It integrates pytorch AffNet and HardNet with state-of-the art C++ matching code. It also has extract features option, one which was used in AffNet paper
Hi, I cannot understand the details about extracting patches and I have some questions:
extract_patches_from_pyr
, does it have something to do with "Spatial Transformer Networks"? Because you used thetorch.nn.functional.affine_grid
andtorch.nn.functional.grid_sample
functions in Pytorch inLAF.py
.scale_pyramid, pyr_inv_idxs,
inextract_patches_from_pyramid_with_inv_index