Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing stuff to accomondate the new DF3D API #13

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

sibocw
Copy link
Contributor

@sibocw sibocw commented Oct 30, 2022

I think this addresses probably most of the incompatibilities between df3dpp and the new df3d API.

Exactly what I did / extent of testing: I tried to run Florian's behavior data processing on the data used for the DF3D paper. The DF3D outputs were regenerated in February using the new DF3D API. (I believe --- all output files that begin with df3d_result_*.pkl are generated with the new version, right?) The df3dpp package is also installed with separate (new) nely-df3d and nely-pyba packages. It seems to be working now, at least to me:

image

Can the next user review the changes, and if everything looks good, merge please?

@sibocw sibocw requested a review from gizemozd October 30, 2022 21:55
@sibocw
Copy link
Contributor Author

sibocw commented Oct 30, 2022

Trickiest changes:

  • deepfly.cv_util.triangulate_linear is moved to pyba.util.triangulate, and the arguments changed
  • pyba.Camera.project now strictly accepts a (TxJx3) array. For per-joint, per-frame calibration, just set T=1, J=1.

@sibocw
Copy link
Contributor Author

sibocw commented Oct 30, 2022

Works on all data in the DF3D paper except 180918_MDN_CsCh_Fly3_004_SG1. Probably something to do with too many outliers (?) --- not super important for now.

Traceback (most recent call last):
  File "/home/sibwang/Projects/drosophila-imitation-learning/scripts/preprocessing/gunel2019_df3d_df3dpp.py", line 84, in <module>
    processed_dir / '180918_MDN_CsCh_Fly3_004_SG1/post_processed.pkl'
  File "/home/sibwang/Projects/drosophila-imitation-learning/scripts/preprocessing/gunel2019_df3d_df3dpp.py", line 31, in process_trial
    calculate_3d=True, outlier_correction=True)
  File "/home/sibwang/Projects/df3dPostProcessing/df3dPostProcessing/df3dPostProcessing.py", line 229, in __init__
    outlier_correction=outlier_correction)
  File "/home/sibwang/Projects/df3dPostProcessing/df3dPostProcessing/df3dPostProcessing.py", line 361, in load_data
    data, exp, outlier_correction)
  File "/home/sibwang/Projects/df3dPostProcessing/df3dPostProcessing/df3dPostProcessing.py", line 390, in triangulate_2d
    camNet = correct_outliers(camNet)
  File "/home/sibwang/Projects/df3dPostProcessing/df3dPostProcessing/utils/utils_outliers.py", line 157, in correct_outliers
    camNet = interpolate_remaining_outliers(camNet, outliers)
  File "/home/sibwang/Projects/df3dPostProcessing/df3dPostProcessing/utils/utils_outliers.py", line 90, in interpolate_remaining_outliers
    non_outlier_frames, non_outlier_values, axis=0)
  File "/home/sibwang/anaconda3/envs/flynet1030b/lib/python3.6/site-packages/scipy/interpolate/_cubic.py", line 100, in __init__
    dk = self._find_derivatives(xp, yp)
  File "/home/sibwang/anaconda3/envs/flynet1030b/lib/python3.6/site-packages/scipy/interpolate/_cubic.py", line 173, in _find_derivatives
    dk[0] = PchipInterpolator._edge_case(hk[0], hk[1], mk[0], mk[1])
IndexError: index 0 is out of bounds for axis 0 with size 0

@sibocw
Copy link
Contributor Author

sibocw commented Nov 1, 2022

Copying potential next users: @jasper-tms @jonasfbraun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants