Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors = [
]
license = 'MIT'
readme = "README.md"
requires-python = ">3.6"
requires-python = ">=3.9, <3.13" # mediapipe requires 3.9-3.12

keywords = ["eye-tracking", "scalable", "rgb", "gaze"]

Expand All @@ -19,7 +19,8 @@ dependencies = [
'mediapipe',
'numpy',
"opencv-python",
"scipy"
"scipy",
"tensorflow",
]

[project.optional-dependencies]
Expand All @@ -43,6 +44,11 @@ include-package-data = true
[tool.setuptools.packages.find]
where = ["."]

[tool.setuptools.package-data]
webeyetrack = [
"model_weights/*",
]

[tool.ruff]
ignore = ["E501"]
select = ["E", "W", "F", "C", "B", "I"]
Expand Down
4 changes: 2 additions & 2 deletions python/webeyetrack/constants.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pathlib
import numpy as np

GIT_ROOT = pathlib.Path(__file__).parent.parent.parent
PACKAGE_DIR = GIT_ROOT / 'python' / 'webeyetrack'
# Resolve paths relative to the installed package directory (not GIT_ROOT) so it works in wheels. importlib.resources might be a better option.
PACKAGE_DIR = pathlib.Path(__file__).parent
DEFAULT_CONFIG = PACKAGE_DIR / 'default_config.yaml'
MODEL_WEIGHTS = PACKAGE_DIR / 'model_weights'
FACE_LANDMARKER_PATH = MODEL_WEIGHTS / 'face_landmarker_v2_with_blendshapes.task'
Expand Down
2 changes: 1 addition & 1 deletion python/webeyetrack/data_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class GazeResult:
gaze_state: Literal['open', 'closed'] = 'open'

# PoG (normalized screen coordinates)
norm_pog: np.ndarray = np.array([0.5, 0.5])
norm_pog: np.ndarray = field(default_factory=lambda: np.array([0.5, 0.5]))

# Meta data
durations: dict[str, float] = field(default_factory=dict) # seconds
Expand Down
6 changes: 3 additions & 3 deletions python/webeyetrack/webeyetrack.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import time
import pathlib
from typing import Union, Any, Tuple, Optional, List, Literal
from dataclasses import dataclass
from dataclasses import dataclass, field
import random

import tensorflow as tf
Expand Down Expand Up @@ -171,8 +171,8 @@ class WebEyeTrackConfig():
screen_cm_dimensions: Tuple[float, float] = (53.1, 29.8)
verbose: bool = False
affine_matrix: Optional[np.ndarray] = None
kalman_config: KalmanFilterConfig = KalmanFilterConfig()
calib_config: CalibConfig = CalibConfig()
kalman_config: KalmanFilterConfig = field(default_factory=lambda: KalmanFilterConfig())
calib_config: CalibConfig = field(default_factory=lambda: CalibConfig())

class WebEyeTrack():

Expand Down