Coder Social home page Coder Social logo

fabiocarrara / meye Goto Github PK

View Code? Open in Web Editor NEW
37.0 4.0 9.0 13.14 MB

A deep-learning-based web tool for translational and real-time pupillometry

Home Page: https://www.pupillometry.it

License: GNU General Public License v3.0

Python 10.54% Dockerfile 0.05% HTML 0.53% Jupyter Notebook 85.29% Shell 0.03% MATLAB 3.56%
pupillometry convolutional-neural-networks webapp tensorflowjs python tensorflow2

meye's People

Contributors

fabiocarrara avatar leonardolupori 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

Watchers

 avatar  avatar  avatar  avatar

meye's Issues

Camera source on online version

It would be very useful to choose camera source to online version. I need to select a non built-in camera for processing.

Thank you

keyboard shortcuts not working

On both Firefox and Chrome, nothing happens if I press:
T and Y or ALT+T and ALT+Y

I also tried all possible keyboard shortcut using ALT

Trigger wiki section outdated

In the wiki, the trigger section only shows 2 triggers while in the web app there are 4.
Also keyboard shortcuts are outdated.

Framerate drops during time

framerate seems to drop dramatically during the time. If the live plot is checked showing the entire trace, fps constantly drop to 4 or 5 fps (or even more) in both firefox and chrome. Without a live plot, the effects are milder even though constant.
Screenshot 2021-01-17 at 22 11 24

'Pattern matched multiple keys' error raised when trying to train

Hello! Thank you very much for developing such a helpful tool.

I've been trying to train a network from my labeled frames, but I'm running into an error:

Traceback (most recent call last): File "C:\Users\systemses\downloads\pupillometry\meye-master\train.py", line 161, in <module> main(args) File "C:\Users\systemses\downloads\pupillometry\meye-master\train.py", line 38, in main print(exp) File "C:\Users\systemses\downloads\pupillometry\meye-master\expman\experiment.py", line 162, in __str__ with pd.option_context('display.width', None), pd.option_context('max_columns', None): File "C:\Users\systemses\anaconda3\envs\tensorflow\lib\site-packages\pandas\_config\config.py", line 434, in __enter__ self.undo = [(pat, _get_option(pat, silent=True)) for pat, val in self.ops] File "C:\Users\systemses\anaconda3\envs\tensorflow\lib\site-packages\pandas\_config\config.py", line 434, in <listcomp> self.undo = [(pat, _get_option(pat, silent=True)) for pat, val in self.ops] File "C:\Users\systemses\anaconda3\envs\tensorflow\lib\site-packages\pandas\_config\config.py", line 128, in _get_option key = _get_single_key(pat, silent) File "C:\Users\systemses\anaconda3\envs\tensorflow\lib\site-packages\pandas\_config\config.py", line 116, in _get_single_key raise OptionError("Pattern matched multiple keys") pandas._config.config.OptionError: 'Pattern matched multiple keys'

Oscilloscope time issue

Screenshot 2021-01-14 at 18 22 38

Problems with data visualization. The plot became strange if I press pause and then resume after a while.
One possible solution is to reset the plot every time I push pause and then resume.

I think we can consider pause/resume as different recording sessions. So the old data can be flushed.

oscilloscope time problem

Screenshot 2021-01-14 at 18 22 38

Problems with data visualization. The plot became strange if I press pause and then resume after a while.
One possible solution is to reset the plot every time I push pause and then resume.

I think we can consider pause/resume as different recording sessions. So the old data can be flushed.

Remember the config

I think that a profile mechanism would be advantageous.
Maybe as a cookie or as some (down)loadable file.

Every time I access MEYE, I need to set up everything again; it would be beneficial if this is accomplished by using cookies or in any other way. It would also be more simple to retrieve the acquisition parameters.

RuntimeError: structure and input must have equal rank

Describe the bug
A clear and concise description of what the bug is.

When loading either a color or grayscale video (mp4 (mp4v) or avi (XVID)), I get the following traceback:

Traceback (most recent call last):
  File "/git/meye/predict.py", line 81, in <module>
    main(args)
  File "/git/meye/predict.py", line 53, in main
    (pupil_y, pupil_x), pupil_area = compute_metrics(pupil_map, thr=args.thr, nms=True)
  File "/git/meye/utils.py", line 27, in compute_metrics
    p = nms_on_area(p, s)
  File "/git/meye/utils.py", line 9, in nms_on_area
    labels, num_labels = label(x, structure=s)  # find connected components
  File "/lib/python3.10/site-packages/scipy/ndimage/_measurements.py", line 184, in label
    raise RuntimeError('structure and input must have equal rank')
