Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update hog #59

Merged
merged 1 commit into from
Jul 6, 2020
Merged

update hog #59

merged 1 commit into from
Jul 6, 2020

Conversation

hubutui
Copy link
Contributor

@hubutui hubutui commented Jun 27, 2020

  1. remove unneeded function declaration
  2. specify memoryview order
  3. image is row-major by default
  4. add visualize optional flag, return a HOG image if True
  5. update document
  6. update hog test, use face image from scipy
  7. add channel_first optional flag, specify if the input array is in
    channel-first format

@hubutui hubutui force-pushed the master branch 6 times, most recently from 25861bc to 2acf109 Compare July 1, 2020 14:28
@hubutui
Copy link
Contributor Author

hubutui commented Jul 1, 2020

@patricksnape Hey, could you check if this pr could be merged?

@patricksnape
Copy link
Contributor

Can we fix the RGB before merging?

@patricksnape
Copy link
Contributor

I guess this is because ignoring memory order is incorrect

@hubutui
Copy link
Contributor Author

hubutui commented Jul 4, 2020

I create a simple demo in C++ using the C library to calculate HOG features, see https://github.com/hubutui/vlfeat-hog-example. The extracted feature is saved to a txt file one value per line with no reshape operation. So we could load it later on with np.loadtxt, reshape it to [dim, h, w], where dim is HOG feature dimension, its value is 31 for the default UoCTTI variant. Then we swap its axes to [h, w, dim] as we used in cyvlfeat. numpy.testing.assert_allclose shows that the HOG feauture calculated from C API and cyvlfeat are close enough for gray scale image, but not for RGB color image.

@hubutui hubutui force-pushed the master branch 3 times, most recently from 28aac29 to 3db3dd0 Compare July 5, 2020 09:07
"""
# vlfeat requires image in channel-first style
if image.ndim == 3:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only other thing I would request is a flag to be able to control this behaviour - in case the user wants to pass something where the channels are already first. Maybe something like channels_first=False?

@patricksnape
Copy link
Contributor

This is amazing work! The mat files are really really good tests and you approached this really methodically which makes it really easy for me to review.

I had one annoying nitpick comment and then we are good to go and I can make a release.

Thanks a lot for this work!

1. remove unneeded function declaration
2. specify memoryview order
3. image is row-major by default
4. add `visualize` optional flag, return a HOG image if True
5. update document
6. update hog test, use face image from scipy
7. add `channel_first` optional flag, specify if the input array is in
   channel-first format
@hubutui
Copy link
Contributor Author

hubutui commented Jul 6, 2020

@patricksnape OK, I have update again. I think we could merge it now. I'd like to update sift before we could make a new release.

@patricksnape
Copy link
Contributor

Thanks for your hard work - this was an excellent PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants