MouseLand/facemap

BUG: SVD error "IndexError: list index out of range"

phanhuynh opened this issue · 2 comments

Version information:

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

Describe the issue:

Hello, and thank you for this tool!
I'm trying to run multiple motion SVD and I get this error. (sidenote: I tried to click 'save ROIs' button but I don't think any file was produced.) Here's an image of the ROIs:
image
Thank you very much in advance!

Error message:

facemap version:        1.0.6
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.
Loading keypoints: C:/Users/huynh/temp_local/carmen_feb/carmen_feb_FM_v4\csms-01182024-000v2_FacemapPose.h5
QGraphicsScene::removeItem: item 0x1c769aa1ca0's scene (0x0) is different from this scene (0x1c73eaa0300)
Computing subsampled mean...
Computed subsampled mean at 10.04s
Computing subsampled SVD...
computed svd chunk 0 / 12, time  15.99sec
computed svd chunk 1 / 12, time  31.35sec
computed svd chunk 2 / 12, time  47.07sec
computed svd chunk 3 / 12, time  64.15sec
computed svd chunk 4 / 12, time  80.42sec
computed svd chunk 5 / 12, time  95.30sec
computed svd chunk 6 / 12, time  111.09sec
computed svd chunk 7 / 12, time  126.86sec
computed svd chunk 8 / 12, time  143.48sec
computed svd chunk 9 / 12, time  159.00sec
computed svd chunk 10 / 12, time  176.27sec
computed svd chunk 11 / 12, time  192.38sec
Computed subsampled SVD at 213.36s
Computing ROIs and/or motSVD/movSVD
computed video chunk 0 / 25, time  216.86sec
computed video chunk 10 / 25, time  255.44sec
computed video chunk 20 / 25, time  296.76sec
Computed ROIS and/or motSVD/movSVD at 313.91s
run time 314.19s
QGraphicsScene::removeItem: item 0x1c779840f20's scene (0x0) is different from this scene (0x1c73eaa0300)
QGraphicsScene::removeItem: item 0x1c779840f20's scene (0x0) is different from this scene (0x1c73eaa0300)
QGraphicsScene::removeItem: item 0x1c779840f20's scene (0x0) is different from this scene (0x1c73eaa0300)
QGraphicsScene::removeItem: item 0x1c779840f20's scene (0x0) is different from this scene (0x1c73eaa0300)
QGraphicsScene::removeItem: item 0x1c779840f20's scene (0x0) is different from this scene (0x1c73eaa0300)
Loading keypoints: C:/Users/huynh/temp_local/carmen_feb/carmen_feb_FM_v4\csms-01182024-000v2_FacemapPose.h5
QGraphicsScene::removeItem: item 0x1c779840f20's scene (0x0) is different from this scene (0x1c73eaa0300)
Output saved in C:/Users/huynh/temp_local/carmen_feb/carmen_feb_FM_v4
self.frame shape: (585, 966, 3)
self.img shape: <built-in method shape of ImageItem object at 0x000001C704AEACA0>
roi_tuple: ((0, 582), (0, 966))
BBOX after adjustment: [(0, 582, 0, 966)]
RESIZE: True
PADDING: True
cpu set as device
Loading model parameters from: C:\Users\huynh\.facemap\models\facemap_model_params.pth
Setting model name to: facemap_model_state
Loading model state from: C:\Users\huynh\.facemap\models\facemap_model_state.pt
cpu set as device
Loading model parameters from: C:\Users\huynh\.facemap\models\facemap_model_params.pth
Loading model state from: C:\Users\huynh\.facemap\models\facemap_model_state.pt

Processing video: C:/Users/huynh/temp_local/carmen_feb/carmen_feb_FM_v4/csms-01182024-000v2.avi
Using params:
        bbox: (0, 582, 0, 966)
        batch size: 4
        resize: True
        padding: True
