Visibility flag on Keypoint Detector Object
이전 댓글 표시
Hello everyone,
I was wondering if anyone could help me understanding how to set up the training data for KeyPoint Detector Object (trainHRNETObjectKeypointDetector).
The help says:
"Keypoint locations, defined in spatial coordinates as an N-by-2 or N-by-3 numeric matrix with rows of the form [x y] or [x y v], respectively, where:
- N is the number of keypoint classes.
- x and y specify the spatial coordinates of a keypoint.
- v specifies the visibility of a keypoint."
I was wondering how to setup the visibility flag v .
Is it 1 when the key point is visible and annotated and 0 when it is not. Or same as Yolo 0 = key point out of view and not labelled; 1 = key point present but not visible; 2 = key point visible ?
Thank you very much for your help
답변 (1개)
Vivek Akkala
2025년 9월 18일
0 개 추천
As mentioned in the doc, A value of 1 (true) indicates a valid keypoint and 0 (false) indicates an invalid keypoint.
댓글 수: 7
Marc
2025년 9월 19일
편집: Walter Roberson
2026년 1월 24일
Andreas
2026년 1월 24일
이동: Walter Roberson
2026년 1월 24일
Hey Marc, I hope all is well. For the past week I've also ben trying to make the visibility work and I keep getting errors. Did you end up figuring out how to solve it? Or did you use a different method all together? Thanks!
Vivek Akkala
2026년 1월 27일
Marc, you don’t need to modify the training data to include a visibility flag. Currently, trainHRNetObjectKeypointDetector does not expect a visibility flag, which is why you encounter an error when a keypoint value of 0 is present in the training data. You can train the network directly using the available keypoints without the visibility information. During inference, the network applies a confidence threshold internally. Keypoints with scores below this threshold are discarded, and the remaining keypoints are treated as the visible ones.
Vivek Akkala
2026년 1월 27일
@Andreas, Could you please share more details about the issues you’re currently facing? Specifically, what do you mean by "making the visibility work"?
Andreas
2026년 1월 27일
I want to use HRNet to identify keypoints on aircraft, similar to how it is used in the available example with the spacecraft. However, in my dataset not all images have all keypoints labelled, as I want to have a detector that is trained in a variety of angles. Thus I need a way to handle the fact that in some images some keypoints are not visible.
The "trainHRNetObjectKeypointDetector" documentation states the following:
"Keypoint locations, defined in spatial coordinates as an N-by-2 or N-by-3 numeric matrix with rows of the form [x y] or [x y v], respectively, where:
- N is the number of keypoint classes.
- x and y specify the spatial coordinates of a keypoint.
- v specifies the visibility of a keypoint."
Thus, I assumed that I indeed can include images where not all keypoints are visible, however when I try to have a 7x3 matrix in my case, where visible points are assigned a 1 and not visible points a 0, I get a very similar error to Marc above.
Is this just a case of me defining visibility wrong, or is the documentation wrong and you can't train the detector unless all of your images have all of the keypoints labelled?
Thanks!
Vivek Akkala
2026년 1월 28일
Thanks for the clarification, @Andreas. You can include images where not all keypoints are visible. In such cases, you can assign a very small value (e.g., 1e‑5 or 1e‑4) to the non‑visible keypoints. Ideally, setting them to 0 should work, but it appears that trainHRNetObjectKeypointDetector is not configured to accept zeros. Using a small non‑zero value for missing keypoints should help avoid error mentioned by Marc.
Marc
2026년 2월 1일
카테고리
도움말 센터 및 File Exchange에서 Keypoint Detection에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!