Skip to content

ValueError: Shape of passed values is... when extracting outlier frames #3246

@mikeumo

Description

@mikeumo

Is there an existing issue for this?

  • I have searched the existing issues

Operating System

MacOS Tahoe

DeepLabCut version

3.0.0rc13

What engine are you using?

pytorch

DeepLabCut mode

multi animal

Device type

M2 Max

Bug description 🐛

I am using multi-animal, with 18 shared body parts (2 animals) and 4 unique parts.

After analyzing a video, I run "extract outlier frames" with "fitting" option (tracking method: ellipse. model used: resnet50_gn).

Afer warnings:
/Users/mike/.conda/envs/dlc3/lib/python3.12/site-packages/statsmodels/tsa/statespace/sarimax.py:966: UserWarning: Non-stationary starting autoregressive parameters found. Using zeros as starting parameters.
warn('Non-stationary starting autoregressive parameters'
/Users/mike/.conda/envs/dlc3/lib/python3.12/site-packages/statsmodels/tsa/statespace/sarimax.py:978: UserWarning: Non-invertible starting MA parameters found. Using zeros as starting parameters.
warn('Non-invertible starting MA parameters found.'

and multiple warnings:

/Users/mike/.conda/envs/dlc3/lib/python3.12/site-packages/statsmodels/base/model.py:607: ConvergenceWarning: Maximum Likelihood optimization failed to converge. Check mle_retvals
warnings.warn("Maximum Likelihood optimization failed to "

I get this error:

Traceback (most recent call last):
File "/Users/mike/.conda/envs/dlc3/lib/python3.12/site-packages/deeplabcut/gui/tabs/extract_outlier_frames.py", line 153, in extract_outlier_frames
deeplabcut.extract_outlier_frames(
File "/Users/mike/.conda/envs/dlc3/lib/python3.12/site-packages/deeplabcut/refine_training_dataset/outlier_frames.py", line 429, in extract_outlier_frames
d, o = compute_deviations(
^^^^^^^^^^^^^^^^^^^
File "/Users/mike/.conda/envs/dlc3/lib/python3.12/site-packages/deeplabcut/refine_training_dataset/outlier_frames.py", line 633, in compute_deviations
data = pd.DataFrame(np.concatenate(preds, axis=1), columns=pdindex)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mike/.local/lib/python3.12/site-packages/pandas/core/frame.py", line 827, in init
mgr = ndarray_to_mgr(
^^^^^^^^^^^^^^^
File "/Users/mike/.local/lib/python3.12/site-packages/pandas/core/internals/construction.py", line 336, in ndarray_to_mgr
_check_values_indices_shape_match(values, index, columns)
File "/Users/mike/.local/lib/python3.12/site-packages/pandas/core/internals/construction.py", line 420, in _check_values_indices_shape_match
raise ValueError(f"Shape of passed values is {passed}, indices imply {implied}")
ValueError: Shape of passed values is (37802, 320), indices imply (37802, 528)
INFO:console:Fitting state-space models with parameters:
INFO:console:
INFO:console:3
INFO:console:
INFO:console:1

I searched the issues on the DLC page and it seems that the problem stems from the mismatch between the number of parts/animals declared in config.yaml and the number of parts/animals detected in a video after analyzing it (and saved in .csv/pickle file).

here is the first lines from my .csv file:

BugResource.csv

Here, the two rats are not present it the beginning of the video and the unique parts are not present for the entire video (in this case). So, the model picks up random points with low probability, or no points at all.

So, the question is, is this setup: mismatch between declared and detected body parts, indeed the reason for failure to fit ARIMA/SARIMAX?

If yes, could this be fixed? This is probably a very common case of missing body part detection data for part or whole video.

regards,

Mikhail.

Steps To Reproduce

Not sure

Relevant log output

See above

Anything else?

No response

Code of Conduct

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions