anipose: Good detections but calibration routine crashes
Hi,
I’m using 5 cameras and the standard charuco board for camera calibration. This results in 100’s of detections per camera and anipose-calibrate
makes it to the point where it saves detections.pickle
. However, during the actual model estimation step, it crashes with the following
Calibrating...
/media/jon/Ephys Data Buffe/mouse_young_b/2020-09-03_mouse-young_b
/media/jon/Ephys Data Buffe/mouse_young_b/2020-09-03_mouse-young_b/calibration/calibration.toml
/media/jon/Ephys Data Buffe/mouse_young_b/2020-09-03_mouse-young_b/calibration/cam-0_2020-09-03T18_15_36.avi
100%|█████████████████████████████| 7043/7043 [02:45<00:00, 42.51it/s]
4676 boards detected
/media/jon/Ephys Data Buffe/mouse_young_b/2020-09-03_mouse-young_b/calibration/cam-1_2020-09-03T18_15_36.avi
100%|█████████████████████████████| 7043/7043 [03:04<00:00, 38.08it/s]
5149 boards detected
/media/jon/Ephys Data Buffe/mouse_young_b/2020-09-03_mouse-young_b/calibration/cam-2_2020-09-03T18_15_36.avi
100%|█████████████████████████████| 7043/7043 [03:12<00:00, 36.55it/s]
5403 boards detected
/media/jon/Ephys Data Buffe/mouse_young_b/2020-09-03_mouse-young_b/calibration/cam-3_2020-09-03T18_15_36.avi
100%|█████████████████████████████| 7043/7043 [03:01<00:00, 38.74it/s]
5122 boards detected
/media/jon/Ephys Data Buffe/mouse_young_b/2020-09-03_mouse-young_b/calibration/cam-4_2020-09-03T18_15_36.avi
100%|█████████████████████████████| 7043/7043 [03:02<00:00, 38.49it/s]
6628 boards detected
defaultdict(<class 'int'>, {('1', '4'): 4900, ('4', '1'): 4900})
Traceback (most recent call last):
File "/home/jon/anaconda3/envs/anipose/bin/anipose", line 8, in <module>
sys.exit(cli())
File "/home/jon/anaconda3/envs/anipose/lib/python3.7/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/jon/anaconda3/envs/anipose/lib/python3.7/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/jon/anaconda3/envs/anipose/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/jon/anaconda3/envs/anipose/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/jon/anaconda3/envs/anipose/lib/python3.7/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/jon/anaconda3/envs/anipose/lib/python3.7/site-packages/click/decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/jon/anaconda3/envs/anipose/lib/python3.7/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/jon/anaconda3/envs/anipose/lib/python3.7/site-packages/anipose/anipose.py", line 314, in run_data
calibrate_all(config)
File "/home/jon/anaconda3/envs/anipose/lib/python3.7/site-packages/anipose/common.py", line 168, in fun
return process_all(config, process_session, **args)
File "/home/jon/anaconda3/envs/anipose/lib/python3.7/site-packages/anipose/common.py", line 153, in process_all
output[past_folders] = process_session(config, path, **args)
File "/home/jon/anaconda3/envs/anipose/lib/python3.7/site-packages/anipose/calibrate.py", line 203, in process_session
verbose=True)
File "/home/jon/anaconda3/envs/anipose/lib/python3.7/site-packages/aniposelib/cameras.py", line 1563, in calibrate_rows
rvecs, tvecs = get_initial_extrinsics(rtvecs)
File "/home/jon/anaconda3/envs/anipose/lib/python3.7/site-packages/aniposelib/utils.py", line 173, in get_initial_extrinsics
pairs = find_calibration_pairs(graph, source=0)
File "/home/jon/anaconda3/envs/anipose/lib/python3.7/site-packages/aniposelib/utils.py", line 156, in find_calibration_pairs
for new in graph[item]:
TypeError: 'NoneType' object is not subscriptable
I’ve attached my detections.pickle
in case there is evidence of what corner case I’ve reached here…
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 28 (4 by maintainers)
Hello everyone! I have been trying to run the tutorial and I have run into this same issue. After running the tutorial as-is, I noticed there were different number of board detections in each video. I then trimmed the video down to the first 1200 frames and there are 1200 board detections in all three calibration videos (per the terminal outputt - see traceback below). I still received the same
NoneType
error. I have pasted the traceback and my conda environment info below. Also, I’ve attached thedetections.pickle
file.traceback
environment
detections.zip
Quick update: I rolled back to
anipose==0.8.1
andaniposelib==0.3.7
and the calibration runs (I haven’t had a chance to evaluate the results)Ye, had the same issue, it makes detections worse. Rolling back 0.8.1 and 0.3.7 + upgrade calligator, for some reason, was the only way I got everything working fine and reproducible.
More narrowing. It seems the issue ultimately stems from this line:
https://github.com/lambdaloop/aniposelib/blob/5eaf84a617545767703517f140037e3c46fa7cdb/aniposelib/utils.py#L123
I’m hitting this condition and the
get_calibration_graph
function returns Nonetype and everything crashes from there. I’m not quite clear what these functions are doing, but my guess is they are finding frames that contain a valid detection in a least a sub-set of cameras for the purpose of co-optimization of calibration parameters. I guess my calibration set might have a case where there is not a single instance where a valid detection occurs during the same frame on some minimal number of cameras?