Skip to content

deeplabcut.create_video_with_all_detections: p has 3 values, leading to error in p.item(); annotated video cannot be created #2755

@thuann2cats

Description

@thuann2cats

Is there an existing issue for this?

  • I have searched the existing issues

Bug description

Hi DLC team,
During the execution of deeplabcut.create_video_with_all_detections, my code ran into errors where the value of p is an array with shape (1,3). In other words, there are 3 probability values for each joint when each joint is instantiated with Joint(). And thus there’s an error when we call p.item() and the annotated frame could not be saved in order to create a new annotated video.

More specifically, the error was: “no data: can only convert an array of size 1 to a Python scalar” error

Why are there three probability values?

These ps would have values such as [0.988, -1, 0.334] or [0.99, -1, 0.5004] for example, and so if I comment out the original line and just take the first value of p and then call .item() on it, then the code works fine at the Joint() instantiation call, and the annotated frame was properly saved into the annotated video clip.

Could you explain the purpose of having 3 probability values when the code executes to p.item()?

Specifically, line 433 in this file: /home/hice1/tnguyen868/scratch/DLC_dnv/lib/python3.10/site-packages/deeplabcut/core/inferenceutils.py

            for xy, p, g in zip(coords, conf, id_):
                # joint = Joint(tuple(xy), p.item(), i, ind, g)
                joint = Joint(tuple(xy), p[0].item(), i, ind, g)
                ind += 1
                yield joint

Operating System

operating system RH9

DeepLabCut version

dlc version DLC 3.0.0 rc 4 PyTorch

DeepLabCut mode

multi animal

Device type

gpu

Steps To Reproduce

No response

Relevant log output

No response

Anything else?

No response

Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions