Coder Social home page Coder Social logo

mouseland / facemap Goto Github PK

View Code? Open in Web Editor NEW
151.0 10.0 57.0 124.17 MB

Framework for predicting neural activity from mouse orofacial movements tracked using a pose estimation model. Package also includes singular value decomposition (SVD) of behavioral videos.

Home Page: https://facemap.readthedocs.io

License: GNU General Public License v3.0

MATLAB 9.64% M 0.01% Python 90.33% Shell 0.02%
neuroscience behavior gui matlab-gui rodents movie pupil python deep-learning pytorch

facemap's People

Contributors

atika-syeda avatar carsen-stringer avatar dependabot[bot] avatar marius10p avatar renee-tung 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

facemap's Issues

Reshape error in Python compute_SVD

Hi,
recently I've been getting a reshape error every time I try to run the Python GUI. It looks like this:
processing videos computed subsampled mean at 17.10s Traceback (most recent call last): File "/Users/Oliver/FaceMap/FaceMap/gui.py", line 521, in process_ROIs self.motSVDs, self.pupils = facemap.run(self.filenames, self) File "/Users/Oliver/FaceMap/FaceMap/facemap.py", line 50, in run U = compute_SVD(video, cumframes, avgmotion, ncomps, sbin, rois) File "/Users/Oliver/FaceMap/FaceMap/facemap.py", line 185, in compute_SVD imbin = np.reshape((Lyb, Lxb, -1)) TypeError: reshape() missing 1 required positional argument: 'newshape' Abort trap: 6
This occurs after pressing 'processing' of 4 motion SVD ROIs, 1 blink ROI, and 1 pupil ROI (sigma 1.8).

EDIT: I should add that this exclusively occurs when selecting motion SVD ROIs. Selecting only a pupil ROI does not cause any problems, but one single motion SVD ROI causes the same problem.

Batch processing not functioning properly

Hello!

Thanks for all your work on this! It's an amazing tool.

I have been having trouble getting batch processing to work. I can save multiple sets of ROIs (which saves multiple _proc.npy and _proc.mat files in my data directory), but they do not appear in a list under the process batch button. When I click the process batch button, Facemap runs only on the most recent movie and set of ROIs. However, it will do so multiple times (the same number of times as there are sets of saved ROIs - i.e. if I create ROIs for file1.avi, file2.avi, and file3.avi, it will process the ROIs for file3.avi three times).

I am using the most recent version of the Facemap using the conda environment on Windows 7 and Windows 10.

Thanks for your help with this!

Best,
Dan

svd computation error w/ higher sbin values

Followed the installation instructions and managed to launch the GUI, but it appeared incomplete complared to Git page. Cloned the repository and launch from there to get a slightly better version:

Image1

The GUI is very buggy and I cannot process the ROIs.

Have checked this on Windows, Mac and Linux and have the same result.

Error when using --movies on the command line

Hello,

I receive an error when using the example in the readme for opening with a movie specified. This can be reproduced with the given example, i.e.,:

python -m facemap --movie '/home/carsen/movie.avi' --savedir '/media/carsen/SSD/'

The error is:

QGridLayoutEngine::addItem: Cell (0, 1) already taken
Traceback (most recent call last):
  File "/opt/miniconda3/envs/facemap/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/opt/miniconda3/envs/facemap/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/miniconda3/envs/facemap/lib/python3.7/site-packages/facemap-0.2.0-py3.7.egg/facemap/__main__.py", line 39, in <module>
    gui.run(moviefile, savedir)
  File "/opt/miniconda3/envs/facemap/lib/python3.7/site-packages/facemap-0.2.0-py3.7.egg/facemap/gui.py", line 1047, in run
    GUI = MainW(moviefile,savedir)
  File "/opt/miniconda3/envs/facemap/lib/python3.7/site-packages/facemap-0.2.0-py3.7.egg/facemap/gui.py", line 174, in __init__
    self.load_movies([[moviefile]])
AttributeError: 'MainW' object has no attribute 'load_movies'

This error occurs both on the latest version 0e8fa78 and on the version from pypi.

Thank you!

UPDATE: Typo in the title, should be "--movie"

Artifacts in the motion output variable

Hello,
When plotting the output data after calculating motSVD and movSVD we noticed that the motion_1 matrix has abnormal peaks in the data exactly every 500 frames. This occurred in both the outputs of a sample movie provided on your github as well as in our own data. It would be greatly appreciated if you could let us know what these peaks represent, and how these artifacts influence the motSVD calculations because they are also present in at least the first dimension of the motSVD.