Inference speed: 5.170135712086104 fps
Saved keypoints: C:/Users/huynh/temp_local/carmen_feb/carmen_feb_FM_v4\csms-01182024-000v2_FacemapPose.h5
Saved metadata: C:/Users/huynh/temp_local/carmen_feb/carmen_feb_FM_v4\csms-01182024-000v2_FacemapPose_metadata.pkl
Loading keypoints: C:/Users/huynh/temp_local/carmen_feb/carmen_feb_FM_v4\csms-01182024-000v2_FacemapPose.h5
Loading keypoints: C:/Users/huynh/temp_local/carmen_feb/carmen_feb_FM_v4\csms-01182024-000v2_FacemapPose.h5
Traceback (most recent call last):
  File "C:\Users\huynh\AppData\Local\anaconda3\envs\facemap\lib\site-packages\facemap\gui\gui.py", line 1300, in process_ROIs
    self.pose_model.plot_pose_estimates()
  File "C:\Users\huynh\AppData\Local\anaconda3\envs\facemap\lib\site-packages\facemap\pose\pose.py", line 525, in plot_pose_estimates
    self.gui.load_keypoints()
  File "C:\Users\huynh\AppData\Local\anaconda3\envs\facemap\lib\site-packages\facemap\gui\gui.py", line 1516, in load_keypoints
    self.pose_x_coord.append(pose_data[bodypart]["x"][:])
AttributeError: 'numpy.ndarray' object has no attribute 'append'
Computing subsampled mean...
Computed subsampled mean at 10.86s
Computing subsampled SVD...
computed svd chunk 0 / 12, time  21.75sec
computed svd chunk 1 / 12, time  43.15sec
computed svd chunk 2 / 12, time  64.93sec
computed svd chunk 3 / 12, time  87.06sec
computed svd chunk 4 / 12, time  108.91sec
computed svd chunk 5 / 12, time  131.16sec
computed svd chunk 6 / 12, time  154.35sec
computed svd chunk 7 / 12, time  175.95sec
computed svd chunk 8 / 12, time  197.85sec
computed svd chunk 9 / 12, time  220.09sec
computed svd chunk 10 / 12, time  242.14sec
computed svd chunk 11 / 12, time  262.38sec
Computed subsampled SVD at 292.31s
Computing ROIs and/or motSVD/movSVD
computed video chunk 0 / 25, time  295.92sec
computed video chunk 10 / 25, time  343.64sec
computed video chunk 20 / 25, time  390.00sec
Computed ROIS and/or motSVD/movSVD at 408.16s
run time 408.45s
QGraphicsScene::removeItem: item 0x1c779952fa0's scene (0x0) is different from this scene (0x1c73eaa0300)
QGraphicsScene::removeItem: item 0x1c779952fa0's scene (0x0) is different from this scene (0x1c73eaa0300)
QGraphicsScene::removeItem: item 0x1c779952fa0's scene (0x0) is different from this scene (0x1c73eaa0300)
QGraphicsScene::removeItem: item 0x1c779952fa0's scene (0x0) is different from this scene (0x1c73eaa0300)
QGraphicsScene::removeItem: item 0x1c779952fa0's scene (0x0) is different from this scene (0x1c73eaa0300)
QGraphicsScene::removeItem: item 0x1c779952fa0's scene (0x0) is different from this scene (0x1c73eaa0300)
Loading keypoints: C:/Users/huynh/temp_local/carmen_feb/carmen_feb_FM_v4\csms-01182024-000v2_FacemapPose.h5
QGraphicsScene::removeItem: item 0x1c779952fa0's scene (0x0) is different from this scene (0x1c73eaa0300)
Traceback (most recent call last):
  File "C:\Users\huynh\AppData\Local\anaconda3\envs\facemap\lib\site-packages\facemap\gui\gui.py", line 1291, in process_ROIs
    io.open_proc(self, file_name=savename)
  File "C:\Users\huynh\AppData\Local\anaconda3\envs\facemap\lib\site-packages\facemap\gui\io.py", line 239, in open_proc
    "%s%d" % (parent.typestr[r["rind"]], kt[r["rind"]])
IndexError: list index out of range

Hi @phanhuynh it seems like you're processing both svd and keypoints. I'd suggest loading your video from a folder where any preprocessed keypoints aren't saved and re-running by only selecting the SVD checkboxes. If you didn't set the output folder then the *_proc.npy file containing ROIs should be saved in the same folder as the video.