MouseLand/facemap

BUG:IndexError: list index out of range (process_ROIs-savename = process.run)

liwei4932 opened this issue · 12 comments

Version information:

facemap version:1.0.4
platform: win32
python version:3.8.18
torch version:2.1.0+cpu
numpy version:1.24.4

Describe the issue:

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

Computing subsampled mean...
Computed subsampled mean at 10.42s
Computing subsampled SVD...
computed svd chunk 0 / 3, time 5.73sec
computed svd chunk 1 / 3, time 12.10sec
computed svd chunk 2 / 3, time 18.60sec
Computed subsampled SVD at 30.09s
File "C:\Users\ASUS.conda\envs\facemap\lib\site-packages\facemap\gui\gui.py", line 1300, in process_ROIs
savename = process.run(
File "C:\Users\ASUS.conda\envs\facemap\lib\site-packages\facemap\process.py", line 806, in run
U_mov[k].copy(), (ly, lx, U_mov[k].shape[-1])
IndexError: list index out of range

Error message:

No response

when I process mot/movSVD

I have the same issue...

same here

Same here!
Whether i add ROI or not.

the output saves but has no motSVD or movSVD.

facemap version: 1.0.4
platform: linux
python version: 3.8.13
torch version: 1.11.0+cu102
numpy version: 1.24.4

Error:

Error reading frame
Error reading frame
Traceback (most recent call last):
  File "XXX/anaconda3/envs/facemapEnvNew/lib/python3.8/site-packages/facemap/gui/gui.py", line 891, in set_frame_changed
    self.jump_to_frame()
  File "XXX/anaconda3/envs/facemapEnvNew/lib/python3.8/site-packages/facemap/gui/gui.py", line 1092, in jump_to_frame
    self.next_frame()
  File "XXX/anaconda3/envs/facemapEnvNew/lib/python3.8/site-packages/facemap/gui/gui.py", line 1106, in next_frame
    self.imgs[i][:, :, :, 2] = im[i]
IndexError: list index out of range
img load failed, replacing with prev..
Error reading frame
Error reading frame
Error reading frame
Traceback (most recent call last):
  File "XXX/anaconda3/envs/facemapEnvNew/lib/python3.8/site-packages/facemap/gui/gui.py", line 891, in set_frame_changed
    self.jump_to_frame()
  File "XXX/anaconda3/envs/facemapEnvNew/lib/python3.8/site-packages/facemap/gui/gui.py", line 1092, in jump_to_frame
    self.next_frame()
  File "XXX/anaconda3/envs/facemapEnvNew/lib/python3.8/site-packages/facemap/gui/gui.py", line 1106, in next_frame
    self.imgs[i][:, :, :, 2] = im[i]
IndexError: list index out of range
Computed subsampled mean at 2.30s
Computing ROIs and/or motSVD/movSVD
img load failed, replacing with prev..
img load failed, replacing with prev..
img load failed, replacing with prev..
img load failed, replacing with prev..
img load failed, replacing with prev..
img load failed, replacing with prev..

pip list

Package                       Version
----------------------------- ------------
alabaster                     0.7.13
arrow                         1.3.0
astroid                       2.15.8
asttokens                     2.4.1
atomicwrites                  1.4.1
attrs                         23.1.0
autopep8                      1.6.0
Babel                         2.13.1
backcall                      0.2.0
beautifulsoup4                4.12.2
binaryornot                   0.4.4
black                         23.10.1
bleach                        6.1.0
certifi                       2023.7.22
cffi                          1.16.0
chardet                       5.2.0
charset-normalizer            3.3.1
click                         8.1.7
cloudpickle                   3.0.0
comm                          0.1.4
contourpy                     1.1.1
cookiecutter                  2.4.0
cryptography                  41.0.5
cycler                        0.12.1
debugpy                       1.8.0
decorator                     5.1.1
defusedxml                    0.7.1
diff-match-patch              20230430
dill                          0.3.7
docstring-to-markdown         0.13
docutils                      0.20.1
entrypoints                   0.4
executing                     2.0.0
facemap                       1.0.4
fastjsonschema                2.18.1
filelock                      3.12.4
flake8                        6.0.0
fonttools                     4.43.1
fsspec                        2023.10.0
h5py                          3.10.0
idna                          3.4
imagesize                     1.4.1
importlib-metadata            6.8.0
importlib-resources           6.1.0
inflection                    0.5.1
intervaltree                  3.1.0
ipykernel                     6.26.0
ipython                       7.34.0
ipython-genutils              0.2.0
isort                         5.12.0
jaraco.classes                3.3.0
jedi                          0.18.2
jeepney                       0.8.0
jellyfish                     1.0.1
Jinja2                        3.1.2
joblib                        1.3.2
jsonschema                    4.19.1
jsonschema-specifications     2023.7.1
jupyter_client                7.4.9
jupyter_core                  5.4.0
jupyterlab-pygments           0.2.2
keyring                       24.2.0
kiwisolver                    1.4.5
lazy-object-proxy             1.9.0
llvmlite                      0.41.1
markdown-it-py                3.0.0
MarkupSafe                    2.1.3
matplotlib                    3.7.3
matplotlib-inline             0.1.6
mccabe                        0.7.0
mdurl                         0.1.2
mistune                       3.0.2
more-itertools                10.1.0
mpmath                        1.3.0
mypy-extensions               1.0.0
natsort                       8.4.0
nbclient                      0.8.0
nbconvert                     7.9.2
nbformat                      5.9.2
nest-asyncio                  1.5.8
networkx                      3.1
numba                         0.58.1
numpy                         1.24.4
numpydoc                      1.6.0
nvidia-cublas-cu12            12.1.3.1
nvidia-cuda-cupti-cu12        12.1.105
nvidia-cuda-nvrtc-cu12        12.1.105
nvidia-cuda-runtime-cu12      12.1.105
nvidia-cudnn-cu12             8.9.2.26
nvidia-cufft-cu12             11.0.2.54
nvidia-curand-cu12            10.3.2.106
nvidia-cusolver-cu12          11.4.5.107
nvidia-cusparse-cu12          12.1.0.106
nvidia-nccl-cu12              2.18.1
nvidia-nvjitlink-cu12         12.3.52
nvidia-nvtx-cu12              12.1.105
opencv-python-headless        4.8.1.78
packaging                     23.2
pandocfilters                 1.5.0
parso                         0.8.3
pathspec                      0.11.2
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        10.1.0
pip                           23.3.1
pkgutil_resolve_name          1.3.10
platformdirs                  3.11.0
pluggy                        1.3.0
prompt-toolkit                3.0.39
psutil                        5.9.6
ptyprocess                    0.7.0
pure-eval                     0.2.2
pycodestyle                   2.10.0
pycparser                     2.21
pydocstyle                    6.3.0
pyflakes                      3.0.1
Pygments                      2.16.1
pylint                        2.17.7
pylint-venv                   3.0.3
pyls-spyder                   0.4.0
pynndescent                   0.5.10
pyparsing                     3.1.1
PyQt5                         5.15.10
PyQt5-Qt5                     5.15.2
PyQt5-sip                     12.13.0
PyQt6                         6.5.3
PyQt6-Qt6                     6.5.3
PyQt6-sip                     13.6.0
pyqtgraph                     0.13.3
PyQtWebEngine                 5.15.6
PyQtWebEngine-Qt5             5.15.2
python-dateutil               2.8.2
python-lsp-black              1.3.0
python-lsp-jsonrpc            1.1.2
python-lsp-server             1.7.4
python-slugify                8.0.1
pytoolconfig                  1.2.6
pytz                          2023.3.post1
pyxdg                         0.28
PyYAML                        6.0.1
pyzmq                         25.1.1
QDarkStyle                    3.0.3
qstylizer                     0.2.2
QtAwesome                     1.2.3
qtconsole                     5.4.4
QtPy                          2.4.1
referencing                   0.30.2
requests                      2.31.0
rich                          13.6.0
rope                          1.10.0
rpds-py                       0.10.6
Rtree                         1.1.0
scikit-learn                  1.3.2
scipy                         1.10.1
SecretStorage                 3.3.3
setuptools                    68.0.0
six                           1.16.0
snowballstemmer               2.2.0
sortedcontainers              2.4.0
soupsieve                     2.5
Sphinx                        7.1.2
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.1
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
spyder                        5.4.5
spyder-kernels                2.4.4
stack-data                    0.6.3
sympy                         1.12
tabulate                      0.9.0
tbb                           2021.10.0
text-unidecode                1.3
textdistance                  4.6.0
threadpoolctl                 3.2.0
three-merge                   0.1.1
tinycss2                      1.2.1
toml                          0.10.2
tomli                         2.0.1
tomlkit                       0.12.1
torch                         1.11.0
tornado                       6.3.3
tqdm                          4.66.1
traitlets                     5.12.0
triton                        2.1.0
types-python-dateutil         2.8.19.14
typing_extensions             4.8.0
ujson                         5.8.0
umap-learn                    0.5.4
urllib3                       2.0.7
watchdog                      3.0.0
wcwidth                       0.2.8
webencodings                  0.5.1
whatthepatch                  1.0.5
wheel                         0.41.2
wrapt                         1.15.0
wurlitzer                     3.0.3
yapf                          0.40.2
zipp                          3.17.0

okay in my case it was incorrect frame rate reading!

Hi @magdalenasabat could you please try reinstalling facemap and creating a new virtual environment. The output of pip list shows you have pyqt5 and pyqt6 while we're only using pyqt6 so just to eliminate that as the issue.

Hi @liwei4932 @inchinn1 @JohannesCD could you please provide more details so I can try to reproduce the error. It's working fine when I tested with the new version. More details about the video loaded and the steps that lead to the error would be great. If you updated to the new version then I'd suggest creating a new virtual env.

Hi! PyQT5 is part of spyder installation. Everything is working well now. In my case the cv2 was reading in incorrect number of frames. I know that somewhere burried in the metadata my videos have wrong framerate (600), even though cv2 is reading in the correct frame rate (10) the total number of frames seems to be calculated with the wring framerate (exactly 600 times more than there should be). So correcting the property cv2.CAP_PROP_POS_FRAMES fixes the issue and everything works bueno.

Hi! PyQT5 is part of spyder installation. Everything is working well now. In my case the cv2 was reading in incorrect number of frames. I know that somewhere burried in the metadata my videos have wrong framerate (600), even though cv2 is reading in the correct frame rate (10) the total number of frames seems to be calculated with the wring framerate (exactly 600 times more than there should be). So correcting the property cv2.CAP_PROP_POS_FRAMES fixes the issue and everything works bueno.

I have the same issue. What do you mean by cv2. Is this the object in the metadata?

Hi @Atika-Syeda, thanks for looking into this. The error seems independent of the particular video that I try to process. I tried some of mine but the same error also comes up when using 'mouse_face.mp4' from the list of provided example videos (https://drive.google.com/drive/folders/1cRWCDl8jxWToz50dCX1Op-dHcAC-ttto). All I have done was to load the video into the GUI and click 'process' with 'motSVD', 'Save *.mat' and 'multivideo' checked.

facemap version: 1.0.4
platform: win32
python version: 3.8.18
torch version: 2.1.0+cpu
numpy version: 1.24.4

** Using CPU version. **
TORCH CUDA version not installed/working. Using CPU version.
QPixmap::scaled: Pixmap is a null pixmap
QPixmap::scaled: Pixmap is a null pixmap
QPixmap::scaled: Pixmap is a null pixmap
QPixmap::scaled: Pixmap is a null pixmap
Computing subsampled mean...
Computed subsampled mean at 1.82s
Computing subsampled SVD...
computed svd chunk 0 / 1, time 1.32sec
Computed subsampled SVD at 3.69s
Traceback (most recent call last):
File "C:\Users\jd.conda\envs\facemap\lib\site-packages\facemap\gui\gui.py", line 1300, in process_ROIs
savename = process.run(
File "C:\Users\jd.conda\envs\facemap\lib\site-packages\facemap\process.py", line 794, in run
U_mov_reshape[0], LYbin, LXbin, sybin, sxbin, Lybin, Lxbin, iinds
IndexError: list index out of range
QGraphicsScene::removeItem: item 0x2adb9dcd3c0's scene (0x0) is different from this scene (0x2ad8e847ae0)
Computing subsampled mean...
Computed subsampled mean at 3.66s
Computing subsampled SVD...
computed svd chunk 0 / 5, time 2.17sec
computed svd chunk 1 / 5, time 4.71sec
computed svd chunk 2 / 5, time 7.30sec
computed svd chunk 3 / 5, time 9.88sec
computed svd chunk 4 / 5, time 12.67sec
Computed subsampled SVD at 17.32s
Traceback (most recent call last):
File "C:\Users\jd.conda\envs\facemap\lib\site-packages\facemap\gui\gui.py", line 1300, in process_ROIs
savename = process.run(
File "C:\Users\jd.conda\envs\facemap\lib\site-packages\facemap\process.py", line 794, in run
U_mov_reshape[0], LYbin, LXbin, sybin, sxbin, Lybin, Lxbin, iinds
IndexError: list index out of range

Hi @JohannesCD thanks for testing it. We've found the bug and it should be fixed in the new release (v1.0.6). Could you please install the latest pip version (v1.0.6) and let us know if the issue still persists.