Sample movie motion_1
motion_1 plot

Our data motion_1
motion_1 ourdata plot

Sample data motSVD (first dimension only)
motSVD sample

Our data motSVD (first dimension only)
motSVD ourdata

problem with install of new tracking version

hi~ I tried to install the new tracking version, but some error came

the code shows up like this, hope you guys know how to deal with~ thank you!

(facemap) C:\Users\25230>pip install git+https://github.com/mouseland/facemap.git
Collecting git+https://github.com/mouseland/facemap.git
Cloning https://github.com/mouseland/facemap.git to c:\users\25230\appdata\local\temp\pip-req-build-e8e_ylbm
Running command git clone --filter=blob:none --quiet https://github.com/mouseland/facemap.git 'C:\Users\25230\AppData\Local\Temp\pip-req-build-e8e_ylbm'
Resolved https://github.com/mouseland/facemap.git to commit 5011e15
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [7 lines of output]
Traceback (most recent call last):
File "", line 36, in
File "", line 34, in
File "C:\Users\25230\AppData\Local\Temp\pip-req-build-e8e_ylbm\setup.py", line 39
include_package_data=True,
^
SyntaxError: invalid syntax
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Spatial Bin

Hi could I please get some clarification on what Sbin is. What is its purpose in calculations? I'm having trouble finding a clear explanation on this github.

Opencv not found when running "python -m facemap"

When I try running python -m facemap I receive the following error.

(facemap) C:\Users\tomva\Desktop\facemap-master>python -m facemap
Traceback (most recent call last):
  File "C:\Users\tomva\Anaconda3\envs\facemap\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\tomva\Anaconda3\envs\facemap\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\tomva\Desktop\facemap-master\facemap\__main__.py", line 3, in <module>
    from facemap import gui,process
  File "C:\Users\tomva\Desktop\facemap-master\facemap\gui.py", line 12, in <module>
    from . import process, roi, utils, io, menus, guiparts, online
  File "C:\Users\tomva\Desktop\facemap-master\facemap\menus.py", line 3, in <module>
    from . import guiparts, io, online
  File "C:\Users\tomva\Desktop\facemap-master\facemap\online.py", line 4, in <module>
    import cv2
ModuleNotFoundError: No module named 'cv2'

However when I run python facemap a more basic GUI loads that allows me to set ROI's and process but doesn't show traces.

Problem with batch processing

Hi Carsen

Thanks so much for creating this for the community to use. It has already been quite helpful for me.

I am currently running into trouble with serial batch processing of my videos. I am able to process the videos individually but when I try to batch process them I get the following error about unsupported movie files:

single camera
['//192.168.1.200/renatalab/JR_MARCIN/JR_0731_noinj/JR_0731_12\pupil_2019-07-31-190346-0000.avi', '//192.168.1.200/renatalab/JR_MARCIN/JR_0731_noinj/JR_0731_12\pupil_2019-07-31-190346-0001.avi', '//192.168.1.200/renatalab/JR_MARCIN/JR_0731_noinj/JR_0731_12\pupil_2019-07-31-190346-0002.avi', '//192.168.1.200/renatalab/JR_MARCIN/JR_0731_noinj/JR_0731_12\pupil_2019-07-31-190346-0003.avi', '//192.168.1.200/renatalab/JR_MARCIN/JR_0731_noinj/JR_0731_12\pupil_2019-07-31-190346-0004.avi']
pyavreaderindexed used - may be slower (try installing pims github version)
ERROR: not a supported movie file
[Errno 13] Permission denied: '/'

If I try to use the "Open Movie Folder" button and open only one movie, I get a different set of errors:

[['//192.168.1.200/renatalab/JR_MARCIN/JR_0731_noinj/JR_0731_12\pupil_2019-07-31-190346-0000.avi']]
pyavreaderindexed used - may be slower (try installing pims github version)
deprecated pixel format used, make sure you did set range correctly
Traceback (most recent call last):
File "C:\Users\renatalab\Anaconda3\envs\facemap\lib\site-packages\facemap\gui.py", line 473, in open_folder
self.load_movies()
File "C:\Users\renatalab\Anaconda3\envs\facemap\lib\site-packages\facemap\gui.py", line 742, in load_movies
self.jump_to_frame()
File "C:\Users\renatalab\Anaconda3\envs\facemap\lib\site-packages\facemap\gui.py", line 833, in jump_to_frame
self.img = self.get_frame(self.cframe)
File "C:\Users\renatalab\Anaconda3\envs\facemap\lib\site-packages\facemap\gui.py", line 850, in get_frame
img.append(np.array(vs[cframe - self.cumframes[ivid]]))
File "C:\Users\renatalab\Anaconda3\envs\facemap\lib\site-packages\slicerator_init_.py", line 188, in getitem
return self._get(indices)
File "C:\Users\renatalab\Anaconda3\envs\facemap\lib\site-packages\pims\base_frames.py", line 148, in getitem
return self.get_frame(key)
File "C:\Users\renatalab\Anaconda3\envs\facemap\lib\site-packages\pims\pyav_reader.py", line 377, in get_frame
result = _to_nd_array(frame)
File "C:\Users\renatalab\Anaconda3\envs\facemap\lib\site-packages\pims\pyav_reader.py", line 29, in _to_nd_array
frame_arr.shape = (frame.height, frame.width, -1)
ValueError: cannot reshape array of size 440832 into shape (328,444,newaxis)

I am using the python gui on Windows 10 and acquire my videos using ptgrey cameras using their software that splits the movies when they reach a certain size.

deprecated pixel format used, make sure you did set range correctly

Hi Carsen,

Thanks so much for sharing all this amazing code!
I am preparing a lab meeting to show all the wonderful things in MouseLand but I am having trouble with FaceMap.
I am opening FaceMap from an anaconda prompt on a Windows machine and I am loading your video from the data analysis course but I get the following error.

(mouseland) C:\Users\chris>python -m facemap
C:/Users/chris/Downloads/mouse_face.mp4
deprecated pixel format used, make sure you did set range correctly_

I installed git and pims and went through all the common issue comments you have up but I cannot fix it. The video still loads and I can select ROIs but when I want to process them the error repeats and it crashes eventually (posted below).

Do you have any idea what is causing the problem?
Thank you so much!
Christina

...
deprecated pixel format used, make sure you did set range correctly
(repeated 197 more times)
deprecated pixel format used, make sure you did set range correctly
Traceback (most recent call last):
File "C:\Users\chris\Anaconda3\envs\mouseland\lib\site-packages\facemap\gui.py", line 946, in process_ROIs
savename = process.run(self.filenames, self, savepath=savepath)
File "C:\Users\chris\Anaconda3\envs\mouseland\lib\site-packages\facemap\process.py", line 496, in run
avgframe, avgmotion = subsampled_mean(video, cumframes, Ly, Lx, sbin)
File "C:\Users\chris\Anaconda3\envs\mouseland\lib\site-packages\facemap\process.py", line 98, in subsampled_mean
get_frames_pims(imall, containers, np.arange(t,t+nt0), cumframes)
File "C:\Users\chris\Anaconda3\envs\mouseland\lib\site-packages\facemap\process.py", line 23, in get_frames_pims
imall[ii] = np.array(video[n][ii][cfr[0]-cumframes[n]:cfr[-1]-cumframes[n]+1])[:,:,:,0].transpose((1,2,0))
File "C:\Users\chris\Anaconda3\envs\mouseland\lib\site-packages\slicerator_init
.py", line 227, in
return (self.get(i) for i in self.indices)
File "C:\Users\chris\Anaconda3\envs\mouseland\lib\site-packages\slicerator_init
.py", line 207, in _get
return self.ancestor[key]
File "C:\Users\chris\Anaconda3\envs\mouseland\lib\site-packages\slicerator_init
.py", line 188, in getitem
return self.get(indices)
File "C:\Users\chris\Anaconda3\envs\mouseland\lib\site-packages\pims\base_frames.py", line 148, in getitem
return self.get_frame(key)
File "C:\Users\chris\Anaconda3\envs\mouseland\lib\site-packages\pims\pyav_reader.py", line 376, in get_frame
raise AssertionError("Seeking failed to obtain the correct frame.")
AssertionError: Seeking failed to obtain the correct frame.

The interface cannot be maximized

Hi! I installed it your way and ran python -m facemap, but the interface can't be maximized. I went to modify the size of the interface and didn't solve it. I'm confused.
image

Thank you.

Corneal Reflection does not work for Pupil ROI

We tried to add corneal reflections to help the program better capture the mouse pupil. While the ROI responded to added corneal reflections, it ignored the corneal reflections after processing the ROIs and did not yield pupil size results as accurate as shown by the ROI before processing. Thank you!

Software for image acquisition

Hi,

Thank you so much for all your great code!
I'm starting to implement facemap and have acquired the cameras from PointGrey that you recommend. However I was wondering why you use BIAS for image acquisition and not FlyCapture2 directly.
Is it to be able to record simultaneously from several cameras at the same time or is there another reason?

Thanks for your help!

ROI context menu not working in GUI

Whenever I try to right click an ROI to delete it the following error comes up. As per the recommended install instructions, I created a conda environment using the environment.yml file supplied.
image

video formating related issues

file to replicate the error can be found on https://drive.google.com/drive/folders/13yguLJ50IOWR06xsxyNTybt6AfC2QOEw?usp=sharing https://drive.google.com/drive/folders/13yguLJ50IOWR06xsxyNTybt6AfC2QOEw?usp=sharing

Thanks a lot for creating this very useful software! I am currently struggling on implementation of the software for a specific set of video which I think is due to formating. Any advice or feedback would be welcome. Currently Facemap works in those video if they are refinished with ffmpeg and compressed see file 1571Comp.mp4 in addition in

projectMasks.m, line 7:
nframes = h.nframes; was replaced by nframes = int64(h.nframes);

WINDOWS7 Matlab2018a
ERROR1
file:
1571#_refinish.mp4
2.4350e+03

Error using PlotFrame (line 16)
No more frames available to read from file.

Error in MovieGUI>folder_Callback (line 215)
PlotFrame(h);

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in MovieGUI (line 42)
gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)MovieGUI('folder_Callback',hObject,eventdata,guidata(hObject))

Error using uiwait (line 81)
Error while evaluating UIControl Callback.

Index exceeds array bounds.

Error in onScreenROI (line 4)
roi0(1) = min(nX,max(1,ROI(1)));

Error in MovieGUI>keepROI_Callback (line 262)
ROI = onScreenROI(ROI, nxS, nyS);

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in MovieGUI (line 42)
gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)MovieGUI('keepROI_Callback',hObject,eventdata,guidata(hObject))

Error while evaluating UIControl Callback.

ERROR2
file: 1571#_refinish.mp4
Error using VideoReader/init (line 601)
Could not read file due to an unexpected error. Reason: Error Creating Source Reader Reason: Unknown error 0xC00D36C4

Error in VideoReader (line 171)
obj.init(fileName);

Error in MovieGUI>folder_Callback (line 157)
h.vr{k,j} = VideoReader(filename{k,j});

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in MovieGUI (line 42)
gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)MovieGUI('folder_Callback',hObject,eventdata,guidata(hObject))

Error while evaluating UIControl Callback.

Index exceeds array bounds.

Error in findMovieFolders (line 18)
namef = cat(1,namef, namef0{k});

Error in MovieGUI>folder_Callback (line 135)
[filename,folders,namef] = findMovieFolders(h,folder_name);

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in MovieGUI (line 42)
gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)MovieGUI('folder_Callback',hObject,eventdata,guidata(hObject))

Error while evaluating UIControl Callback.

ERROR3
video e3v818a-20180814T1133-1134_30fps_refinish.mp4 crashes Matlab

MAC OS Matlab2018a
ERROR4
video e3v818a-20180814T1133-1134_30fps_refinish.mp4 gives the following error
1 / 40 done in 1.51 sec
6 / 40 done in 8.25 sec
11 / 40 done in 15.03 sec
16 / 40 done in 21.86 sec
21 / 40 done in 28.69 sec
26 / 40 done in 35.65 sec
31 / 40 done in 42.64 sec
36 / 40 done in 49.63 sec
Error using subsampledMean (line 68)
No more frames available to read from file.

Error in processROIs (line 9)
h = subsampledMean(h);

Error in MovieGUI>processROIs_Callback (line 429)
h = processROIs(h);

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in MovieGUI (line 42)
gui_mainfcn(gui_State, varargin{:});

Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)MovieGUI('processROIs_Callback',hObject,eventdata,guidata(hObject))

Error while evaluating UIControl Callback.

Movement energy calculation/intuition

Hello,

Thanks for developing this tool! It's made a huge difference for me in my research.

I'd like to compare motion energies from videos collected from different experiments. The POV is very similar between videos but the exact lighting conditions and ROI dimensions may be slightly different. I've been normalizing the movement energy values by z scoring, but this is problematic because the animals move different amounts in different videos. Would you expect the motion energy values to be comparable between videos like these? If not, any advice you could give about normalizing would be appreciated.

Thank you,
Tom Harmon

How can I ensure that the pupil set in the ROI is correct?

Hello, I have been using your software for a project and I was wondering if there was a way to double check or make sure that the pupil is the only part of the ROI that is being measured? Further, how do I establish that the sigma I use is the correct one?

self.gui.bbox to self.bbox

prompt = "No bbox set. Using entire frame view: {} and resize={}".format(self.gui.bbox, resize)

Hi, thanks for the incredible repository.
I think this line should use "self.bbox" instead of "self.gui.bbox".
Making this change solved the error I had when using headless version.

Bugs in latest version

First of all, thank you so much for making this tool available!
I updated to the latest github repository and I think there might be a couple of bugs.

  1. when I save ROI's from multiple (consecutive) files and then hit process batch, the output of the batch process is saved in the current working directory, instead of the video folder. I think this is because in the .proc files that are generated, proc['save_path'] is an empty string. This empty string gets then set as basename.https://github.com/MouseLand/facemap/blob/460bf1b220b3acef32a1224262d3fd17f549e102/facemap/process.py#L355 It is only an issue when batch processing.

  2. In some update in the past, you stopped computing iframes https://github.com/MouseLand/facemap/blob/460bf1b220b3acef32a1224262d3fd17f549e102/facemap/io.py#L208 . This leads to an error here: https://github.com/MouseLand/facemap/blob/460bf1b220b3acef32a1224262d3fd17f549e102/facemap/gui.py#L634

I hardcoded fixes for me, but you might want to look into it.

variance explained by motionSVDs

Hi Carsen,

Thanks for sharing this great tool!, I was wondering which variable within the code (I am using the Matlab version) represents the variance explained by each estimated motionSVD.

Thanks!

Using more than one 'Running' ROI

Hello,

We would like to use multiple Running ROIs, to capture movement in multiple areas of the video.

Whenever we try to use more than one Running ROI, we receive the following:
Error: File "...miniconda3/envs/facemap/lib/python3.7/site-packages/facemap/process.py", line 285, in process_ROIs imr = np.concatenate((rend[k][np.newaxis,:,:],imr), axis=0) IndexError: list index out of range

I noticed that other ROI types (for ex. 'Blink') allows more than one ROI to be drawn. Should we be able to use multiple Running ROIs, as well?

Thank you in advance for your help,
Daniel

FaceMap freezes when batch running

Hi,
I am experiencing an bug when I try to batch run FaceMap from the GUI.
It works on the 1st session but then freezes for the 2nd, with FaceMap trying to load a model....(see picture attached).

thanks for your help!
FaceMap_Freezing

Motion Energy ROI without SVD

Hi Carsen

Thanks for creating this great tool! Our lab is utilizing quite heavily and I have a request that would be very helpful for us.

We usually process the pupil information and the facial motion from our videos, but often do not use the facial motion SVD. The SVD computation seems to take orders of magnitude longer than the facial motion calculation. I was wondering if it would be possible to add an additional ROI that calculates only the facial motion without the SVD. It would be a big help to us in quickly processing our data.

Thanks
Jacob

Unable to open GUI

hi~ I tried to install the new tracking version
the code I ran is there:
conda env create -f environment.yml
pip install git+https://github.com/mouseland/facemap.git

but
ModuleNotFoundError: No module named 'facemap.gui'

file/load option on mac

Hello,
After installing the mac version I am now trying to install the python version. The install was successful however I didn’t see the “file” button in the GUI and couldn’t see how to load a file. I then upgraded facemap and that seemed to work (Successfully installed facemap-0.2.0 pyqtgraph-0.11.0rc0) except when I run python -m facemap again it ends on this error:

File "/Users/ad/Downloads/facemap-main/facemap/gui.py", line 148, in init
self.DLC_scatterplot.sigHovered.connect(self.DLC_points_hovered)
AttributeError: 'ScatterPlotItem' object has no attribute 'sigHovered'

Thank you

Issue with process.py

Hi,

Thanks for developing the facemap! I download from the latest git repo today and have been trying to test it (with the mouse_face.mp4 data) on my computer. However, it seems I have run into several issues in the process.py. Wondering if you could help out? Thank you so much!

-Shuhan


(facemap) C:\facemap-main>python -m facemap
QGridLayoutEngine::addItem: Cell (0, 1) already taken
QGraphicsScene::removeItem: item 0x113844ccf30's scene (0x0) is different from this scene (0x113836e48e0)
QGraphicsScene::removeItem: item 0x113844c9e10's scene (0x0) is different from this scene (0x113836e48e0)
Computing subsampled mean...
Computed subsampled mean at 5.61s
Computing projection for motSVD...
Traceback (most recent call last):
File "C:\facemap-main\facemap\gui.py", line 893, in process_ROIs
savename = process.run(self.filenames, GUIobject=QtGui, parent=self, savepath=savepath)
File "C:\facemap-main\facemap\process.py", line 600, in run
GUIobject=GUIobject, MainWindow=parent)
File "C:\facemap-main\facemap\process.py", line 323, in process_ROIs
pups = self.process_pupil_ROIs(t, nt, img, ivid, rois, pupind, pups)
NameError: name 'self' is not defined

Here I delete the self in the process.py, then I have

(facemap) C:\facemap-main>python -m facemap
QGridLayoutEngine::addItem: Cell (0, 1) already taken
QGraphicsScene::removeItem: item 0x2d5b03c4ba0's scene (0x0) is different from this scene (0x2d5b00fca90)
QGraphicsScene::removeItem: item 0x2d5b023a1a0's scene (0x0) is different from this scene (0x2d5b00fca90)
Computing subsampled mean...
Computed subsampled mean at 5.25s
Computing subsampled SVD...
motSVD True movSVD False
Computed subsampled SVD at 63.12s
Computing projection for motSVD...
Traceback (most recent call last):
File "C:\facemap-main\facemap\gui.py", line 893, in process_ROIs
savename = process.run(self.filenames, GUIobject=QtGui, parent=self, savepath=savepath)
File "C:\facemap-main\facemap\process.py", line 600, in run
GUIobject=GUIobject, MainWindow=parent)
File "C:\facemap-main\facemap\process.py", line 323, in process_ROIs
pups = process_pupil_ROIs(t, nt, img, ivid, rois, pupind, pups)
NameError: name 'nt' is not defined

Here I changed nt to nt1 (since I didn't see nt in the function, not sure if it is what I should change) in the process.py, then I have

(facemap) C:\facemap-main>python -m facemap
QGridLayoutEngine::addItem: Cell (0, 1) already taken
QGraphicsScene::removeItem: item 0x20283a6b840's scene (0x0) is different from this scene (0x202814c4730)
QGraphicsScene::removeItem: item 0x202837d2650's scene (0x0) is different from this scene (0x202814c4730)
Computing subsampled mean...
Computed subsampled mean at 5.24s
Computing subsampled SVD...
motSVD True movSVD False
Computed subsampled SVD at 63.35s
Computing projection for motSVD...
Traceback (most recent call last):
File "C:\facemap-main\facemap\gui.py", line 893, in process_ROIs
savename = process.run(self.filenames, GUIobject=QtGui, parent=self, savepath=savepath)
File "C:\facemap-main\facemap\process.py", line 600, in run
GUIobject=GUIobject, MainWindow=parent)
File "C:\facemap-main\facemap\process.py", line 323, in process_ROIs
pups = process_pupil_ROIs(t, nt1, img, ivid, rois, pupind, pups)
File "C:\facemap-main\facemap\process.py", line 422, in process_pupil_ROIs
rois[p]['pupil_sigma'], pupreflector[k])
NameError: name 'pupreflector' is not defined

Error in Save *.mat file option in python GUI

Error during saving the motion SVD.

Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\facemap\gui.py", line 956, in
process_ROIs
savename = process.run(self.filenames, self, savepath=savepath)
File "C:\ProgramData\Anaconda3\lib\site-packages\facemap\process.py", line 577
, in run
savename = save(proc, savepath)
File "C:\ProgramData\Anaconda3\lib\site-packages\facemap\process.py", line 406
, in save
io.savemat(savenamemat, {'proc': proc})
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\io\matlab\mio.py", line
279, in savemat
MW.put_variables(mdict)
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\io\matlab\mio5.py", lin
e 849, in put_variables
self._matrix_writer.write_top(var, asbytes(name), is_global)
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\io\matlab\mio5.py", lin
e 590, in write_top
self.write(arr)
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\io\matlab\mio5.py", lin
e 619, in write
self.write_struct(narr)
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\io\matlab\mio5.py", lin
e 738, in write_struct
self._write_items(arr)
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\io\matlab\mio5.py", lin
e 755, in _write_items
self.write(el[f])
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\io\matlab\mio5.py", lin
e 611, in write
% (arr, type(arr)))
TypeError: Could not convert None (type <class 'NoneType'>) to array

motion energy as roi type

Hi Carsen,

thanks for setting up this cool GUI ! As we talked in the Data Science course it would be great to also have an ROI type that is able to read out absolute motion energy. In my case it would be for extracting time points when my arm moves into the FOV of the camera.

Cheers,
Isa-Maria

Failed to initialize NumPy on Windows 10

When running python -m facemap I see the following warning:

> python -m facemap ...\mambaforge\envs\facemap\lib\site-packages\torch\_masked\_init_.py:223: UserWarning: Failed to initialize NumPy: module compiled against API version 0xf but this version of numpy is 0xe (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:68.) example_input = torch.tensor([[-3, -2, -1], [0, 1, 2]]) numpy version: 1.21.6 python version: 3.10.4

Subsequently, facemap fails to process videos because of a failure to initialise numpy.

Searching for a fix to this error, I have found generic advice to simply upgrade to the latest version of numpy. This appears to not apply here since we are constrained to numpy < 1.22 by numba.

What are the values in 'Blink' stands for?

To processed 'blink' ROI of a video, I used an ROI of which the size is around 66x66. As a result, I got values around 1e+05. But if I use pupil ROI, the result I got in 'pupil area' is around 4000 plus. The total size of the ROI is around 4000 plus so I wonder how the 1e+05 values was calculated for blink? May I know what the value shown in 'blink' stands for?

By the way, I used the python version.

Thanks!

Output number of frames per video file

Hi,

Is there a way to access the number of frames in each video file (even when processing as "multivideo SVD")?

If not, I believe that it would be an useful feature to add. Right now I have to reopen all the videos to get these values - which I need to organize the dataset back into trials.

Thanks!

tags

Consider tagging releases.
This will make it easier to checkout specific versions from the source code. As it stands, e.g. it is not obvious what commit corresponds to the pip version.

Thanks,
Anwar

cannot save ROIs

When I click on the "save ROIs" button, I get the following error:

File "/usr/local/anaconda3/envs/facemap/lib/python3.7/site-packages/facemap/gui.py", line 640, in save_ROIs
'filenames': self.filenames, 'iframes': self.iframes}
AttributeError: 'MainW' object has no attribute 'iframes'

I am using GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu), with python 3.7.3 and anaconda 3.

Can you help me with this?

Thanks,

Evan

What are the pupil outputs?

Hey, thanks so much for all the work that went into this! This is an incredibly useful tool and our lab appreciates it.

I've dug around the documentation a bit and can't seem to find what some of the outputs are from the proc.npy file are after processing.

Specifically, what are com, axdir, and axlen with respect to pupil? Thanks!

Installation Error on Cluster running Debian 9

Hello Facemappers!

I'm in the process of installing facemap onto a machine in our cluster and am currently running into this error:

ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/jdelahanty/miniconda3/envs/facemap/lib/python3.10/site-packages/scipy/linalg/_matfuncs_sqrtm_triu.cpython-310-x86_64-linux-gnu.so)

This reminds me of/looks quite similar to this issue that I ran into while running Suite2p on our cluster that was solved pretty fast by our IT manager. I'll notify him and see if a similar fix works there. Mostly posting this just in case others run into the same issue on their systems that might not have containerization by default on their systems...

Expired Certificate (GUI in Ananconda)

I have been trying to use facemap GUI in Anaconda virtual environment.

Every time I press "PROCESS'' in the GUI panel, it shows certificate expiry information (an example snapshot is attached below). So I'm wondering do you have any suggestions on this issue.

Screenshot Facemap Error Message.png

Thanks a lot for all your support and patience.

TypeError when selecting corneal reflection ROI

Hi, thanks for creating this incredibly useful software. We successfully installed a previous version but are experiencing some problems with the latest. Could you please orient us towards the fixes to these problems.

