-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Shape contexts #921
base: main
Are you sure you want to change the base?
Shape contexts #921
Conversation
skimage/feature/shapecontext.py
Outdated
radial_bins : integer | ||
number of log r bins in log-r vs theta histogram | ||
|
||
polar_bins : integer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, write int instead of integer
Here, write "int, optional"
Update: build now passes :-) |
skimage/feature/shapecontext.py
Outdated
current_pixel : int tuple, (r, c) | ||
the pixel for which to find shape context descriptor | ||
|
||
radial_bins : int, optional (default: 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you put the default value in the line below please?
Cool. I just scrooled the paper, it looks really interesting. Is it possible to make an example for the gallery? (see doc/examples) Core dev may have other comments. I have not read the code in details yet :) |
@sciunto I want to add the MNIST classification results of the paper which was the best on that dataset at the time the paper was published in 2002. They still are the best features with kNN classifier on MNIST. I may need to use |
skimage/feature/_shapecontext.pyx
Outdated
of histogram from current_pixel | ||
|
||
r_min : float | ||
minmimum distance of the pixels that are considered in computation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spelling error
also +1 for the gallery addition, this is a cool paper! |
Perhaps a better place for such a demo would be |
skimage/feature/_shapecontext.pyx
Outdated
Matching with Shape Contexts | ||
http://www.eecs.berkeley.edu/Research/Projects/CS/vision/shape/sc_digits.html | ||
|
||
.. [2] Wikipedia, "Shape Contexts". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[3] ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ehh yeah i was surprised too, but I guess it can't hurt if he learned what a shape context is there...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just included it for completeness since there is a wiki page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so in general we only cite the paper + if there's relevant source paper + if you looked at any code for reference but usually just the paper,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then i'll remove that reference
@stefanv I'd agree with that new home --- do we have any examples that use sklearn in the gallery? I'm guessing we don't want to introduce that dependency? |
skimage/feature/shapecontext.py
Outdated
the pixel for which to find shape context descriptor | ||
|
||
radial_bins : int, optional | ||
number of log r bins in log-r vs theta histogram (default: 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, sorry @sivapvarma for conflicting advice, but we only put the default values in the docstring for Cython functions, where there is no way to discover them by introspection. For Python functions, we don't specify default values, as they can be guessed independently, and putting them in the docstring increases the likelihood that the docstring and the definition will get out of sync.
@sciunto correct? Or am I missing something?
We do, however, start our docstring lines with a capital and end them with a full stop .
. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jni nope that sounds correct, other projects do this too, the default value still shows up in the function declaration + args when the docs are generated, so having them twice is redundant
@sivapvarma Yes, but notice that the examples there don't add any dependencies. |
Wikipedia citations are okay, as long as the whole thing is given: title + url (also, I prefer to only use it if the article is actually any good) |
I added an example. The images are from MNIST handwritten digits dataset. |
I think the API can be improved a bit. If everybody agrees, I'll go ahead and make the changes |
@jni well, OK. |
We should keep the Python wrapper. Also, to comply with the rest of the feature detectors / descriptors (e.g. BRIEF, ORB), I suggest to wrap it in a class. I know it's not necessary in case of But let's first discuss this. |
@ahojnnes I'm -1 on adding classes when a functional interface works equally well. To be honest I'm still not clear on why BRIEF and ORB weren't working as functions... |
doc/examples/plot_shapecontexts.py
Outdated
The Shape Context descriptor was introduced by Serge Belongie and Jitendra | ||
Malik. | ||
|
||
The Shape Context descriptor caputures the coarse distribution of the rest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spell check
@sivapvarma, do you know how to update your master branch and rebase onto that? If not, we might be able to help get this ready if you "enable commits from maintainers" on the bottom of the right side bar. Ultimately, we can always fork off your branch, but I feel there is more satisfaction if you get your orignal PR accepted start to finish 😄 |
a33b097
to
3bcdee1
Compare
Hello @sivapvarma! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
|
@hmaarrfk I rebased on to master and also allowed edits from maintainers. Let me know if there is anything else. |
Shape Contexts
paper link: http://www.eecs.berkeley.edu/Research/Projects/CS/vision/shape/belongie-pami02.pdf
refactor of code from PR#235 to make it more efficient and documentation
Current API :