Giter VIP home page Giter VIP logo

eyeloop's Introduction

EyeLoop License: GPL v3 contributions welcome Build Status version lab beta

   

EyeLoop is a Python 3-based eye-tracker tailored specifically to dynamic, closed-loop experiments on consumer-grade hardware. Users are encouraged to contribute to EyeLoop's development.

Features

  • High-speed > 1000 Hz on non-specialized hardware (no dedicated processing units necessary).
  • Modular, readable, customizable.
  • Open-source, and entirely Python 3.
  • Works on any platform, easy installation.

Overview

How it works

EyeLoop consists of two functional domains: the engine and the optional modules. The engine performs the eye-tracking, whereas the modules perform optional tasks, such as:

  • Experiments
  • Data acquisition
  • Importing video sequences to the engine

The modules import or extract data from the engine, and are therefore called Importers and Extractors, respectively.

One of EyeLoop's most appealing features is its modularity: Experiments are built simply by combining modules with the core Engine. Thus, the Engine has one task only: to compute eye-tracking data based on an imported sequence, and offer the generated data for extraction.

How does the Engine work?
How does the Importer work?
How does the Extractor work?

Getting started

Installation

Install EyeLoop by cloning the repository:

git clone https://github.com/simonarvin/eyeloop.git

Dependencies: python -m pip install -r requirements.txt

Using pip: pip install .

You may want to use a Conda or Python virtual environment when installing eyeloop, to avoid mixing up with your system dependencies.

Using pip and a virtual environment:

python -m venv venv

source venv/bin/activate

(venv) pip install .

Alternatively:

  • numpy: python pip install numpy
  • opencv: python pip install opencv-python

To download full examples with footage, check out EyeLoop's playground repository:

git clone https://github.com/simonarvin/eyeloop_playground.git

Initiation

EyeLoop is initiated through the command-line utility eyeloop.

eyeloop

To access the video sequence, EyeLoop must be connected to an appropriate importer class module. Usually, the default opencv importer class (cv) is sufficient. For some machine vision cameras, however, a vimba-based importer (vimba) is neccessary.

eyeloop --importer cv/vimba

Click here for more information on importers.

To perform offline eye-tracking, we pass the video argument --video with the path of the video sequence:

eyeloop --video [file]/[folder]

EyeLoop can be used on a multitude of eye types, including rodents, human and non-human primates. Specifically, users can suit their eye-tracking session to any species using the --model argument.

eyeloop --model ellipsoid/circular

In general, the ellipsoid pupil model is best suited for rodents, whereas the circular model is best suited for primates.

To learn how to optimize EyeLoop for your video material, see EyeLoop Playground.

To see all command-line arguments, pass:

eyeloop --help

Designing your first experiment

In EyeLoop, experiments are built by stacking modules. By default, EyeLoop imports two base extractors, namely a FPS-counter and a data acquisition tool. To add custom extractors, e.g., for experimental purposes, use the argument tag --extractors:

eyeloop --extractors [file_path]/p (where p = file prompt)

Inside the extractor file, or a composite python file containing several extractors, define the list of extractors to be added:

extractors_add = [extractor1, extractor2, etc]

Extractors are instantiated by EyeLoop at start-up. Then, at every subsequent time-step, the extractor's fetch() function is called by the engine.

class Extractor:
    def __init__(self) -> None:
        ...
    def fetch(self, core) -> None:
        ...

fetch() gains access to all eye-tracking data in real-time via the core pointer.

Click here for more information on extractors.

Open-loop example

As an example, we'll here design a simple open-loop experiment where the brightness of a PC monitor is linked to the phase of the sine wave function. We create anew python-file, say "test_ex.py", and in it define the sine wave frequency and phase using the instantiator:

class Experiment:
    def __init__(self) -> None:
        self.frequency = ...
        self.phase = 0

Then, by using fetch(), we shift the phase of the sine wave function at every time-step, and use this to control the brightness of a cv-render.

    ...
    def fetch(self, engine) -> None:
        self.phase += self.frequency
        sine = numpy.sin(self.phase) * .5 + .5
        brightness = numpy.ones((height, width), dtype=float) * sine
        cv2.imshow("Experiment", brightness)

