Spaces:
Sleeping
Sleeping
Commit
·
b1c8e02
1
Parent(s):
07c9086
Mejores ajustes de coordenasdas para líneas de Producto
Browse files- __pycache__/commercial_invoice.cpython-310.pyc +0 -0
- commercial_invoice.py +1 -1
- coordinates_CI.json +18 -18
- test.py +1 -1
__pycache__/commercial_invoice.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/commercial_invoice.cpython-310.pyc and b/__pycache__/commercial_invoice.cpython-310.pyc differ
|
|
|
commercial_invoice.py
CHANGED
|
@@ -58,7 +58,7 @@ def is_horizontal_line(image_crop):
|
|
| 58 |
row_sums = np.sum(detected_lines > 0, axis=1)
|
| 59 |
max_continuous_line = np.max(row_sums) if row_sums.size > 0 else 0
|
| 60 |
|
| 61 |
-
# Una línea continua debe ocupar al menos el
|
| 62 |
threshold = binary.shape[1] * 0.6
|
| 63 |
|
| 64 |
logger.debug(f"Línea más larga detectada: {max_continuous_line} píxeles de {binary.shape[1]}")
|
|
|
|
| 58 |
row_sums = np.sum(detected_lines > 0, axis=1)
|
| 59 |
max_continuous_line = np.max(row_sums) if row_sums.size > 0 else 0
|
| 60 |
|
| 61 |
+
# Una línea continua debe ocupar al menos el 60% del ancho
|
| 62 |
threshold = binary.shape[1] * 0.6
|
| 63 |
|
| 64 |
logger.debug(f"Línea más larga detectada: {max_continuous_line} píxeles de {binary.shape[1]}")
|
coordinates_CI.json
CHANGED
|
@@ -152,7 +152,7 @@
|
|
| 152 |
"x": "827.0",
|
| 153 |
"y": "1049.0",
|
| 154 |
"width": "3000.0",
|
| 155 |
-
"height": "
|
| 156 |
"confidence": null
|
| 157 |
},
|
| 158 |
{
|
|
@@ -161,7 +161,7 @@
|
|
| 161 |
"x": "827.50",
|
| 162 |
"y": "1091.83",
|
| 163 |
"width": "3000.00",
|
| 164 |
-
"height": "
|
| 165 |
"confidence": null
|
| 166 |
},
|
| 167 |
{
|
|
@@ -170,16 +170,16 @@
|
|
| 170 |
"x": "827.00",
|
| 171 |
"y": "1130.0",
|
| 172 |
"width": "3000.0",
|
| 173 |
-
"height": "
|
| 174 |
"confidence": null
|
| 175 |
},
|
| 176 |
{
|
| 177 |
"id": "K",
|
| 178 |
"label": "Product_line_4",
|
| 179 |
"x": "827.00",
|
| 180 |
-
"y": "
|
| 181 |
"width": "3000.0",
|
| 182 |
-
"height": "
|
| 183 |
"confidence": null
|
| 184 |
},
|
| 185 |
{
|
|
@@ -188,7 +188,7 @@
|
|
| 188 |
"x": "827.00",
|
| 189 |
"y": "1214.0",
|
| 190 |
"width": "3000.00",
|
| 191 |
-
"height": "
|
| 192 |
"confidence": null
|
| 193 |
},
|
| 194 |
{
|
|
@@ -197,7 +197,7 @@
|
|
| 197 |
"x": "827.00",
|
| 198 |
"y": "1254.0",
|
| 199 |
"width": "3000.0",
|
| 200 |
-
"height": "
|
| 201 |
"confidence": null
|
| 202 |
},
|
| 203 |
{
|
|
@@ -206,7 +206,7 @@
|
|
| 206 |
"x": "827.00",
|
| 207 |
"y": "1300.0",
|
| 208 |
"width": "3000.0",
|
| 209 |
-
"height": "
|
| 210 |
"confidence": null
|
| 211 |
},
|
| 212 |
{
|
|
@@ -215,7 +215,7 @@
|
|
| 215 |
"x": "827.0",
|
| 216 |
"y": "1342.0",
|
| 217 |
"width": "3000.0",
|
| 218 |
-
"height": "
|
| 219 |
"confidence": null
|
| 220 |
},
|
| 221 |
{
|
|
@@ -224,7 +224,7 @@
|
|
| 224 |
"x": "827.0",
|
| 225 |
"y": "1384.0",
|
| 226 |
"width": "3000.0",
|
| 227 |
-
"height": "
|
| 228 |
"confidence": null
|
| 229 |
},
|
| 230 |
{
|
|
@@ -233,7 +233,7 @@
|
|
| 233 |
"x": "827.0",
|
| 234 |
"y": "1426.0",
|
| 235 |
"width": "3000.0",
|
| 236 |
-
"height": "
|
| 237 |
"confidence": null
|
| 238 |
},
|
| 239 |
{
|
|
@@ -242,7 +242,7 @@
|
|
| 242 |
"x": "827.0",
|
| 243 |
"y": "1468.0",
|
| 244 |
"width": "3000.0",
|
| 245 |
-
"height": "
|
| 246 |
"confidence": null
|
| 247 |
},
|
| 248 |
|
|
@@ -252,7 +252,7 @@
|
|
| 252 |
"x": "827.0",
|
| 253 |
"y": "1510.0",
|
| 254 |
"width": "3000.0",
|
| 255 |
-
"height": "
|
| 256 |
"confidence": null
|
| 257 |
},
|
| 258 |
{
|
|
@@ -261,7 +261,7 @@
|
|
| 261 |
"x": "827.0",
|
| 262 |
"y": "1552.0",
|
| 263 |
"width": "3000.0",
|
| 264 |
-
"height": "
|
| 265 |
"confidence": null
|
| 266 |
},
|
| 267 |
{
|
|
@@ -270,7 +270,7 @@
|
|
| 270 |
"x": "827.0",
|
| 271 |
"y": "1594.0",
|
| 272 |
"width": "3000.0",
|
| 273 |
-
"height": "
|
| 274 |
"confidence": null
|
| 275 |
},
|
| 276 |
{
|
|
@@ -279,7 +279,7 @@
|
|
| 279 |
"x": "827.0",
|
| 280 |
"y": "1636",
|
| 281 |
"width": "3000.0",
|
| 282 |
-
"height": "
|
| 283 |
"confidence": null
|
| 284 |
},
|
| 285 |
{
|
|
@@ -288,7 +288,7 @@
|
|
| 288 |
"x": "827.0",
|
| 289 |
"y": "1678.0",
|
| 290 |
"width": "3000.0",
|
| 291 |
-
"height": "
|
| 292 |
"confidence": null
|
| 293 |
},
|
| 294 |
{
|
|
@@ -297,7 +297,7 @@
|
|
| 297 |
"x": "827.0",
|
| 298 |
"y": "1720.0",
|
| 299 |
"width": "3000.0",
|
| 300 |
-
"height": "
|
| 301 |
"confidence": null
|
| 302 |
}
|
| 303 |
|
|
|
|
| 152 |
"x": "827.0",
|
| 153 |
"y": "1049.0",
|
| 154 |
"width": "3000.0",
|
| 155 |
+
"height": "27.00",
|
| 156 |
"confidence": null
|
| 157 |
},
|
| 158 |
{
|
|
|
|
| 161 |
"x": "827.50",
|
| 162 |
"y": "1091.83",
|
| 163 |
"width": "3000.00",
|
| 164 |
+
"height": "27.00",
|
| 165 |
"confidence": null
|
| 166 |
},
|
| 167 |
{
|
|
|
|
| 170 |
"x": "827.00",
|
| 171 |
"y": "1130.0",
|
| 172 |
"width": "3000.0",
|
| 173 |
+
"height": "27.00",
|
| 174 |
"confidence": null
|
| 175 |
},
|
| 176 |
{
|
| 177 |
"id": "K",
|
| 178 |
"label": "Product_line_4",
|
| 179 |
"x": "827.00",
|
| 180 |
+
"y": "1170.0",
|
| 181 |
"width": "3000.0",
|
| 182 |
+
"height": "27.00",
|
| 183 |
"confidence": null
|
| 184 |
},
|
| 185 |
{
|
|
|
|
| 188 |
"x": "827.00",
|
| 189 |
"y": "1214.0",
|
| 190 |
"width": "3000.00",
|
| 191 |
+
"height": "27.00",
|
| 192 |
"confidence": null
|
| 193 |
},
|
| 194 |
{
|
|
|
|
| 197 |
"x": "827.00",
|
| 198 |
"y": "1254.0",
|
| 199 |
"width": "3000.0",
|
| 200 |
+
"height": "27.00",
|
| 201 |
"confidence": null
|
| 202 |
},
|
| 203 |
{
|
|
|
|
| 206 |
"x": "827.00",
|
| 207 |
"y": "1300.0",
|
| 208 |
"width": "3000.0",
|
| 209 |
+
"height": "27.00",
|
| 210 |
"confidence": null
|
| 211 |
},
|
| 212 |
{
|
|
|
|
| 215 |
"x": "827.0",
|
| 216 |
"y": "1342.0",
|
| 217 |
"width": "3000.0",
|
| 218 |
+
"height": "27.00",
|
| 219 |
"confidence": null
|
| 220 |
},
|
| 221 |
{
|
|
|
|
| 224 |
"x": "827.0",
|
| 225 |
"y": "1384.0",
|
| 226 |
"width": "3000.0",
|
| 227 |
+
"height": "27.00",
|
| 228 |
"confidence": null
|
| 229 |
},
|
| 230 |
{
|
|
|
|
| 233 |
"x": "827.0",
|
| 234 |
"y": "1426.0",
|
| 235 |
"width": "3000.0",
|
| 236 |
+
"height": "27.00",
|
| 237 |
"confidence": null
|
| 238 |
},
|
| 239 |
{
|
|
|
|
| 242 |
"x": "827.0",
|
| 243 |
"y": "1468.0",
|
| 244 |
"width": "3000.0",
|
| 245 |
+
"height": "27.00",
|
| 246 |
"confidence": null
|
| 247 |
},
|
| 248 |
|
|
|
|
| 252 |
"x": "827.0",
|
| 253 |
"y": "1510.0",
|
| 254 |
"width": "3000.0",
|
| 255 |
+
"height": "27.00",
|
| 256 |
"confidence": null
|
| 257 |
},
|
| 258 |
{
|
|
|
|
| 261 |
"x": "827.0",
|
| 262 |
"y": "1552.0",
|
| 263 |
"width": "3000.0",
|
| 264 |
+
"height": "27.00",
|
| 265 |
"confidence": null
|
| 266 |
},
|
| 267 |
{
|
|
|
|
| 270 |
"x": "827.0",
|
| 271 |
"y": "1594.0",
|
| 272 |
"width": "3000.0",
|
| 273 |
+
"height": "27.00",
|
| 274 |
"confidence": null
|
| 275 |
},
|
| 276 |
{
|
|
|
|
| 279 |
"x": "827.0",
|
| 280 |
"y": "1636",
|
| 281 |
"width": "3000.0",
|
| 282 |
+
"height": "27.00",
|
| 283 |
"confidence": null
|
| 284 |
},
|
| 285 |
{
|
|
|
|
| 288 |
"x": "827.0",
|
| 289 |
"y": "1678.0",
|
| 290 |
"width": "3000.0",
|
| 291 |
+
"height": "27.00",
|
| 292 |
"confidence": null
|
| 293 |
},
|
| 294 |
{
|
|
|
|
| 297 |
"x": "827.0",
|
| 298 |
"y": "1720.0",
|
| 299 |
"width": "3000.0",
|
| 300 |
+
"height": "27.00",
|
| 301 |
"confidence": null
|
| 302 |
}
|
| 303 |
|
test.py
CHANGED
|
@@ -57,4 +57,4 @@ def test_single_invoice(pagina:str):
|
|
| 57 |
logger.error(f"Error en la prueba: {str(e)}", exc_info=True)
|
| 58 |
|
| 59 |
if __name__ == "__main__":
|
| 60 |
-
test_single_invoice("
|
|
|
|
| 57 |
logger.error(f"Error en la prueba: {str(e)}", exc_info=True)
|
| 58 |
|
| 59 |
if __name__ == "__main__":
|
| 60 |
+
test_single_invoice("pagina_2.jpg")
|