We have two issues,

  1. When selecting the ROI for corneal reflection, the following error output can be seen.
(facemap) C:\Users\_____\facemap>python -m facemap
C:\Users\_____\anaconda3\envs\facemap\lib\site-packages\torch\_masked\__init__.py:223: UserWarning: Failed to initialize NumPy: module compiled against API version 0xf but this version of numpy is 0xe (Triggered internally at  ..\torch\csrc\utils\tensor_numpy.cpp:68.)
  example_input = torch.tensor([[-3, -2, -1], [0, 1, 2]])
numpy version: 1.21.6
python version: 3.10.4
Global varaibles set:
N_FACTOR: 4
SIGMA: 3.0
Running Facemap GUI w/ pose tracker
QGridLayoutEngine::addItem: Cell (0, 1) already taken
QGraphicsScene::removeItem: item 0x21036637210's scene (0x0) is different from this scene (0x210363257a0)
QGraphicsScene::removeItem: item 0x21034d9d620's scene (0x0) is different from this scene (0x210363257a0)
Traceback (most recent call last):
  File "C:\Users\______\facemap\facemap\roi.py", line 47, in <lambda>
    self.ROI.sigRegionChangeFinished.connect(lambda: self.position(parent))
  File "C:\Users\______\facemap\facemap\roi.py", line 106, in position
    parent.sl[1].setValue(parent.saturation[self.iROI] * 100 / 255)
TypeError: setValue(self, int): argument 1 has unexpected type 'float'
Traceback (most recent call last):
  File "C:\Users\______\facemap\facemap\roi.py", line 47, in <lambda>
    self.ROI.sigRegionChangeFinished.connect(lambda: self.position(parent))
  File "C:\Users\______\facemap\facemap\roi.py", line 106, in position
    parent.sl[1].setValue(parent.saturation[self.iROI] * 100 / 255)
TypeError: setValue(self, int): argument 1 has unexpected type 'float'
  1. Nothing happens when the process button is clicked. No log output, no results.

Thanks a lot!

Issues getting facemap to run

Hi,

I've been trying to run facemap, but I've run into the same error each time, on multiple computers. Wondering if you could help out? Thank you!

Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\facemap\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec)
File "C:\ProgramData\Anaconda3\envs\facemap\lib\runpy.py", line 85, in run_code exec(code, run_globals)
File "E:\David\Programs\facemap\facemap_main
.py", line 39, in gui.run(moviefile, savedir)
File "E:\David\Programs\facemap\facemap\gui.py", line 1047, in run GUI = MainW(moviefile,savedir)
File "E:\David\Programs\facemap\facemap\gui.py", line 148, in init self.DLC_scatterplot.sigHovered.connect(self.DLC_points_hovered) AttributeError: 'ScatterPlotItem' object has no attribute 'sigHovered'

unregistered movSv and motSv values

movSv and motSv are not updated in the proc file after the SVD computation process - so they are always zero arrays. This happens when the computation is done via the command line without the GUI object in the following way:

import numpy as np
from facemap.process import run

videofiles = [['video.avi']]
proc = np.load('video_proc.avi', allow_pickle=True).item()
output_path = './user/test_folder'
run(videofiles, sbin=proc['sbin'], proc=proc, savepath=output_path, motSVD=proc['motSVD'], movSVD=proc['movSVD'])

Regarding Movtion SVD Computation

Hi, in your Science paper, it is said:
We then compute the spatial projections of the segment onto these components, U_i=M_i*V_i. Each matrix U_i consists of the left singular vectors of M_i, scaled by the singular values and is thus a 200-dimensional summary of the segment M_i, related via an orthogonal projection.

In the README.md, the (pseudo-) code reads:

uMot = [];

for j = 1:nchunks
  M = abs(diff(F,1,2));
  [u,~,~] = svd(M - avgmot);
  uMot = cat(2, uMot, u);
end
[uMot,~,~] = svd(uMot);
uMotMask = normc(uMot(:, 1:500)); % keep 500 components

And also in the function computeSVDmotion.m, line 95-97 reads

            [u s v] = svdecon(imot);
            u       = gather_try(u);
            uMot{z}    = cat(2, uMot{z}, u(:,1:min(200,size(u,2))));

So the latter two cases, the singlar values seem to be discarded. Does this actually not matter, or is this some updated calculation method? I am confused.
Thank you!

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.