mirror of
https://github.com/suitenumerique/meet.git
synced 2026-07-26 11:58:53 +00:00
♻️(frontend) inline model weights to avoid loading them from remote
Inline the model weights instead of fetching them from a Google remote location at runtime. The weights do not update frequently, so inlining removes an external dependency.
This commit is contained in:
@@ -20,6 +20,7 @@ and this project adheres to
|
||||
- ⬆️(mail) update mjml to v5 and @html-to/text-cli
|
||||
- 🚸(frontend) initialize the join input name with the persisted full name
|
||||
- ♻️(frontend) refactor background processors to use the new API
|
||||
- ♻️(frontend) inline model weights to avoid loading them from remote
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+2
-2
@@ -13,6 +13,7 @@ import {
|
||||
} from './TimerWorker'
|
||||
import {
|
||||
BackgroundProcessorInterface,
|
||||
SELFIE_SEGMENTER_MODEL_PATH,
|
||||
type ProcessorConfig,
|
||||
type ProcessorType,
|
||||
} from '.'
|
||||
@@ -158,8 +159,7 @@ export class BackgroundCustomProcessor implements BackgroundProcessorInterface {
|
||||
)
|
||||
this.imageSegmenter = await ImageSegmenter.createFromOptions(vision, {
|
||||
baseOptions: {
|
||||
modelAssetPath:
|
||||
'https://storage.googleapis.com/mediapipe-models/image_segmenter/selfie_segmenter_landscape/float16/latest/selfie_segmenter_landscape.tflite',
|
||||
modelAssetPath: SELFIE_SEGMENTER_MODEL_PATH,
|
||||
delegate: 'CPU', // Use CPU for Firefox.
|
||||
},
|
||||
runningMode: 'VIDEO',
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
TIMEOUT_TICK,
|
||||
timerWorkerScript,
|
||||
} from './TimerWorker'
|
||||
import { ProcessorType } from '.'
|
||||
import { FACE_LANDMARKS_MODEL_PATH, ProcessorType } from '.'
|
||||
|
||||
const PROCESSING_WIDTH = 256 * 3
|
||||
const PROCESSING_HEIGHT = 144 * 3
|
||||
@@ -133,8 +133,7 @@ export class FaceLandmarksProcessor implements TrackProcessor<Track.Kind> {
|
||||
)
|
||||
this.faceLandmarker = await FaceLandmarker.createFromOptions(vision, {
|
||||
baseOptions: {
|
||||
modelAssetPath:
|
||||
'https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task',
|
||||
modelAssetPath: FACE_LANDMARKS_MODEL_PATH,
|
||||
delegate: 'GPU',
|
||||
},
|
||||
runningMode: 'VIDEO',
|
||||
|
||||
+7
@@ -7,6 +7,7 @@ import {
|
||||
type ProcessorConfig,
|
||||
BackgroundProcessorInterface,
|
||||
ProcessorType,
|
||||
SELFIE_SEGMENTER_MODEL_PATH,
|
||||
} from '.'
|
||||
|
||||
export class UnifiedBackgroundTrackProcessor implements BackgroundProcessorInterface {
|
||||
@@ -22,12 +23,18 @@ export class UnifiedBackgroundTrackProcessor implements BackgroundProcessorInter
|
||||
this.processor = BackgroundProcessor({
|
||||
mode: 'virtual-background',
|
||||
imagePath: opts.imagePath,
|
||||
assetPaths: {
|
||||
modelAssetPath: SELFIE_SEGMENTER_MODEL_PATH,
|
||||
},
|
||||
})
|
||||
} else if (opts.type === 'blur') {
|
||||
this.processorType = ProcessorType.BLUR
|
||||
this.processor = BackgroundProcessor({
|
||||
mode: 'background-blur',
|
||||
blurRadius: opts.blurRadius,
|
||||
assetPaths: {
|
||||
modelAssetPath: SELFIE_SEGMENTER_MODEL_PATH,
|
||||
},
|
||||
})
|
||||
} else {
|
||||
throw new Error(
|
||||
|
||||
@@ -4,6 +4,12 @@ import { BackgroundCustomProcessor } from './BackgroundCustomProcessor'
|
||||
import { UnifiedBackgroundTrackProcessor } from './UnifiedBackgroundTrackProcessor'
|
||||
import { FaceLandmarksOptions } from './FaceLandmarksProcessor'
|
||||
|
||||
export const SELFIE_SEGMENTER_MODEL_PATH =
|
||||
'/assets/mediapipe/models/selfie_segmenter_landscape.tflite'
|
||||
|
||||
export const FACE_LANDMARKS_MODEL_PATH =
|
||||
'/assets/mediapipe/models/face_landmarker.task'
|
||||
|
||||
export enum ProcessorType {
|
||||
BLUR = 'blur',
|
||||
VIRTUAL = 'virtual',
|
||||
|
||||
Reference in New Issue
Block a user