To add our test extractor to EyeLoop, we'll need to define an extractors_add array:

extractors_add = [Experiment()]

Finally, we test the experiment by running command:

eyeloop --extractors path/to/test_ex.py

See Examples for demo recordings and experimental designs.

For extensive test data, see EyeLoop Playground

Data

EyeLoop produces a json-datalog for each eye-tracking session. The datalog's first column is the timestamp. The next columns define the pupil (if tracked):

((center_x, center_y), radius1, radius2, angle)

The next columns define the corneal reflection (if tracked):

((center_x, center_y), radius1, radius2, angle)

The next columns contain any data produced by custom Extractor modules

Graphical user interface

The default graphical user interface in EyeLoop is minimum-gui.

EyeLoop is compatible with custom graphical user interfaces through its modular logic. Click here for instructions on how to build your own.

Running unit tests

Install testing requirements by running in a terminal:

pip install -r requirements_testing.txt

Then run tox: tox

Reports and results will be outputted to /tests/reports

Known issues

  • Respawning/freezing windows when running minimum-gui in Ubuntu.

References

If you use any of this code or data, please cite [Arvin et al. 2021] (article).

@ARTICLE{Arvin2021-tg,
  title    = "{EyeLoop}: An open-source system for high-speed, closed-loop
              eye-tracking",
  author   = "Arvin, Simon and Rasmussen, Rune and Yonehara, Keisuke",
  journal  = "Front. Cell. Neurosci.",
  volume   =  15,
  pages    = "494",
  year     =  2021
}

License

This project is licensed under the GNU General Public License v3.0. Note that the software is provided "as is", without warranty of any kind, express or implied.

Authors

Lead Developer: Simon Arvin, [email protected]

Researchers:

Corresponding Author: Keisuke Yonehera, [email protected]


         

    

eyeloop's People

Contributors

cfculhane avatar kinow avatar sebalfa avatar simonarvin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eyeloop's Issues

General Handling of exceptions and callbacks to end GUI

Wasn't quite sure how/where to articulate this, but during my implementation of unit testing and logging I've come across the following issue, which I think I have resolved, its just a bit of a tangle.

It was previously mentioned that there was a non-zero exit code, which was then resolved by adding sys.exit(0).

It appears this was due to the way it was exiting when running out of frames, which was done via Importer.route_frame() raising an error, which was then handled further up with a broad except clause.

I have resolved this by calling the Importer.release() method when there are no remaining frames, as below:

        _, image = self.capture.read()
        if image is not None:
            image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
            self.proceed(image)
        else:
            logger.info("No more frames to process, exiting.")
            self.release()

Now that there is logging implemented, this approach is going to be cleaner rather than having exceptions bubbling up for things that aren't really exceptions - running out of frames appears to be an intended call to end processing. This method also allows later on a config variable to be passed in to optionally disable this behaviour if needed. @simonarvin Let me know if this approach works for you :)

Blink threshold is hardcoded

Currently the blink threshold is hardcoded inside the engine.Engine class, ideally this should be a param passed in so an external user can adjust it. Alternatively, a method could be written to take in an expected number of blinks, and adjust the blink threshold to match the expected number (so you could run through a small sample of video on the same subject to attain the threshold, then set that threshold to process the rest of the dataset)

`SystemError: new style getargs format but argument is not a tuple` in processor.py

I'm getting this error: SystemError: new style getargs format but argument is not a tuple from this line due to the list instead of the tuple from this line according to this stackoverflow answer.

Here is the full Traceback:

Traceback (most recent call last):
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\Scripts\eyeloop.exe\__main__.py", line 7, in <module>
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\site-packages\eyeloop\run_eyeloop.py", line 110, in main
    EyeLoop(sys.argv[1:], logger=None)
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\site-packages\eyeloop\run_eyeloop.py", line 43, in __init__
    self.run()
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\site-packages\eyeloop\run_eyeloop.py", line 94, in run
    self.run_importer()
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\site-packages\eyeloop\run_eyeloop.py", line 101, in run_importer
    config.importer.route()
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\site-packages\eyeloop\importers\cv.py", line 68, in route
    self.first_frame()
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\site-packages\eyeloop\importers\cv.py", line 65, in first_frame
    self.arm(width, height, image)
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\site-packages\eyeloop\importers\importer.py", line 45, in arm
    config.engine.arm(width, height, image)
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\site-packages\eyeloop\engine\engine.py", line 85, in arm
    self.iterate(image)
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\site-packages\eyeloop\engine\engine.py", line 183, in track
    self.pupil_processor.track(img)
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\site-packages\eyeloop\engine\processor.py", line 112, in track_
    self.thresh() #either pupil or cr
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\site-packages\eyeloop\engine\processor.py", line 79, in pupil_thresh
    self.source[:] = cv2.threshold(cv2.GaussianBlur(cv2.erode(self.source, kernel, iterations = 1), self.blur, 0), self.binarythreshold, 255, cv2.THRESH_BINARY_INV)[1]
SystemError: new style getargs format but argument is not a tuple
    Processing 0 frames per second.

Move code under a common folders/packages folder

Hi,

I'm trying to understand the code base, but the code appears to be spread in multiple folders/packages. eyeloop.py appears to be taking care to load files correctly, but it would probably be simpler to use the same structure most projects use. Maybe something like

  • /
    • /eyeloop
      • /eyeloop/constants/
      • ...
    • /setup.py
    • /README.md

That would make it easier to package it as a module too.

Thanks

Integration tests

From #13 (comment) (issue closed)

It might be worth writing some basic pytest integration tests to test some of the major branches of the code, not sure how you would do a stream from a webcam but the basic one you're using for the travis build check would be a good candidate to start with. We could then expand them as we go, building a nice set of tests to run before we make any pull requests. Happy to do this, just a bit snowed under with uni and work at the moment, but will get a chance on the weekend.

Use the logging module for errors

A bit tricky to find out what went wrong where. I had some output in the console that I couldn't tell if it was normal logs, or errors.

It was a print(e) where e is an Exception. It would be helpful either being able to control what's displayed, or at least having the traceback in the console output. The logging module could be useful here, though there are probably many other ways to fix it.

Closed-loop example doesn't work

Hi

Great tool, we are trying to use your tool at our lab and had a couple of questions.

  1. The closed-loop example is unclear how to follow. For example, where are the commands to be run? I tried running them in a jupyter notebook and they work after fixing the path of the imports. But this command

python eyeloop.py

presumably has to be run from the command line? But how are the CAL values to be passed downstream to another method?

  1. Also, there is no file "eyeloop.py" that I could find.

Is there a complete example python file that is available somewhere?

Thanks so much for this tool.
Cat

GUI closes when pressing 1, or 2...

Hi,

Found it via reddit. I read a lot of ebooks, comics, etc, on my laptop. And when I am on my extra-lazy mode, I feel bothered when I have to uncross my arms to move to the next page. So I have always been thinking how hard it would be to track my eyes and move the pages automatically for me.

There might be some existing plugin for these e-readers, but I wanted to build my own, and eyeloop appears to have some of what I need, at least in the engine part.

Alas I couldn't get it to work after quickly reading the docs and some of the code, although it's almost bed time here 🛏️

I found the tooltip window (it was hidden on my second monitor, almost out of sight, only its toolbar showing) and then pressed 2, and the GUI closed with an error (I think) message. Tried clicking on another tab, then pressing W, D, E, etc, nothing. The other tab had 1 to press. Tried that, it closed again with

module 'cv2.cv2' has no attribute 'TrackerMedianFlow_create'
Try again: Hover and click on the pupil, then press 1.
'Shape' object has no attribute 'source'
Importer released.

So just wondering; do I have to create an experiment to get it working? I thought I would be able to first see the engine in action. Even though I want to learn how the engine works, I may try some experiments too, e.g. could be something like reading something I know is really boring, or one of the books I procrastinate to read, and compare with some interesting book. Or read in different languages, and see if there's any difference.

Though being just a programmer I may be thinking how to use eyeloop in a wrong way :-)

Thanks again for sharing. Found it on reddit and got interested after I saw the OP replying some interesting comments there 👍 Well done!

