File tree Expand file tree Collapse file tree 4 files changed +17
-3
lines changed Expand file tree Collapse file tree 4 files changed +17
-3
lines changed Original file line number Diff line number Diff line change
1
+ ## 1.0.5-dev0
2
+
3
+ * feat: parametrize edge config for ` DetrImageProcessor ` with env variables
4
+
1
5
## 1.0.4
2
6
3
7
* feat: use singleton instead of ` global ` to store shared variables
Original file line number Diff line number Diff line change 1
- __version__ = "1.0.4 " # pragma: no cover
1
+ __version__ = "1.0.5-dev0 " # pragma: no cover
Original file line number Diff line number Diff line change @@ -106,5 +106,15 @@ def ELEMENTS_V_PADDING_COEF(self) -> float:
106
106
"""Same as ELEMENTS_H_PADDING_COEF but the vertical extension."""
107
107
return self ._get_float ("ELEMENTS_V_PADDING_COEF" , 0.3 )
108
108
109
+ @property
110
+ def IMG_PROCESSOR_LONGEST_EDGE (self ) -> int :
111
+ """configuration for DetrImageProcessor to scale images"""
112
+ return self ._get_int ("IMG_PROCESSOR_LONGEST_EDGE" , 1333 )
113
+
114
+ @property
115
+ def IMG_PROCESSOR_SHORTEST_EDGE (self ) -> int :
116
+ """configuration for DetrImageProcessor to scale images"""
117
+ return self ._get_int ("IMG_PROCESSOR_SHORTEST_EDGE" , 800 )
118
+
109
119
110
120
inference_config = InferenceConfig ()
Original file line number Diff line number Diff line change @@ -73,8 +73,8 @@ def initialize(
73
73
self .feature_extractor = DetrImageProcessor .from_pretrained (model )
74
74
# value not set in the configuration and needed for newer models
75
75
# https://huggingface.co/microsoft/table-transformer-structure-recognition-v1.1-all/discussions/1
76
- self .feature_extractor .size ["shortest_edge" ] = 800
77
- self .feature_extractor .size ["longest_edge" ] = 1333
76
+ self .feature_extractor .size ["shortest_edge" ] = inference_config . IMG_PROCESSOR_SHORTEST_EDGE
77
+ self .feature_extractor .size ["longest_edge" ] = inference_config . IMG_PROCESSOR_LONGEST_EDGE
78
78
79
79
try :
80
80
logger .info ("Loading the table structure model ..." )
You can’t perform that action at this time.
0 commit comments