修复typescript编译时问题

This commit is contained in:
2025-03-11 11:34:05 +08:00
parent 524dcaecbd
commit 232d480ca0
6 changed files with 79 additions and 50 deletions

View File

@ -7,14 +7,18 @@ import { FaceAlignmentResult, FacePoint } from "./common";
export interface PFLDPredictOption extends ImageCropOption { }
class PFLDResult extends FaceAlignmentResult {
protected directionPointIndex(): [number, number] { return [36, 92]; }
protected leftEyePointIndex(): number[] { return [33, 34, 35, 36, 37, 38, 39, 40, 41, 42]; }
protected rightEyePointIndex(): number[] { return [87, 88, 89, 90, 91, 92, 93, 94, 95, 96]; }
protected leftEyebrowPointIndex(): number[] { return [43, 44, 45, 46, 47, 48, 49, 50, 51]; }
protected rightEyebrowPointIndex(): number[] { return [97, 98, 99, 100, 101, 102, 103, 104, 105]; }
protected mouthPointIndex(): number[] { return [52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71]; }
protected nosePointIndex(): number[] { return [72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86]; }
protected contourPointIndex(): number[] { return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]; }
public constructor(points: FacePoint[]) {
super(points, {
directionPointIndex: [36, 92],
leftEyePointIndex: [33, 34, 35, 36, 37, 38, 39, 40, 41, 42],
rightEyePointIndex: [87, 88, 89, 90, 91, 92, 93, 94, 95, 96],
leftEyebrowPointIndex: [43, 44, 45, 46, 47, 48, 49, 50, 51],
rightEyebrowPointIndex: [97, 98, 99, 100, 101, 102, 103, 104, 105],
mouthPointIndex: [52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71],
nosePointIndex: [72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86],
contourPointIndex: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32],
});
}
}
const MODEL_URL_CONFIG = {
@ -59,7 +63,7 @@ export class PFLD extends Model {
const y = pointsBuffer[i + 1] * image.height * ratioHeight;
points.push({ x, y });
}
console.log(points)
return new PFLDResult(points);
}