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

error in anipose filter command if turn [filter] parameter for 'True' #127

Open
AthiemoneZero opened this issue Feb 1, 2024 · 5 comments

Comments

@AthiemoneZero
Copy link

AthiemoneZero commented Feb 1, 2024

Hi, I try to leverage Viterbi filter algorithm that was embeded in this package by add some parameters in config.toml file as below:

[filter] enabled = true type = "viterbi" score_threshold = 0.6 medfilt = 17 offset_threshold = 15 spline = true multiprocess = true

but when I typed down filter command in terminal, this issue happended:

Filtering tracked points... C:\Users\Admin\Desktop\CXC\DLC_projects\anipose\TreDet-ske leton\2024-01-13\pose-2d-filtered\867_1_seg1-vid01-camA.h5 0it [00:02, ?it/s] multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "C:\Users\Admin\anaconda3\envs\DLC\lib\multiprocess ing\pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "c:\users\admin\desktop\cxc\dlc_projects\anipose\an ipose-master\anipose\filter_pose.py", line 121, in viterbi _path_wrapper pts_new, scs_new = viterbi_path(pts, scs, max_offset, thres_dist) File "c:\users\admin\desktop\cxc\dlc_projects\anipose\an ipose-master\anipose\filter_pose.py", line 47, in viterbi_ path return __callback(*args, **kwargs) File "C:\Users\Admin\anaconda3\envs\DLC\lib\site-packages\click\decorators.py", line 84, in new_f unc return ctx.invoke(f, obj, *args, **kwargs) File "C:\Users\Admin\anaconda3\envs\DLC\lib\site-packages\click\core.py", line 760, in invoke return __callback(*args, **kwargs) File "c:\users\admin\desktop\cxc\dlc_projects\anipose\anipose-master\anipose\anipose.py", line 14 9, in filter filter_pose_all(config) File "c:\users\admin\desktop\cxc\dlc_projects\anipose\anipose-master\anipose\common.py", line 168 , in fun return process_all(config, process_session, **args) File "c:\users\admin\desktop\cxc\dlc_projects\anipose\anipose-master\anipose\common.py", line 153 , in process_all output[past_folders] = process_session(config, path, **args) File "c:\users\admin\desktop\cxc\dlc_projects\anipose\anipose-master\anipose\filter_pose.py", lin e 387, in process_session points, scores = filter_fun(config, all_points, metadata['bodyparts']) File "c:\users\admin\desktop\cxc\dlc_projects\anipose\anipose-master\anipose\filter_pose.py", lin e 175, in filter_pose_viterbi for jix, pts_new, scs_new in tqdm(results, ncols=70): File "C:\Users\Admin\anaconda3\envs\DLC\lib\site-packages\tqdm\std.py", line 1182, in __iter__ for obj in iterable: File "C:\Users\Admin\anaconda3\envs\DLC\lib\multiprocessing\pool.py", line 873, in next raise value ValueError: data must be finite, check for nan or inf values

@wyclearnpy
Copy link

I encountered the same problem as you, have you solved it?

@AthiemoneZero
Copy link
Author

I encountered the same problem as you, have you solved it?

Hi, I found this problem would disappear when you have a well labeled video set. I guess this might somehow be due to some low-likelihood points causing NA value in pose-2d files. Details about what algorithm here to cause this and if fine-tuning for filter parameters could avoid it are still confusing. Looking forward to better answering

@wyclearnpy
Copy link

Okay, I understand, I'll try again. Thank you for your reply.

@AthiemoneZero
Copy link
Author

AthiemoneZero commented Mar 13, 2024

Okay, I understand, I'll try again. Thank you for your reply.

Hi, I just confirmed my previous assumption,

I found I failed to filter only one .h5 file from all 3 in pose-2d folder. The error looks like this:

