77
88
99class InputStructure (MLMBaseModel ):
10- shape : List [Union [int , float ]] = Field (min_items = 1 )
11- dim_order : List [str ] = Field (min_items = 1 )
10+ shape : List [Union [int , float ]] = Field (min_length = 1 )
11+ dim_order : List [str ] = Field (min_length = 1 )
1212 data_type : DataType
1313
1414 @model_validator (mode = "after" )
@@ -18,27 +18,56 @@ def validate_dimensions(self) -> Self:
1818 return self
1919
2020
21- class MLMStatistic (MLMBaseModel ): # FIXME: add 'Statistics' dep from raster extension (cases required to be triggered)
22- minimum : Annotated [Optional [Number ], OmitIfNone ] = None
23- maximum : Annotated [Optional [Number ], OmitIfNone ] = None
24- mean : Annotated [Optional [Number ], OmitIfNone ] = None
25- stddev : Annotated [Optional [Number ], OmitIfNone ] = None
26- count : Annotated [Optional [int ], OmitIfNone ] = None
27- valid_percent : Annotated [Optional [Number ], OmitIfNone ] = None
21+ class ScalingClipMin (MLMBaseModel ):
22+ type : Literal ["clip-min" ] = "clip-min"
23+ minimum : Number
2824
2925
30- NormalizeType : TypeAlias = Optional [
31- Literal [
32- "min-max" ,
33- "z-score" ,
34- "l1" ,
35- "l2" ,
36- "l2sqr" ,
37- "hamming" ,
38- "hamming2" ,
39- "type-mask" ,
40- "relative" ,
41- "inf" ,
26+ class ScalingClipMax (MLMBaseModel ):
27+ type : Literal ["clip-max" ] = "clip-max"
28+ maximum : Number
29+
30+
31+ class ScalingClip (ScalingClipMin , ScalingClipMax ):
32+ type : Literal ["clip" ] = "clip"
33+
34+
35+ class ScalingMinMax (MLMBaseModel ):
36+ type : Literal ["min-max" ] = "min-max"
37+ minimum : Number
38+ maximum : Number
39+
40+
41+ class ScalingZScore (MLMBaseModel ):
42+ type : Literal ["z-score" ] = "z-score"
43+ mean : Number
44+ stddev : Number
45+
46+
47+ class ScalingOffset (MLMBaseModel ):
48+ type : Literal ["offset" ] = "offset"
49+ value : Number
50+
51+
52+ class ScalingScale (MLMBaseModel ):
53+ type : Literal ["scale" ] = "scale"
54+ value : Number
55+
56+
57+ class ScalingProcessingExpression (ProcessingExpression ):
58+ type : Literal ["processing" ] = "processing"
59+
60+
61+ ScalingObject : TypeAlias = Optional [
62+ Union [
63+ ScalingMinMax ,
64+ ScalingZScore ,
65+ ScalingClip ,
66+ ScalingClipMin ,
67+ ScalingClipMax ,
68+ ScalingOffset ,
69+ ScalingScale ,
70+ ScalingProcessingExpression ,
4271 ]
4372]
4473
@@ -107,9 +136,6 @@ class ModelInput(MLMBaseModel):
107136 ],
108137 )
109138 input : InputStructure
110- norm_by_channel : Annotated [Optional [bool ], OmitIfNone ] = None
111- norm_type : Annotated [Optional [NormalizeType ], OmitIfNone ] = None
112- norm_clip : Annotated [Optional [List [Union [float , int ]]], OmitIfNone ] = None
139+ scaling : Annotated [Optional [List [ScalingObject ]], OmitIfNone ] = None
113140 resize_type : Annotated [Optional [ResizeType ], OmitIfNone ] = None
114- statistics : Annotated [Optional [List [MLMStatistic ]], OmitIfNone ] = None
115141 pre_processing_function : Optional [ProcessingExpression ] = None
0 commit comments