shared-ritm 1.2.120 → 1.2.122

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,12 @@
1
1
  import ApiService from '../settings/ApiService';
2
+ import { Api_Auth_Login, ConfigResponse } from '@/api/types/Api_Auth';
2
3
  declare class AuthService extends ApiService {
3
- login(email: string, password: string): Promise<any>;
4
- loginPhoto(photo: any): Promise<any>;
5
- loginVideo(data: any): Promise<any>;
6
- logout(): Promise<any>;
4
+ login(email: string, password: string): Promise<Api_Auth_Login>;
5
+ loginPhoto(photo: any): Promise<Api_Auth_Login>;
6
+ loginVideo(data: any): Promise<Api_Auth_Login>;
7
+ logout(): Promise<Api_Auth_Login>;
7
8
  userInfo(): Promise<any>;
8
- configs(): Promise<any>;
9
+ configs(): Promise<ConfigResponse>;
9
10
  changePassword(id: string, password: string, password_confirmation: string): Promise<any>;
10
11
  }
11
12
  export default function useAuthService(): AuthService;
@@ -28,9 +28,9 @@ declare class FaceApiHelper {
28
28
  } | null;
29
29
  setStylesForCanvas(canvasContainer: any): void;
30
30
  checkFaceInclusion(frame: any, face: any): boolean;
31
- getFaceDetections(videoRef: any): Promise<faceapi.WithFaceExpressions<faceapi.WithFaceLandmarks<{
31
+ getFaceDetections(videoRef: any, inputSize: number): Promise<never[] | faceapi.WithFaceLandmarks<{
32
32
  detection: faceapi.FaceDetection;
33
- }, faceapi.FaceLandmarks68>>[]>;
33
+ }> | undefined>;
34
34
  getCanvas(videoRef: any): HTMLCanvasElement;
35
35
  getResizedAndDetection(canvas: any, detections: any, ctx: any, videoWidth: number, videoHeight: number): void;
36
36
  getFaceSnapshot(inputImage: any, box: any): Promise<string | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shared-ritm",
3
- "version": "1.2.120",
3
+ "version": "1.2.122",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -8,24 +8,24 @@ import {
8
8
  } from '@/api/types/Api_Auth'
9
9
 
10
10
  class AuthService extends ApiService {
11
- public login(email: string, password: string) {
11
+ public login(email: string, password: string): Promise<Api_Auth_Login> {
12
12
  return this.post<LoginPayload, Api_Auth_Login>(`/login`, {
13
13
  email,
14
14
  password,
15
15
  })
16
16
  }
17
17
 
18
- public loginPhoto(photo: any) {
18
+ public loginPhoto(photo: any): Promise<Api_Auth_Login> {
19
19
  return this.post<any, Api_Auth_Login>(`/login/from_photo`, { photo })
20
20
  }
21
21
 
22
- public loginVideo(data: any) {
22
+ public loginVideo(data: any): Promise<Api_Auth_Login> {
23
23
  return this.post<any, Api_Auth_Login>(`/login/video`, data, {
24
24
  transformRequest: d => d,
25
25
  })
26
26
  }
27
27
 
28
- public logout() {
28
+ public logout(): Promise<Api_Auth_Login> {
29
29
  return this.post<null, Api_Auth_Login>(`/logout`, null)
30
30
  }
31
31
 
@@ -33,7 +33,7 @@ class AuthService extends ApiService {
33
33
  return this.get<any>(`/users/auth`)
34
34
  }
35
35
 
36
- public configs() {
36
+ public configs(): Promise<ConfigResponse> {
37
37
  return this.get<ConfigResponse>(`/configs`)
38
38
  }
39
39
 
@@ -71,12 +71,10 @@ class FaceApiHelper {
71
71
  return faceXmin >= frameXmin && faceXmax <= frameXmax && faceYmin >= frameYmin && faceYmax <= frameYmax
72
72
  }
73
73
 
74
- async getFaceDetections(videoRef: any) {
74
+ async getFaceDetections(videoRef: any, inputSize: number) {
75
75
  if (!videoRef) return []
76
- return faceapi
77
- .detectAllFaces(videoRef, new faceapi.TinyFaceDetectorOptions())
78
- .withFaceLandmarks()
79
- .withFaceExpressions()
76
+ const options = new faceapi.TinyFaceDetectorOptions({ inputSize })
77
+ return faceapi.detectSingleFace(videoRef, options).withFaceLandmarks(true)
80
78
  }
81
79
 
82
80
  getCanvas(videoRef: any) {
@@ -95,7 +93,7 @@ class FaceApiHelper {
95
93
 
96
94
  faceapi.draw.drawDetections(canvas, resized)
97
95
  faceapi.draw.drawFaceLandmarks(canvas, resized)
98
- faceapi.draw.drawFaceExpressions(canvas, resized)
96
+ //faceapi.draw.drawFaceExpressions(canvas, resized)
99
97
  }
100
98
 
101
99
  async getFaceSnapshot(inputImage: any, box: any) {
@@ -116,10 +114,7 @@ class FaceApiHelper {
116
114
  try {
117
115
  await Promise.all([
118
116
  faceapi.nets.tinyFaceDetector.loadFromUri('/models'),
119
- faceapi.nets.faceLandmark68Net.loadFromUri('/models'),
120
- faceapi.nets.faceRecognitionNet.loadFromUri('/models'),
121
- faceapi.nets.faceExpressionNet.loadFromUri('/models'),
122
- //faceapi.nets.ssdMobilenetv1.loadFromUri('/models'),
117
+ faceapi.nets.faceLandmark68TinyNet.loadFromUri('/models'),
123
118
  ])
124
119
  } catch (error) {
125
120
  console.error(error)