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

Adding attributes to the HandRegion class #12

Closed
Trey-Daviz opened this issue Jan 14, 2022 · 4 comments
Closed

Adding attributes to the HandRegion class #12

Trey-Daviz opened this issue Jan 14, 2022 · 4 comments

Comments

@Trey-Daviz
Copy link

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.

@geaxgx
Copy link
Owner

geaxgx commented Jan 14, 2022

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.

@Trey-Daviz
Copy link
Author

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.

@geaxgx
Copy link
Owner

geaxgx commented Jan 15, 2022

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()).

@geaxgx
Copy link
Owner

geaxgx commented Jan 26, 2022

No more activity.

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

No branches or pull requests

2 participants