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+
15## 1.0.4
26
37* 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:
106106 """Same as ELEMENTS_H_PADDING_COEF but the vertical extension."""
107107 return self ._get_float ("ELEMENTS_V_PADDING_COEF" , 0.3 )
108108
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+
109119
110120inference_config = InferenceConfig ()
Original file line number Diff line number Diff line change @@ -73,8 +73,8 @@ def initialize(
7373 self .feature_extractor = DetrImageProcessor .from_pretrained (model )
7474 # value not set in the configuration and needed for newer models
7575 # 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
7878
7979 try :
8080 logger .info ("Loading the table structure model ..." )
You can’t perform that action at this time.
0 commit comments