descriptor

Training of SVM classifier using SIFT features

痴心易碎 提交于 2019-11-29 08:10:18
please i like to classify a set of image in 4 class with SIFT DESCRIPTOR and SVM. Now, using SIFT extractor I get keypoints of different sizes exemple img1 have 100 keypoints img2 have 55 keypoints.... how build histograms that give fixed size vectors with matlab In this case, perhaps dense sift is a good choice. There are two main stages: Stage 1 : Creating a codebook. Divide the input image into a set of sub-images. Apply sift on each sub-image. Each key point will have 128 dimensional feature vector. Encode these vectors to create a codebook by simply applying k-means clustering with a

python data and non-data descriptors

送分小仙女□ 提交于 2019-11-29 03:57:15
According to Python's documentation , Data descriptors with __set__() and __get__() defined always override a redefinition in an instance dictionary. I have no problem understanding this sentence, but can someone clarify for me why such a rule is in place? After all, if I want to override an attribute in an instance dictionary, I already need to do that explicitely ( inst.__dict__["attr"] = val ), as a naive inst.attr = val would call the descriptor's __set__ method, which would (usually) not override the attribute in the instance dictionary. edit: just to make it clear, I understand what is

python resettable instance method memoization decorator

会有一股神秘感。 提交于 2019-11-29 02:04:10
I'm attempting to build a decorator for an instance method of a class that will memoize the result. (This has been done a million times before) However, I'd like the option of being able to reset the memoized cache at any point (say, if something in the instance state changes, which might change the result of the method having nothing to do with its args). So, I attempted to build a decorator as a class instead of a function, so that I might have access to the cache as a class member. This led me down the path of learning about descriptors, specifically the __get__ method, which is where I'm

Eclipse 'loading descriptor' takes ages

大兔子大兔子 提交于 2019-11-29 01:49:15
问题 We have a Java Spring MVC based project using Eclipse (Juno - the latest build), using the latest JVM 1.7 and Tomcat 7. Eclipse is pretty fast, and everything is set to default settings. Once it is all loaded up, it is lightning fast, which makes a pleasant change. However, the only gripe is that if I open a project, it begins 'Loading descriptor', which as far as I can tell is our 185-line web.xml file. Sometimes this might take 5 minutes to load, sometimes might just not load at all. This

When and why might I assign an instance of a descriptor class to a class attribute in Python rather than use a property?

*爱你&永不变心* 提交于 2019-11-28 23:24:17
I'm aware that a property is a descriptor, but are there specific examples of when using a descriptor class might be more advantageous, pythonic, or provide some benefit over using @property on a method function? Better encapsulation and re-usability: A descriptor class can have custom attributes set on instantiating. Sometimes it's useful to keep data confined in this manner, instead of having to worry about it getting set or overwritten on the descriptor's owner. Let me quote from the EuroPython 2012 great video "Discovering Descriptors" : How to choose between descriptors and properties:

How to visualize descriptor matching using opencv module in python

回眸只為那壹抹淺笑 提交于 2019-11-28 18:59:41
I am trying to use opencv with python. I wrote a descriptor (SIFT, SURF, or ORB) matching code in C++ version of opencv 2.4. I want to convert this code to opencv with python. I found some documents about how to use opencv functions in c++ but many of the opencv function in python I could not find how to use them. Here is my python code, and my current problem is that I don't know how to use "drawMatches" of opencv c++ in python. I found cv2.DRAW_MATCHES_FLAGS_DEFAULT but I have no idea how to use it. Here is my python code of matching using ORB descriptors: im1 = cv2.imread(r'C:\boldt.jpg')

Descriptors as instance attributes in python

怎甘沉沦 提交于 2019-11-28 18:46:34
To the question: Why can't descriptors be instance attributes? it has been answered that: descriptor objects needs to live in the class, not in the instance because that is the way that the __getattribute__ is implemented. A simple example. Consider a descriptor: class Prop(object): def __get__(self, obj, objtype=None): if obj is None: return self return obj._value * obj._multiplier def __set__(self, obj, value): if obj is None: return self obj._value = value class Obj(object): val = Prop() def __init__(self): self._value = 1 self._multiplier = 0 Consider the case in which each obj has

How to implement __iadd__ for a Python property

放肆的年华 提交于 2019-11-28 03:08:56
问题 I'm trying to create a Python property where in-place adding is handled by a different method than retrieving the value, adding another value and reassigning. So, for a property x on an object o , o.x += 5 should work differently than o.x = o.x + 5 The value of o.x should be the same in the end, so as not to confuse people's expectations, but I want to make the in-place add more efficient. (In reality the operation takes a lot more time than simple addition.) My first idea was to define, in

Why is the Descriptor not getting called when defined as instance attribute?

烂漫一生 提交于 2019-11-27 23:49:05
When I make the "data" variable a class variable, the following works, but when I make it an object variable, the descriptor is not called. Please help. class Data(object): products = { 'milk': {'price': 1.50, 'quantity': 10}, 'eggs': {'price': 0.20, 'quantity': 100}, 'cheese': {'price': 2.00, 'quantity': 10} } def __get__(self, obj, klas): print "Here in descriptor" return self.products class BusinessLogic(object): def __init__(self): # When I remove these 2 lines self.data = Data() #data = Data() # and enable this line it does work ! def main(): b = BusinessLogic() b.data if __name__ == '_

python data and non-data descriptors

你。 提交于 2019-11-27 22:12:50
问题 According to Python's documentation, Data descriptors with __set__() and __get__() defined always override a redefinition in an instance dictionary. I have no problem understanding this sentence, but can someone clarify for me why such a rule is in place? After all, if I want to override an attribute in an instance dictionary, I already need to do that explicitely ( inst.__dict__["attr"] = val ), as a naive inst.attr = val would call the descriptor's __set__ method, which would (usually) not