@@ -12,10 +12,7 @@ import { RnExecutorchErrorCode } from '../../errors/ErrorCodes';
1212import { RnExecutorchError } from '../../errors/errorUtils' ;
1313import { BaseModule } from '../BaseModule' ;
1414
15- const ModelConfigs : Record <
16- SegmentationModelName ,
17- SegmentationConfig < LabelEnum >
18- > = {
15+ const ModelConfigs = {
1916 'deeplab-v3' : {
2017 labelMap : DeeplabLabel ,
2118 preprocessorConfig : undefined ,
@@ -24,7 +21,10 @@ const ModelConfigs: Record<
2421 labelMap : SelfieSegmentationLabel ,
2522 preprocessorConfig : undefined ,
2623 } ,
27- } as const ;
24+ } as const satisfies Record <
25+ SegmentationModelName ,
26+ SegmentationConfig < LabelEnum >
27+ > ;
2828
2929/** @internal */
3030type ModelConfigsType = typeof ModelConfigs ;
@@ -96,7 +96,10 @@ export class ImageSegmentationModule<
9696 onDownloadProgress : ( progress : number ) => void = ( ) => { }
9797 ) : Promise < ImageSegmentationModule < ModelNameOf < C > > > {
9898 const { modelName, modelSource } = config ;
99- const { labelMap, preprocessorConfig } = ModelConfigs [ modelName ] ;
99+ const { labelMap } = ModelConfigs [ modelName ] ;
100+ const { preprocessorConfig } = ModelConfigs [
101+ modelName
102+ ] as SegmentationConfig < LabelEnum > ;
100103 const normMean = preprocessorConfig ?. normMean ?? [ ] ;
101104 const normStd = preprocessorConfig ?. normStd ?? [ ] ;
102105 const paths = await ResourceFetcher . fetch ( onDownloadProgress , modelSource ) ;
0 commit comments