Bruno

Hardware recommendations

Hi, do you have recommended camera hardware, or a list of options. Your readme says >1000Hz on non-specialised hardware, but most standard camera do not approach this frame rate, so I assume you mean the processing rate if a camera could feed in images fast enough. openEyeTrack use a Genie Nano M640 NIR and IR illuminator that can go up to 800fps, I assume this could be used?

How does your system handle calibration (for human and/or non-human primate subjects)?

seamless near-to-far eye-tracking

Eye-tracking both at a distance, and in close-ups

EyeLoop's current eye-tracking algorithm works well in close-up footage. However, some users might want to use EyeLoop at a distance. Thus, we should consider implementing eye-tracking that works at a distance as well. Perhaps, it is best to implement a dedicated algorithm for distant eye-tracking. Then, we could fall back on distant eye-tracking whenever the close-up algorithm fails. Making this fall-back seamless is a priority, and should preferably be bidirectional (ie switching both from near to distant, and distant to near).

Instead of rewriting this code, we could consider integrating Antoine Lame's open-source repository: https://github.com/antoinelame/GazeTracking

Best,
Simon

SystemError: new style getargs format but argument is not a tuple (#39)

Having the same issue as #39 - receiving a SystemError in regards to Line 79 of processor.py. I attempted a fix by changing self.blur = [3, 3] to be a tuple, to no avail. I found some talk on StackExchange referencing changing the type of the value inside the tuple, but that also did not work.

I will also say this is occurring from a totally fresh install of EyeLoop.
My dependencies are:
eyeloop: 0.35
numpy: 1.19.5
opencv-contrib-python: 4.4.0.46
pip: 23.3
pymba: 0.3.7
PyYAML: 6.0.1
setuptools: 68.0.0
wheel: 0.41.2

These are the only packages have installed in my (also fresh) Anaconda virtual environment, which is dedicated for EyeLoop testing.
Though the error seems to be the same as in #39, my particular traceback is below:

2023-10-18 00:07:56,428 - eyeloop.run_eyeloop - INFO - Initiating tracking via Importer: cv
    Processing 0 frames per second.
Traceback (most recent call last):
  File "C:\Users\USER1\anaconda3\envs\EL3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\USER1\anaconda3\envs\EL3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\USER1\anaconda3\envs\EL3\Scripts\eyeloop.exe\__main__.py", line 7, in <module>
  File "C:\Users\USER1\anaconda3\envs\EL3\lib\site-packages\eyeloop\run_eyeloop.py", line 110, in main
    EyeLoop(sys.argv[1:], logger=None)
  File "C:\Users\USER1\anaconda3\envs\EL3\lib\site-packages\eyeloop\run_eyeloop.py", line 43, in __init__
    self.run()
  File "C:\Users\USER1\anaconda3\envs\EL3\lib\site-packages\eyeloop\run_eyeloop.py", line 94, in run
    self.run_importer()
  File "C:\Users\USER1\anaconda3\envs\EL3\lib\site-packages\eyeloop\run_eyeloop.py", line 101, in run_importer
    config.importer.route()
  File "C:\Users\USER1\anaconda3\envs\EL3\lib\site-packages\eyeloop\importers\cv.py", line 68, in route
    self.first_frame()
  File "C:\Users\USER1\anaconda3\envs\EL3\lib\site-packages\eyeloop\importers\cv.py", line 65, in first_frame
    self.arm(width, height, image)
  File "C:\Users\USER1\anaconda3\envs\EL3\lib\site-packages\eyeloop\importers\importer.py", line 45, in arm
    config.engine.arm(width, height, image)
  File "C:\Users\USER1\anaconda3\envs\EL3\lib\site-packages\eyeloop\engine\engine.py", line 85, in arm
    self.iterate(image)
  File "C:\Users\USER1\anaconda3\envs\EL3\lib\site-packages\eyeloop\engine\engine.py", line 183, in track
    self.pupil_processor.track(img)
  File "C:\Users\USER1\anaconda3\envs\EL3\lib\site-packages\eyeloop\engine\processor.py", line 112, in track_
    self.thresh() #either pupil or cr
  File "C:\Users\USER1\anaconda3\envs\EL3\lib\site-packages\eyeloop\engine\processor.py", line 79, in pupil_thresh
    self.source[:] = cv2.threshold(cv2.GaussianBlur(cv2.erode(self.source, kernel, iterations = 1), self.blur, 0), self.binarythreshold, 255, cv2.THRESH_BINARY_INV)[1]
SystemError: new style getargs format but argument is not a tuple
    Processing 0 frames per second.

Error when trying to start eyeloop

Hi, I just wanted to test eyeloop. I cloned the repository and then in a new conda environment ran 'pip install .' When I then run "eyeloop" I get a " No module named 'eyeloop.run_eyeloop' " error. Similarly, when I run python eyeloop\run_eyeloop.py, i get: No module named 'eyeloop.config' . It seems like something is off with the paths, but I can't figure out what. Can you help?

improve blink detection

Background

EyeLoop detects blinking by monitoring changes in the monochromatic spectrum (= changes in the mean brightness of the frame).

It turns out that blinks produce very distinct patterns in the mean value when viewed over time, which can be used to detect blinking. How to threshold this pattern depends on the species monitored (eg human, mice) and the general properties of the image (eg contrasts). Thus, we have to normalise this function to improve detection across species and footage types.

Get started

check_blink() is found in /eyeloop/engine/engine.py. For human and mice test footage, click here.

Best,
Simon

How can I get the circle with my vedio?

Hi ,thanks for the fantastatic work ,I do need the module to get the pupil circle and the point of IR illumination ,but I have no idea how to make it work like showed .Could you please help me?

image

Eyetracking of videos

Hi,

I want to use eyeloop to track the pupil of an eye of a mouse.
I managed to install eyeloop and can run it using the command line.
The gui appears and the video is shown as well as the binarized image and another one that is black.
image

After the video is processed there is no pupil detection info available in the datalog.json file.
I read now that I have to add the pupil using the key 1 in the gui.
I get the following error:
image

Can you help me with this?

Cheers

Marc

Error while running plot_loop.py

I'm encountering an error when I try to run plot_loop.py in the open_loop example. Initially, I got this error. I temporarily solved it by hardcoding self.animal = "mouse" in the Loop_parser constructor. However, after that, I faced another error. I'm not sure how to fix this.

P.S. I used the open-loop-log.json file.

P.P.S Is there any documentation regarding the keys in the JSON log file and what they represent?

add torsion algorithm

Torsional vector algorithm

-1Asset 25-8
Fig

Several neuro-ocular pathologies produce torsional eye movement patterns, such as torsional nystagmus and midbrain lesions. Here's a suggestion to compute the torsional vector of the eye (see Fig):

A - B: detect pupil.
C: Expand pupil fit model (via scalar x radii).
D: Extract iris nuances using regular pupil model (B) subtracted from the expanded model (C).

One way to calculate the torsional vector using the iridal nuances is to extract the mean brightness of iridal subsegments segmented radially by increments of x degrees, where x is the size of each segment. The pattern of brightness across subsegments reveals phase shifting of the 'wavy' appearance of the iris, ie torsion is quantised.

Best,
Simon

Oflfine tracking limited to 15-16FPS, any way to improve it?

Hi
We are starting to use your tracker, and are finding that 15-16FPS is the fastest that it processes our videos (acquired at 30-90Fps). Here's an image of running eyeloop for a previously recorded .avi.

https://drive.google.com/file/d/1UrOGWEx92dEnImPnksNqxVUA9gKDin0N/view?usp=sharing

We were thinking about digging into your algorithms to speed them up, but I assume you guys know better than us how to do this.

Any advice for this?

For closed loop (online) tracking this would generally not be enough.

Thanks so much,
catubc

install issue

Hi, I just wanted to test eyeloop. I cloned the repository and then in a new conda environment ran 'pip install .' When I then run "eyeloop" I get a " No module named 'eyeloop.run_eyeloop' " error. Similarly, when I run python eyeloop\run_eyeloop.py, i get: No module named 'eyeloop.config' . It seems like something is off with the paths, but I can't figure out what. Can you help?

Install error - importer vimba

Hello!

I'm currently trying to setup eyeloop and I keep getting an error when I try to switch the importer to vimba. I used Python 3.7 for installation, I think there might be some compatibility issue going on.

I tried running one of the sample videos for analysis offline and that seems to work, which makes me think the problem is vimba related.

This is the error that comes up when I try to run eyeloop --importer vimba:

Outputting data to C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\data\trial_20231204-094307
Writing log to C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\data\trial_20231204-094307
[ WARN:[email protected]] global loadsave.cpp:248 cv::findDecoder imread_('C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\eyeloop\guis\minimum/graphics/.png'): can't open/read file: check file path/integrity
2023-12-04 09:43:07,830 - eyeloop.engine.engine - INFO - loading extractors: [<eyeloop.extractors.frametimer.FPS_extractor object at 0x0000022707D79C08>, <eyeloop.extractors.DAQ.DAQ_extractor object at 0x0000022707D79F08>]
2023-12-04 09:43:07,830 - eyeloop.run_eyeloop - INFO - Initiating tracking via Importer: vimba
Traceback (most recent call last):
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\Scripts\eyeloop.exe_main
.py", line 7, in
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\eyeloop\run_eyeloop.py", line 110, in main
EyeLoop(sys.argv[1:], logger=None)
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\eyeloop\run_eyeloop.py", line 43, in init
self.run()
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\eyeloop\run_eyeloop.py", line 94, in run
self.run_importer()
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\eyeloop\run_eyeloop.py", line 99, in run_importer
importer_module = importlib.import_module(f"eyeloop.importers.{config.arguments.importer}")
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in call_with_frames_removed
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\eyeloop\importers\vimba.py", line 3, in
from pymba import Frame
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\pymba_init
.py", line 1, in
from .vimba import Vimba, VimbaException
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\pymba\vimba.py", line 5, in
from .system import System
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\pymba\system.py", line 1, in
from .vimba_object import VimbaObject
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\pymba\vimba_object.py", line 5, in
from .feature import Feature, _FEATURE_DATA_COMMAND
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\pymba\feature.py", line 5, in
from . import vimba_c
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\pymba\vimba_c.py", line 43, in
vimbaC_path = find_win_dll(64)
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\pymba\vimba_c.py", line 33, in find_win_dll
candidate = base % (major, minor, arch)
TypeError: not all arguments converted during string formatting
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\threading.py", line 1177, in run
self.function(*self.args, **self.kwargs)
File "C:\Users\Schmidt Lab\AppData\Local\anaconda3\envs\eyeloop3\lib\site-packages\eyeloop\extractors\frametimer.py", line 21, in get_fps
print(f" Processing {config.importer.frame - self.last_frame} frames per second.")
AttributeError: 'int' object has no attribute 'frame'

Streamlining for multiple videos

Is there a straight forward way to optimize parameters (location of cornea reflection, thresholds for binarizing, etc) for a recording, and then applying these parameters to extract pupil position and diameter for a series of videos without the GUI?

check_blink() threshold crash

Hi
We noticed that for some videos we have that are a bit more messy at the beginning, the standard code crashes on start up. I assume it is setting up some defaults that are not working on the data we have.

Any advice?

Outputting data to /home/cat/data/robin/eye_track_vids/trial_20201111-142930


ValueError Traceback (most recent call last)
in
2 obj = TestIntegration()
3 #obj.pupil_processor.binarythreshold = 100
----> 4 obj.test_integration(TESTDATA_DIR3, '158002R_LR_eyeball_neg')

in test_integration(self, tmpdir, test_video_name)
70 "--output_dir", str(tmpdir)]
71 eyeloop_obj = run_eyeloop.EyeLoop(args=testargs,
---> 72 logger=logger)
73
74 # Ensure output is expected

~/code/eyeloop/eyeloop/run_eyeloop.py in init(self, args, logger)
50 importer_module = importlib.import_module(f"eyeloop.importers.{config.arguments.importer}")
51 config.importer = importer_module.Importer()
---> 52 config.importer.route()
53
54 # exec(import_command, globals())

~/code/eyeloop/eyeloop/importers/cv.py in route(self)
64
65 def route(self) -> None:
---> 66 self.first_frame()
67 while True:
68 if self.route_frame is not None:

~/code/eyeloop/eyeloop/importers/cv.py in first_frame(self)
61 raise ValueError(f"Video path at {self.vid_path} is not a file or directory!")
62
---> 63 self.arm(width, height, image)
64
65 def route(self) -> None:

~/code/eyeloop/eyeloop/importers/importer.py in arm(self, width, height, image)
31
32 # image = self.rotate(image, self.ENGINE.angle)
---> 33 config.engine.arm(width, height, image)
34
35 def rotate(self, image: np.ndarray, angle: int) -> np.ndarray:

~/code/eyeloop/eyeloop/engine/engine.py in arm(self, width, height, image)
120 config.graphical_user_interface.arm(width, height)
121
--> 122 self.update_feed(image)
123
124 self.pupil_processor.binarythreshold = float(np.min(self.source)) * .7

