Adding attributes to the HandRegion class
Trey-Daviz opened this issue · comments
Hi guys! I've been diving deep into this project lately, but I've gotten a bit stuck when I try to expand upon it. Currently, I'm working on expanding it to not just recognize gestures, but to recognize a sequence (an array of gestures) like if I were to gesture one, two, three, four, five, it would be able to recognize that as "counting to five". I think that this has cool applications, but I hit a road block. When trying to add some attributes to hand region to make this compatible to how I want to do this, I only see the docstring for hand_region. The init doesn't even initialize hand.gesture. It's weird enough to not initialize anything, but I can't even find declarations for these attributes inside of the class. Where can I find your attribute declarations so that I can continue modifying the code to work for my purposes? For reference of my current skill level, I am well versed in coding, but machine learning is a new subject for me.
Hi, the 'gesture' attribute is set in the recognize_gesture() function of file mediapipe_utils.py (only when the argument 'use_gesture' of HandTracker* class is set to True).
I will add the missing comment in the HandRegion docstring.
I saw that, but it still doesn't make sense to me.
This line of code:
if self.use_gesture: mpu.recognize_gesture(hand)
is what calls recognize_gesture.
It checks if use_gesture is true, and if it is, it starts trying to recognize the gesture. However, that doesn't explain where gesture is declared. That's where gesture is initialized. I use hand.gesture often in my coding, but I can not seem to find where I can add a new attribute to the Hand Region class.
I am not sure to get your point. You know that in python, you don't need to declare variables or class attributes ? If you want to add new attributes to the HandRegion class, you can do it wherever you want (no need to declare or even initialize the attribute in the init()).
No more activity.