nets.d.ts 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import { AgeGenderNet } from '../ageGenderNet/AgeGenderNet';
  2. import { AgeAndGenderPrediction } from '../ageGenderNet/types';
  3. import { FaceDetection } from '../classes/FaceDetection';
  4. import { FaceLandmarks5 } from '../classes/FaceLandmarks5';
  5. import { FaceLandmarks68 } from '../classes/FaceLandmarks68';
  6. import { TNetInput } from '../dom';
  7. import { FaceExpressionNet } from '../faceExpressionNet/FaceExpressionNet';
  8. import { FaceExpressions } from '../faceExpressionNet/FaceExpressions';
  9. import { FaceLandmark68Net } from '../faceLandmarkNet/FaceLandmark68Net';
  10. import { FaceLandmark68TinyNet } from '../faceLandmarkNet/FaceLandmark68TinyNet';
  11. import { FaceRecognitionNet } from '../faceRecognitionNet/FaceRecognitionNet';
  12. import { WithFaceLandmarks } from '../factories/WithFaceLandmarks';
  13. import { Mtcnn } from '../mtcnn/Mtcnn';
  14. import { MtcnnOptions } from '../mtcnn/MtcnnOptions';
  15. import { SsdMobilenetv1 } from '../ssdMobilenetv1/SsdMobilenetv1';
  16. import { SsdMobilenetv1Options } from '../ssdMobilenetv1/SsdMobilenetv1Options';
  17. import { TinyFaceDetector } from '../tinyFaceDetector/TinyFaceDetector';
  18. import { TinyFaceDetectorOptions } from '../tinyFaceDetector/TinyFaceDetectorOptions';
  19. import { ITinyYolov2Options, TinyYolov2 } from '../tinyYolov2';
  20. export declare const nets: {
  21. ssdMobilenetv1: SsdMobilenetv1;
  22. tinyFaceDetector: TinyFaceDetector;
  23. tinyYolov2: TinyYolov2;
  24. mtcnn: Mtcnn;
  25. faceLandmark68Net: FaceLandmark68Net;
  26. faceLandmark68TinyNet: FaceLandmark68TinyNet;
  27. faceRecognitionNet: FaceRecognitionNet;
  28. faceExpressionNet: FaceExpressionNet;
  29. ageGenderNet: AgeGenderNet;
  30. };
  31. /**
  32. * Attempts to detect all faces in an image using SSD Mobilenetv1 Network.
  33. *
  34. * @param input The input image.
  35. * @param options (optional, default: see SsdMobilenetv1Options constructor for default parameters).
  36. * @returns Bounding box of each face with score.
  37. */
  38. export declare const ssdMobilenetv1: (input: TNetInput, options: SsdMobilenetv1Options) => Promise<FaceDetection[]>;
  39. /**
  40. * Attempts to detect all faces in an image using the Tiny Face Detector.
  41. *
  42. * @param input The input image.
  43. * @param options (optional, default: see TinyFaceDetectorOptions constructor for default parameters).
  44. * @returns Bounding box of each face with score.
  45. */
  46. export declare const tinyFaceDetector: (input: TNetInput, options: TinyFaceDetectorOptions) => Promise<FaceDetection[]>;
  47. /**
  48. * Attempts to detect all faces in an image using the Tiny Yolov2 Network.
  49. *
  50. * @param input The input image.
  51. * @param options (optional, default: see TinyYolov2Options constructor for default parameters).
  52. * @returns Bounding box of each face with score.
  53. */
  54. export declare const tinyYolov2: (input: TNetInput, options: ITinyYolov2Options) => Promise<FaceDetection[]>;
  55. /**
  56. * Attempts to detect all faces in an image and the 5 point face landmarks
  57. * of each detected face using the MTCNN Network.
  58. *
  59. * @param input The input image.
  60. * @param options (optional, default: see MtcnnOptions constructor for default parameters).
  61. * @returns Bounding box of each face with score and 5 point face landmarks.
  62. */
  63. export declare const mtcnn: (input: TNetInput, options: MtcnnOptions) => Promise<WithFaceLandmarks<{
  64. detection: FaceDetection;
  65. }, FaceLandmarks5>[]>;
  66. /**
  67. * Detects the 68 point face landmark positions of the face shown in an image.
  68. *
  69. * @param inputs The face image extracted from the bounding box of a face. Can
  70. * also be an array of input images, which will be batch processed.
  71. * @returns 68 point face landmarks or array thereof in case of batch input.
  72. */
  73. export declare const detectFaceLandmarks: (input: TNetInput) => Promise<FaceLandmarks68 | FaceLandmarks68[]>;
  74. /**
  75. * Detects the 68 point face landmark positions of the face shown in an image
  76. * using a tinier version of the 68 point face landmark model, which is slightly
  77. * faster at inference, but also slightly less accurate.
  78. *
  79. * @param inputs The face image extracted from the bounding box of a face. Can
  80. * also be an array of input images, which will be batch processed.
  81. * @returns 68 point face landmarks or array thereof in case of batch input.
  82. */
  83. export declare const detectFaceLandmarksTiny: (input: TNetInput) => Promise<FaceLandmarks68 | FaceLandmarks68[]>;
  84. /**
  85. * Computes a 128 entry vector (face descriptor / face embeddings) from the face shown in an image,
  86. * which uniquely represents the features of that persons face. The computed face descriptor can
  87. * be used to measure the similarity between faces, by computing the euclidean distance of two
  88. * face descriptors.
  89. *
  90. * @param inputs The face image extracted from the aligned bounding box of a face. Can
  91. * also be an array of input images, which will be batch processed.
  92. * @returns Face descriptor with 128 entries or array thereof in case of batch input.
  93. */
  94. export declare const computeFaceDescriptor: (input: TNetInput) => Promise<Float32Array | Float32Array[]>;
  95. /**
  96. * Recognizes the facial expressions from a face image.
  97. *
  98. * @param inputs The face image extracted from the bounding box of a face. Can
  99. * also be an array of input images, which will be batch processed.
  100. * @returns Facial expressions with corresponding probabilities or array thereof in case of batch input.
  101. */
  102. export declare const recognizeFaceExpressions: (input: TNetInput) => Promise<FaceExpressions | FaceExpressions[]>;
  103. /**
  104. * Predicts age and gender from a face image.
  105. *
  106. * @param inputs The face image extracted from the bounding box of a face. Can
  107. * also be an array of input images, which will be batch processed.
  108. * @returns Predictions with age, gender and gender probability or array thereof in case of batch input.
  109. */
  110. export declare const predictAgeAndGender: (input: TNetInput) => Promise<AgeAndGenderPrediction | AgeAndGenderPrediction[]>;
  111. export declare const loadSsdMobilenetv1Model: (url: string) => Promise<void>;
  112. export declare const loadTinyFaceDetectorModel: (url: string) => Promise<void>;
  113. export declare const loadMtcnnModel: (url: string) => Promise<void>;
  114. export declare const loadTinyYolov2Model: (url: string) => Promise<void>;
  115. export declare const loadFaceLandmarkModel: (url: string) => Promise<void>;
  116. export declare const loadFaceLandmarkTinyModel: (url: string) => Promise<void>;
  117. export declare const loadFaceRecognitionModel: (url: string) => Promise<void>;
  118. export declare const loadFaceExpressionModel: (url: string) => Promise<void>;
  119. export declare const loadAgeGenderModel: (url: string) => Promise<void>;
  120. export declare const loadFaceDetectionModel: (url: string) => Promise<void>;
  121. export declare const locateFaces: (input: TNetInput, options: SsdMobilenetv1Options) => Promise<FaceDetection[]>;
  122. export declare const detectLandmarks: (input: TNetInput) => Promise<FaceLandmarks68 | FaceLandmarks68[]>;