pupil-labs / pupil

Open source eye tracking
https://pupil-labs.com
GNU Lesser General Public License v3.0
1.48k stars 678 forks source link

Gazer2D calibration data(errorlines/convex hull) no longer displayed. #2321

Open bpinsard opened 1 year ago

bpinsard commented 1 year ago

In past versions, there was a bunch of orange lines in the world window + convex hull that were displayed when completing a calibration. It's no longer the case in the master branch in my conditions (do not have pupil hardware to test).

I am sending calibration data through the IPC backbone for tests with smthg like :

send_recv_notification(
            {
                "subject": "start_plugin",
                "name": "Gazer2D",
                "args": {"calib_data": calib_data},
                "raise_calibration_error": True,
            }
        )

The calibration is successful, but nothing is displayed in the world window, (was working in anterior versions).

When I changed that line https://github.com/pupil-labs/pupil/blob/master/pupil_src/shared_modules/gaze_mapping/notifications.py#L50 to except only AssertionError, I get the following traceback.

Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/basile/data/src/pupil/pupil_src/launchables/world.py", line 743, in world
    p.on_notify(n)
  File "/home/basile/data/src/pupil/pupil_src/shared_modules/accuracy_visualizer.py", line 311, in on_notify
    if self.__handle_calibration_setup_notification(notification):
  File "/home/basile/data/src/pupil/pupil_src/shared_modules/accuracy_visualizer.py", line 326, in __handle_calibration_setup_notification
    note = CalibrationSetupNotification.from_dict(note_dict)
  File "/home/basile/data/src/pupil/pupil_src/shared_modules/gaze_mapping/notifications.py", line 48, in from_dict
    dict_ = cls.sanitize_serialized_dict(dict_)
  File "/home/basile/data/src/pupil/pupil_src/shared_modules/gaze_mapping/notifications.py", line 108, in sanitize_serialized_dict
    return super().sanitize_serialized_dict(dict_)
  File "/home/basile/data/src/pupil/pupil_src/shared_modules/gaze_mapping/notifications.py", line 101, in sanitize_serialized_dict
    return super().sanitize_serialized_dict(dict_)
  File "/home/basile/data/src/pupil/pupil_src/shared_modules/gaze_mapping/notifications.py", line 59, in sanitize_serialized_dict
    dict_[field_name] = field_cls(dict_[field_name])
TypeError: 'ForwardRef' object is not callable

So the Gazer2D notification is silently dismissed and never processed by the AccuracyVisualizer, hence the absence of display. The particular value of the notification that seems to trigger that exception during unserialization is gazer_class_name:Gazer2D

I am not sure what exactly changed in the code to cause that issue and I am not exactly sure how it can be fixed. env: python3.8.10 on linux

bpinsard commented 1 year ago

does not happen with python3.9. so that seems related to the difference in https://github.com/pupil-labs/pupil/blob/master/pupil_src/shared_modules/gaze_mapping/notifications.py#L18-L34

bpinsard commented 1 year ago

However, it seems that typing.get_type_hints was introduced in 3.5 https://docs.python.org/3.5/library/typing.html#typing.get_type_hints Unless it didn't had the same behavior as in 3.9+ .

mikelgg93 commented 1 year ago

Hi. @bpinsard !

Thanks for reporting it. Would you mind clarifying whether you are running it from source or from the bundle? And if you are doing it from source, which branch are you using?

bpinsard commented 1 year ago

Yes running from source, from master branch.

mikelgg93 commented 1 year ago

Hi! We recommend installing it from the bundle unless strictly necessary (i.e. because you want to modify some parts of the source code). Is that the case? Otherwise, you can install it by downloading the precompiled version from Releases.

When running from the source, we recommend using the develop branch to install the dependencies. Please read the section installing dependencies.

With that said, the master branch already has some changes that are coming with release 3.6 (not yet released). See MR at commit 5e678b718a22f6492e95ff09d508340d5c554427

We did not finalise the release, so you can roll back your local version to a previous commit and run it from there or ride wild with us 😉 . I leave here some notes as an advance of the changes implemented.

Updated Dependencies

Previous versions of Pupil Core software targeted Python 3.6. With its end-of-life on 23 Dec 2021, we decided to start targeting a modern version: Python 3.11.

While all Pupil Core version 3.6 bundles will ship with Python 3.11, the source code and all dependencies will remain compatible with Python 3.7 and newer. For details, see the Developer Notes section below.

Dependencies updates

These dependencies that changed most during the transition from Python 3.6 to 3.11:

pyaudio - This project does not provide Windows wheels for Python 3.7 or newer. Therefore, we switched to sounddevice, another libportaudio wrapper with a similar API pyav - We no longer use our fork but use the official version pyuvc - Not only did we add support for streaming uncompressed video (GRAY8), we also reworked the build pipeline and are now publishing this package on PyPI. All other depencies are available on PyPI as well. As a result, running from source has become easier than ever! We updated the instructions accordingly.

Note: We use Github Actions to build the wheels automatically. At the time of writing, Github Actions do not provide the possibility to run the build pipeline on an arm64-based Mac. Therefore, we only provide x86_64-based wheels for macOS.

Python dependencies can be updated using pip and the requirements.txt file:

python -m pip install --upgrade pip wheel
pip uninstall uvc
pip install -r requirements.txt

Note: It is important to uninstall previous versions of pyuvc(pip uninstall uvc) because of incompatibility with the newer pupil-labs-uvc package.