lambdaloop / anipose

🐜🐀🐒🚶 A toolkit for robust markerless 3D pose estimation
http://anipose.org
BSD 2-Clause "Simplified" License
357 stars 67 forks source link

error during calibration #9

Closed hanhanhan-kim closed 4 years ago

hanhanhan-kim commented 4 years ago

Hello, I've been having an issue running the anipose calibrate command. I am using a Conda environment that can run DeepLabCut, on Ubuntu 18.04. When trying to run anipose calibrate I get the following error:

(dlc-anipose) hank-x299@hank-x299:~/src/dlc-utils/examples/beetlepose$ anipose calibrate
Calibrating...
/home/hank-x299/src/dlc-utils/examples/beetlepose/test_1_no_motor
Traceback (most recent call last):
  File "/home/hank-x299/anaconda3/envs/dlc-anipose/bin/anipose", line 11, in <module>
    load_entry_point('anipose', 'console_scripts', 'anipose')()
  File "/home/hank-x299/anaconda3/envs/dlc-anipose/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/hank-x299/anaconda3/envs/dlc-anipose/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/hank-x299/anaconda3/envs/dlc-anipose/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/hank-x299/anaconda3/envs/dlc-anipose/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/hank-x299/anaconda3/envs/dlc-anipose/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/hank-x299/anaconda3/envs/dlc-anipose/lib/python3.6/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/hank-x299/anaconda3/envs/dlc-anipose/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/hank-x299/src/anipose/anipose/anipose.py", line 115, in calibrate
    calibrate_all(config)
  File "/home/hank-x299/src/anipose/anipose/common.py", line 168, in fun
    return process_all(config, process_session, **args)
  File "/home/hank-x299/src/anipose/anipose/common.py", line 153, in process_all
    output[past_folders] = process_session(config, path, **args)
  File "/home/hank-x299/src/anipose/anipose/calibrate.py", line 126, in process_session
    name = get_cam_name(config, vid)
  File "/home/hank-x299/src/anipose/anipose/common.py", line 72, in get_cam_name
    name = match.groups()[0]
IndexError: tuple index out of range

My file structure is as follows:

(dlc-anipose) hank-x299@hank-x299:~/src/dlc-utils/examples/beetlepose$ tree
.
├── config.toml
└── test_1_no_motor
    ├── calibration
    │   ├── dal_liom_guid_18475996_2020_02_06_23_26_17.mp4
    │   ├── dal_liom_guid_18475997_2020_02_06_23_26_18.mp4
    │   ├── dal_liom_guid_19061101_2020_02_06_23_26_20.mp4
    │   ├── dal_liom_guid_19061600_2020_02_06_23_26_22.mp4
    │   └── dal_liom_guid_19061602_2020_02_06_23_26_23.mp4
    └── videos-raw
        ├── dal_liom_guid_18475996_2020_02_06_11_22_17.mp4
        ├── dal_liom_guid_18475997_2020_02_06_11_22_02.mp4
        ├── dal_liom_guid_19061101_2020_02_06_11_21_52.mp4
        ├── dal_liom_guid_19061600_2020_02_06_11_21_40.mp4
        └── dal_liom_guid_19061602_2020_02_06_11_21_26.mp4

My config.toml file looks like so:

project = "beetlepose"
path = "/home/hank-x299/src/dlc-utils/examples/beetlepose"

nesting = 1

video_extension = "mp4"

# regex matches 8-digits proceeding a "_":
[triangulation]
cam_regex = "guid_[0-9]{8}"

[calibration]
# checkerboard / charuco / aruco
board_type = "checkerboard"

# width and height of grid
board_size = [6, 6]

# length of marker side
board_marker_length = 0.3 # mm

# If charuco or checkerboard, square side length
board_square_side_length = 0.3 # mm

animal_calibration = true

Given the above, why might I be getting IndexError: tuple index out of range? Thanks!

hanhanhan-kim commented 4 years ago

Solved: I needed to modify the cam_regex as follows: cam_regex = "guid_([0-9]{8})"

lambdaloop commented 4 years ago

Perfect, thank you for posting this issue and the solution!