2024-03-20 23:53:07 +01:00
|
|
|
import { CLIPConfig, RecognitionConfig } from 'src/dtos/model-config.dto';
|
2023-08-29 09:58:00 -04:00
|
|
|
|
2023-02-25 09:12:03 -05:00
|
|
|
export const IMachineLearningRepository = 'IMachineLearningRepository';
|
|
|
|
|
|
2023-08-29 09:58:00 -04:00
|
|
|
export interface VisionModelInput {
|
2023-06-05 10:40:48 -04:00
|
|
|
imagePath: string;
|
2023-02-25 09:12:03 -05:00
|
|
|
}
|
|
|
|
|
|
2023-08-29 09:58:00 -04:00
|
|
|
export interface TextModelInput {
|
|
|
|
|
text: string;
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-17 13:07:17 -04:00
|
|
|
export interface BoundingBox {
|
|
|
|
|
x1: number;
|
|
|
|
|
y1: number;
|
|
|
|
|
x2: number;
|
|
|
|
|
y2: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface DetectFaceResult {
|
|
|
|
|
imageWidth: number;
|
|
|
|
|
imageHeight: number;
|
|
|
|
|
boundingBox: BoundingBox;
|
|
|
|
|
score: number;
|
|
|
|
|
embedding: number[];
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-29 09:58:00 -04:00
|
|
|
export enum ModelType {
|
|
|
|
|
FACIAL_RECOGNITION = 'facial-recognition',
|
|
|
|
|
CLIP = 'clip',
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export enum CLIPMode {
|
|
|
|
|
VISION = 'vision',
|
|
|
|
|
TEXT = 'text',
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-25 09:12:03 -05:00
|
|
|
export interface IMachineLearningRepository {
|
2023-08-29 09:58:00 -04:00
|
|
|
encodeImage(url: string, input: VisionModelInput, config: CLIPConfig): Promise<number[]>;
|
|
|
|
|
encodeText(url: string, input: TextModelInput, config: CLIPConfig): Promise<number[]>;
|
|
|
|
|
detectFaces(url: string, input: VisionModelInput, config: RecognitionConfig): Promise<DetectFaceResult[]>;
|
2023-02-25 09:12:03 -05:00
|
|
|
}
|