Use empty keypoint array for Detection if no keypoints are detected
PiperOrigin-RevId: 534572162
This commit is contained in:
parent
1523cc48a1
commit
e8ee934bf9
|
@ -27,13 +27,14 @@ export declare interface Detection {
|
|||
boundingBox?: BoundingBox;
|
||||
|
||||
/**
|
||||
* Optional list of keypoints associated with the detection. Keypoints
|
||||
* represent interesting points related to the detection. For example, the
|
||||
* keypoints represent the eye, ear and mouth from face detection model. Or
|
||||
* in the template matching detection, e.g. KNIFT, they can represent the
|
||||
* feature points for template matching.
|
||||
* List of keypoints associated with the detection. Keypoints represent
|
||||
* interesting points related to the detection. For example, the keypoints
|
||||
* represent the eye, ear and mouth from face detection model. Or in the
|
||||
* template matching detection, e.g. KNIFT, they can represent the feature
|
||||
* points for template matching. Contains an empty list if no keypoints are
|
||||
* detected.
|
||||
*/
|
||||
keypoints?: NormalizedKeypoint[];
|
||||
keypoints: NormalizedKeypoint[];
|
||||
}
|
||||
|
||||
/** Detection results of a model. */
|
||||
|
|
|
@ -85,7 +85,8 @@ describe('convertFromDetectionProto()', () => {
|
|||
categoryName: '',
|
||||
displayName: '',
|
||||
}],
|
||||
boundingBox: {originX: 0, originY: 0, width: 0, height: 0}
|
||||
boundingBox: {originX: 0, originY: 0, width: 0, height: 0},
|
||||
keypoints: []
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -26,7 +26,7 @@ export function convertFromDetectionProto(source: DetectionProto): Detection {
|
|||
const labels = source.getLabelList();
|
||||
const displayNames = source.getDisplayNameList();
|
||||
|
||||
const detection: Detection = {categories: []};
|
||||
const detection: Detection = {categories: [], keypoints: []};
|
||||
for (let i = 0; i < scores.length; i++) {
|
||||
detection.categories.push({
|
||||
score: scores[i],
|
||||
|
@ -47,7 +47,6 @@ export function convertFromDetectionProto(source: DetectionProto): Detection {
|
|||
}
|
||||
|
||||
if (source.getLocationData()?.getRelativeKeypointsList().length) {
|
||||
detection.keypoints = [];
|
||||
for (const keypoint of
|
||||
source.getLocationData()!.getRelativeKeypointsList()) {
|
||||
detection.keypoints.push({
|
||||
|
|
|
@ -191,7 +191,8 @@ describe('FaceDetector', () => {
|
|||
categoryName: '',
|
||||
displayName: '',
|
||||
}],
|
||||
boundingBox: {originX: 0, originY: 0, width: 0, height: 0}
|
||||
boundingBox: {originX: 0, originY: 0, width: 0, height: 0},
|
||||
keypoints: []
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -210,7 +210,8 @@ describe('ObjectDetector', () => {
|
|||
categoryName: '',
|
||||
displayName: '',
|
||||
}],
|
||||
boundingBox: {originX: 0, originY: 0, width: 0, height: 0}
|
||||
boundingBox: {originX: 0, originY: 0, width: 0, height: 0},
|
||||
keypoints: []
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user