Deeplabcut: specifying parameters for extract_outlier_frames

Created on 2 Jan 2019  ยท  4Comments  ยท  Source: DeepLabCut/DeepLabCut

Your Operating system and DeepLabCut version

Windows 10, DLC 2.0

Describe the problem

After successfully training a model, analyzing a video, I would like to extract outlier frames as there are mislabeled frames by examining the created labelled video.
When I ran

deeplabcut.extract_outlier_frames(config_path,['video path'])

I got result:
Fitting state-space models with parameters 3 1
100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 3/3 [00:00 Method fitting found 0 putative outlier frames.
Do you want to proceed with extracting 20 of those?

This is weird as there are frames quite off, shown by the plotting result
image

I saw there is a way to specify the parameters for extracting outlier:
extract_outlier_frames(config, videos, shuffle, trainingsetindex, outlieralgorithm, comparisonbodyparts, epsilon, p_bound, ARdegree, MAdegree, alpha, extractionalgorithm, automatic)
However, I'm not familiar with python and the instruction doc does not provide a example code. I was wondering how can I specify the parameters to get some outlier frames extracted.

Thank you!

Best,
Haixin

Most helpful comment

Thanks so much!
I should have googled how to get help function in python.

Yep. Now, I can get the outliers out. Thanks again

On Wed, Jan 2, 2019 at 11:47 AM Mathis Lab notifications@github.com wrote:

If you type deeplabcut.extract_outlier_frames? you will get the full
function description - this is true for all function, i.e. add the ?

โ€”
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/AlexEMG/DeepLabCut/issues/161#issuecomment-450916589,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AsHtklECg4v_nXTwb1omwXqlugnosvIDks5u_OK9gaJpZM4Zm2bH
.

All 4 comments

If you type deeplabcut.extract_outlier_frames? you will get the full function description - this is true for all functions in deeplabcut, i.e. add the ?
please see the user guide: https://www.biorxiv.org/content/biorxiv/early/2018/11/24/476531.full.pdf

image

Thanks so much!
I should have googled how to get help function in python.

Yep. Now, I can get the outliers out. Thanks again

On Wed, Jan 2, 2019 at 11:47 AM Mathis Lab notifications@github.com wrote:

If you type deeplabcut.extract_outlier_frames? you will get the full
function description - this is true for all function, i.e. add the ?

โ€”
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/AlexEMG/DeepLabCut/issues/161#issuecomment-450916589,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AsHtklECg4v_nXTwb1omwXqlugnosvIDks5u_OK9gaJpZM4Zm2bH
.

Here are a few use examples (from the help):

for extracting the frames with default settings

deeplabcut.extract_outlier_frames('/analysis/project/reaching-task/config.yaml',['/analysis/project/video/reachinvideo1.avi'])
--------
for extracting the frames with kmeans
deeplabcut.extract_outlier_frames('/analysis/project/reaching-task/config.yaml',['/analysis/project/video/reachinvideo1.avi'],extractionalgorithm='kmeans')
--------
for extracting the frames with kmeans and epsilon = 5 pixels.
deeplabcut.extract_outlier_frames('/analysis/project/reaching-task/config.yaml',['/analysis/project/video/reachinvideo1.avi'],epsilon = 5,extractionalgorithm='kmeans',outlieralgorithm='jump')

In your case, outlieralgorith=uncertain will be best. See: outlieralgorithm: 'fitting', 'jump', or 'uncertain', optional

String specifying the algorithm used to detect the outliers. Currently, deeplabcut supports three methods. 'Fitting' fits a Auto Regressive Integrated Moving Average model to the data and computes the distance to the estimated data. Larger distances than epsilon are then potentially identified as outliers. The methods 'jump' identifies larger jumps than 'epsilon' in any body part; and 'uncertain' looks for frames with confidence below p_bound. The default is set to "fitting".

Thanks

On Wed, Jan 2, 2019 at 12:05 PM Alexander Mathis notifications@github.com
wrote:

Here are a few use examples (from the help):

for extracting the frames with default settings

>

deeplabcut.extract_outlier_frames('/analysis/project/reaching-task/config.yaml',['/analysis/project/video/reachinvideo1.avi'])

for extracting the frames with kmeans

>

deeplabcut.extract_outlier_frames('/analysis/project/reaching-task/config.yaml',['/analysis/project/video/reachinvideo1.avi'],extractionalgorithm='kmeans')

for extracting the frames with kmeans and epsilon = 5 pixels.

deeplabcut.extract_outlier_frames('/analysis/project/reaching-task/config.yaml',['/analysis/project/video/reachinvideo1.avi'],epsilon
= 5,extractionalgorithm='kmeans',outlieralgorithm='jump')

In your case, outlieralgorith=uncertain will be best. See:
outlieralgorithm: 'fitting', 'jump', or 'uncertain', optional

String specifying the algorithm used to detect the outliers. Currently, deeplabcut supports three methods. 'Fitting' fits a Auto Regressive Integrated Moving Average model to the data and computes the distance to the estimated data. Larger distances than epsilon are then potentially identified as outliers. The methods 'jump' identifies larger jumps than 'epsilon' in any body part; and 'uncertain' looks for frames with confidence below p_bound. The default is set to ``fitting``.

โ€”
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/AlexEMG/DeepLabCut/issues/161#issuecomment-450921926,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AsHtkmNrm1Ci9vCpzKvHoi47_2rzcH6Vks5u_ObZgaJpZM4Zm2bH
.

Was this page helpful?
0 / 5 - 0 ratings