simonarvin / eyeloop

EyeLoop is a Python 3-based eye-tracker tailored specifically to dynamic, closed-loop experiments on consumer-grade hardware.
GNU General Public License v3.0
479 stars 68 forks source link

Error running run_eyeloop.py #13

Closed kinow closed 3 years ago

kinow commented 3 years ago

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!
kinow commented 3 years ago

Tried the same command from the README:

python eyeloop/run_eyeloop.py --importer cv/vimba
...
Initiating tracking via cv/vimba
Invalid importer selected.
 invalid syntax (<string>, line 1)
Traceback (most recent call last):
  File "eyeloop/run_eyeloop.py", line 53, in <module>
    EyeLoop()
  File "eyeloop/run_eyeloop.py", line 48, in __init__
    config.importer = Importer()
NameError: name 'Importer' is not defined
simonarvin commented 3 years ago

Hi Bruno

You have to insert a video sequence or plug-in a webcam. Video files are available at repo eyeloop_playground. Then you run command python EyeLoop/run_eyeloop.py -v *path to file*

kinow commented 3 years ago

Hi Simon,

Got it. Found it in the code too. What command should I do for an online test? Yesterday I was able to run python eyeloop.py as in the docs, and it magically displayed my webcam stream in the GUI. I was trying to re-run that command to validate #10

Thanks!

cfculhane commented 3 years ago

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.

kinow commented 3 years ago

I thought about that too @cfculhane , but wasn't sure if there were already some plans or tests somewhere else. That would be really helpful in case another major change is required; and also helpful for external contributors who are not entirely sure they know what they are doing with their code changes (me, for example :smile: )

Maybe we can mock the part of the camera. Or maybe there's some driver of software that can be used to simulate a camera or video stream source.

simonarvin commented 3 years ago

Hi Simon,

Got it. Found it in the code too. What command should I do for an online test? Yesterday I was able to run python eyeloop.py as in the docs, and it magically displayed my webcam stream in the GUI. I was trying to re-run that command to validate #10

Thanks!

Hi @kinow

Hmm, that's odd. I just tested python run_eyeloop.py on Windows 10 and MacOS, both successfully grabbing video frames live from my webcamera.

OpenCV initialises webcameras using an int index (eg cv2.VideoCapture(0)). When running command python run_eyeloop.py, the video path is set to "0" by default. I suspect that a type mismatch, ie int(0) != str("0"), causes this error on your build. I reinforced the str type in commit ffc3bbed9aeb75722aecd2e00c53b9af61851ef0 - let me know how it goes!

Best, Simon

simonarvin commented 3 years ago

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.

Great idea!

kinow commented 3 years ago

I am on a different laptop today. Cloned a fresh copy of eyeloop, create a virtual environment, and ran pip install -e .. Worked like a charm! This is a Windows 10 pro box, with Anaconda Python 3.7 (previous box was a Ubuntu LTS). Closing 👏 thanks!