~/code/eyeloop/eyeloop/engine/engine.py in update_feed(self, img)
256 self.pupil_source = img.copy()
257
--> 258 self.iterate()
259
260 def cr_artifacts(self, cr_processor, offsetx: int, offsety: int, pupil_area) -> None:

~/code/eyeloop/eyeloop/engine/engine.py in track(self)
171 cr_log = self.cr_log_stock.copy()
172
--> 173 if self.check_blink() is False:
174 blink = 0
175 try:

~/code/eyeloop/eyeloop/engine/engine.py in check_blink(self, threshold)
141
142 if threshold < 0:
--> 143 raise ValueError(f"check_blink() threshold must be greater than 0! Threshold was {threshold}")
144
145 # print(f"blink delta = {abs(delta)}")

ValueError: check_blink() threshold must be greater than 0! Threshold was -58.0

`AttributeError: 'int' object has no attribute 'frame'` importer.frame in frametimer.py

In the frametimer in this line you are importing the frame from the importer so I'm getting this error while trying to execute eyeloop --importer cv/vimba.

Full Traceback

2022-03-08 02:26:16,555 - eyeloop.engine.engine - INFO - loading extractors: [<eyeloop.extractors.frametimer.FPS_extractor object at 0x00000169EB573910>, <eyeloop.extractors.DAQ.DAQ_extractor object at 0x00000169EB573760>]
2022-03-08 02:26:16,555 - eyeloop.run_eyeloop - INFO - Initiating tracking via Importer: cv/vimba
2022-03-08 02:26:16,555 - eyeloop.run_eyeloop - ERROR - Invalid importer selected
Traceback (most recent call last):
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\site-packages\eyeloop\run_eyeloop.py", line 99, in run_importer
    importer_module = importlib.import_module(f"eyeloop.importers.{config.arguments.importer}")
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'eyeloop.importers.cv/vimba'
Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\threading.py", line 1254, in run
    self.function(*self.args, **self.kwargs)
  File "C:\Users\bhoma\AppData\Local\Programs\Python\Python38\lib\site-packages\eyeloop\extractors\frametimer.py", line 21, in get_fps
    print(f"    Processing {config.importer.frame - self.last_frame} frames per second.")
AttributeError: 'int' object has no attribute 'frame'

Error running run_eyeloop.py

New directory structure looks great!

Just tried running it after syncing, and re-installing dependencies with pip install -r requirements.txt, but got the following error:

Outputting data to /home/kinow/Development/python/workspace/eyeloop/data/trial_20200714-180721
Initiating tracking via cv
Traceback (most recent call last):
  File "eyeloop/run_eyeloop.py", line 53, in <module>
    EyeLoop()
  File "eyeloop/run_eyeloop.py", line 49, in __init__
    config.importer.route()
  File "/home/kinow/Development/python/workspace/eyeloop/eyeloop/importers/cv.py", line 54, in route
    self.first_frame()
  File "/home/kinow/Development/python/workspace/eyeloop/eyeloop/importers/cv.py", line 49, in first_frame
    raise ValueError(f"Video path at {self.vid_path} is not a file or directory!")
ValueError: Video path at /home/kinow/Development/python/workspace/eyeloop/0 is not a file or directory!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.