antoinelame / GazeTracking

👀 Eye Tracking library easily implementable to your projects
MIT License
1.85k stars 505 forks source link

unable to run example.py #2

Closed HemantAHK closed 5 years ago

HemantAHK commented 5 years ago

Hello, i am trying to run your algorithm but got this error. Please take a look. I am using windows with Python 3.5. Can you give me a Detailed view on this?@antoinelame

Traceback (most recent call last): File "example.py", line 9, in gaze = GazeTracking() File "C:\Users\Sravani\Desktop\GazeTracking-master\gaze_tracking\gaze_tracking.py", line 16, in init self.eyes = EyesDetector() File "C:\Users\Sravani\Desktop\GazeTracking-master\gaze_tracking\eyes.py", line 26, in init self._predictor = dlib.shape_predictor(model_path) RuntimeError: Error deserializing object of type int [ WARN:0] terminating async callback

antoinelame commented 5 years ago

Hello,

Looks like your "_shape_predictor_68_facelandmarks.dat" file is corrupted. Try to re-download it and check that the md5 checksum of the file is: 73fde5e05226548677a050913eed4e04

HemantAHK commented 5 years ago

@antoinelame ok I have done it's working by the way how to trace the eye gazing of top and bottom I have used your functions but unable to trace top and bottom

antoinelame commented 5 years ago

At the moment, only is_right() and is_left() functions are available in the current version. It uses the horizontal_ratio() function that returns a number between 0.0 and 1.0 that indicates the horizontal direction of the gaze.

I didn't create is_top() and is_bottom() functions, but I have created vertical_ratio(). It's similar to horizontal_ratio(), it returns a number between 0.0 and 1.0.

You can use it to know if the gaze is at the top or at the bottom. Call this function, and if the number returned is around 0.0, it means that the pupil is at the top. If the number returned is around 1.0, it means that the pupil is at the bottom.

For convenience, if you need it, you also can create is_top() and is_bottom() functions like so:

def is_top(self):
        """Returns true if the user is looking to the top"""
        try:
            return self.vertical_ratio() <= 0.30
        except TypeError:
            return None

It will return true if the vertical_ratio is below 0.3.

It's up to you to define what number should be the limit between looking at the center and looking to the top (0.30 in my example). I had not created these functions because I found that the margin of error up/down was too large, unlike the left/right. I guess because the distance between the left and right end is greater than the distance between the upper and lower end.

Otherwise, is the position of your pupils correctly detected? For the moment, the program is mainly calibrated according to my eyes and webcam. So I wonder if it works as well for other people. If not, don't hesitate to change the value of the threshold. (in pupil.py, image_processing method, line 31, value currently at 20).

HemantAHK commented 5 years ago

@antoinelame it is working fine. And I will try the changes.Thankyou for ur time.