RuntimeError: structure and input must have equal rank

Also oddly, tqdm shows 1/1. Not sure if that should be number of frames.

To Reproduce

Steps to reproduce the behavior:

  1. I am running python predict.py ~/Downloads/meye-segmentation_i128_s4_c1_f16_g1_a-relu.hdf5 ~/Desktop/output.avi using a video I created and the v1 model file from Github

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS 12.6
  • Browser: n/a (Python)
  • Version: Python 3.10

Additional context
Using meye-2022-01-24.h5 model works.

Adding a print of the shape of x and in nms_on_area(x, s) when using meye-segmentation_i128_s4_c1_f16_g1_a-relu.hdf5:

(128, 128, 2) (3, 3)

as opposed to for meye-2022-01-24.h5:

(128, 128) (3, 3)

Code triggers as 8bit uint

We can bind triggers to 8 buttons [e.g. 1 to 8] and just code multiple button presses as a 8 bit integer.:
00000000 is 0 no button presses
00000001 is 1 button 1 has been pressed
00000010 is 2 button 2 has been pressed
01010101 is 85 button 1,3,5,7 ave been pressed together

This would expand the potential capabilities of trigger acceptance... Do you think it would be feasible?

Things to add to Wiki

Issues

Noted some small issues with use (easily fixed by users) that I think could be noted in the wiki to help users.

  1. If you switch tabs within the same browser in which meye is running, the video continues to play as if it is processing, but data collection halts.

  2. If you select "auto update" for either the graphical display or the data table:

    a) data output is significantly slower (on some sample files an average of less than 10 reads/s with "auto update selected" vs ~40-50 reads/s)

    b) with "auto update" for graphical display and/or data table selected, data output continually slows as processing progresses, resulting in more reads for earlier parts of the recording than later (for example in a ~5 minute video during the first 60s I was getting >10 reads/s, 250-310s in was ~6 reads/s, and the last 60s <5 reads/s) . Could pose downstream issues depending on analysis as data could be weighted towards earlier video segments. Output is much more stable when "auto update" is not selected

Suggestions

Mostly, I think it would be nice just to have this documented in the wiki so that users are aware. I especially did not notice the 2b issue until I had run all of my videos and started analyzing the output.

It may be advisable to disable the "auto update" (Issue 2) considering the fewer reads and decreased stability of output reads, but users should be aware of the issue.

Issue 1 is easily fixed by the user - you cannot switch between tabs in a single window but may open a new browser window (or bring other applications to the front). This allows meye to work in the background uninterrupted so long as it is the "active" tab in that window.

Additional context

I have been running meye on google chrome (Version 91.0.4472.77 and 90.0.4430.93) on an iMac (Catalina 10.15.7), have not tested other browsers to see if these are global or specific to chrome

roiPos error

In the Matlab version of Meye, I tried to replicate Example 3 from example.m but on an image of mine.
When using
ROI = [330,70,130,100];
I get the following error:

Unable to perform assignment because the size of the left side is 130-by-100 and the size of the right
side is 100-by-130.

Error in Meye/predictImage (line 79)
                pupilMask(roiPos(2):roiPos(2)+roiPos(3)-1,...

I think that lines 79 and 80 of Meye.m contain an error with the indices of roiPos and should be changed to:

pupilMask(roiPos(2):roiPos(2)+roiPos(4)-1,...
      roiPos(1):roiPos(1)+roiPos(3)-1) = imresize(rawMask, [roiPos(4), roiPos(3)],"bilinear");

Now it runs but I think there is still something wrong.

A Labeling GUI for pupils

I'm working on a GUI to help people expand the training dataset.
For now, the software is MATLAB based but the idea would be to also compile it (should be easy for windows).

It works to me, but for sure it will have bugs and fixes to work on

It could be nice if a link to it could be added in meye's README

Here's the tool:
https://github.com/LeonardoLupori/pLabeler

[enhancement] Toggle button to invert images

Hey,
The model is having some difficulties predicting the pupil on a small subset of 2P mouse eyes.
I'm collecting images from those movies to improve the training dataset, but in the meantime, I found it to be extremely effective to simply invert the images that I feed to the net with:

import cv2 as cv
invertedFrame = cv.bitwise_not(frame)

It may be useful to add a toggle button to the webapp to invert images in case one is having problems.

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.