(DLC) C:\Users\Admin\Desktop\CXC\DLC_projects\anipose\TreDet-world_coor_pre>anipose filter
Filtering tracked points...
C:\Users\Admin\Desktop\CXC\DLC_projects\anipose\TreDet-world_coor_pre\20231224_setB_validatio
n\pose-2d-filtered\2024-01-02-vid01-camA.h5
3it [00:03,  1.19s/it]
C:\Users\Admin\Desktop\CXC\DLC_projects\anipose\TreDet-world_coor_pre\20231224_setB_validatio
n\pose-2d-filtered\2024-01-02-vid01-camB.h5
1it [00:02,  2.43s/it]
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "C:\Users\Admin\anaconda3\envs\DLC\lib\multiprocessing\pool.py", line 125, in worker  
    result = (True, func(*args, **kwds))
  File "c:\users\admin\desktop\cxc\dlc_projects\anipose\anipose-master\anipose\filter_pose.py
", line 121, in viterbi_path_wrapper
    pts_new, scs_new = viterbi_path(pts, scs, max_offset, thres_dist)
  File "c:\users\admin\desktop\cxc\dlc_projects\anipose\anipose-master\anipose\filter_pose.py
", line 47, in viterbi_path
    points_nans = remove_dups(points, thres=5)
  File "c:\users\admin\desktop\cxc\dlc_projects\anipose\anipose-master\anipose\filter_pose.py
", line 29, in remove_dups
    tree = cKDTree(pts_ix.reshape(-1, 3))
  File "_ckdtree.pyx", line 561, in scipy.spatial._ckdtree.cKDTree.__init__
ValueError: data must be finite, check for nan or inf values
"""

Overall, my filter section looks like below:

[filter]
enabled = true
type = "viterbi" # or "autoencoder"
score_threshold = 0.0 # Score below which labels are determined erroneous
multiprocess = true #
# https://github.com/lambdaloop/anipose/issues/57

And everything works ok. So this error seems come from bad value in raw pose-2d file. I havent evaluated side-effect caused by lower score_threshold but I am working on this. Hope good news!

@caikangjia
Copy link

Okay, I understand, I'll try again. Thank you for your reply.

Hi, I just confirmed my previous assumption,

I found I failed to filter only one .h5 file from all 3 in pose-2d folder. The error looks like this:

(DLC) C:\Users\Admin\Desktop\CXC\DLC_projects\anipose\TreDet-world_coor_pre>anipose filter
Filtering tracked points...
C:\Users\Admin\Desktop\CXC\DLC_projects\anipose\TreDet-world_coor_pre\20231224_setB_validatio
n\pose-2d-filtered\2024-01-02-vid01-camA.h5
3it [00:03,  1.19s/it]
C:\Users\Admin\Desktop\CXC\DLC_projects\anipose\TreDet-world_coor_pre\20231224_setB_validatio
n\pose-2d-filtered\2024-01-02-vid01-camB.h5
1it [00:02,  2.43s/it]
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "C:\Users\Admin\anaconda3\envs\DLC\lib\multiprocessing\pool.py", line 125, in worker  
    result = (True, func(*args, **kwds))
  File "c:\users\admin\desktop\cxc\dlc_projects\anipose\anipose-master\anipose\filter_pose.py
", line 121, in viterbi_path_wrapper
    pts_new, scs_new = viterbi_path(pts, scs, max_offset, thres_dist)
  File "c:\users\admin\desktop\cxc\dlc_projects\anipose\anipose-master\anipose\filter_pose.py
", line 47, in viterbi_path
    points_nans = remove_dups(points, thres=5)
  File "c:\users\admin\desktop\cxc\dlc_projects\anipose\anipose-master\anipose\filter_pose.py
", line 29, in remove_dups
    tree = cKDTree(pts_ix.reshape(-1, 3))
  File "_ckdtree.pyx", line 561, in scipy.spatial._ckdtree.cKDTree.__init__
ValueError: data must be finite, check for nan or inf values
"""

Overall, my filter section looks like below:

[filter]
enabled = true
type = "viterbi" # or "autoencoder"
score_threshold = 0.0 # Score below which labels are determined erroneous
multiprocess = true #
# https://github.com/lambdaloop/anipose/issues/57

And everything works ok. So this error seems come from bad value in raw pose-2d file. I havent evaluated side-effect caused by lower score_threshold but I am working on this. Hope good news!

A quick update on this one: Downgrade the SciPy version to 1.9/1.10 may solve the issue. This "Value Error" only happens with SciPy 1.11 or later versions

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

No branches or pull requests

3 participants