File size: 1,659 Bytes
809b92e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# config.py
"""
Configuraci贸n y constantes del proyecto
"""

# MODELO DE HUGGING FACE FINE-TUNEADO
HUGGINGFACE_MODEL = "lucasgagneten/layoutlmv3-argentine-invoices"

# Definir las etiquetas utilizadas durante el entrenamiento
LABEL_LIST = [
    'B-ALICUOTA',
    'B-COMPROBANTE_NUMERO',
    'B-CONCEPTO_GASTO',
    'B-FECHA',
    'B-IVA',
    'B-JURISDICCION_GASTO',
    'B-NETO',
    'B-PROVEEDOR_CUIT',
    'B-PROVEEDOR_RAZON_SOCIAL',
    'B-TIPO',
    'B-TOTAL',
    'I-COMPROBANTE_NUMERO',
    'I-CONCEPTO_GASTO',
    'I-JURISDICCION_GASTO',
    'I-PROVEEDOR_CUIT',
    'I-PROVEEDOR_RAZON_SOCIAL',
    'I-TOTAL',
    'O'
]

# Mapeo de etiquetas
ID2LABEL = {i: label for i, label in enumerate(LABEL_LIST)}
LABEL2ID = {label: i for i, label in enumerate(LABEL_LIST)}

# Configuraci贸n de colores para las cajas delimitadoras
COLOR_PALETTE = [
    'red', 'blue', 'green', 'purple', 'orange', 'brown', 'pink', 'cyan', 
    'lime', 'olive', 'teal', 'magenta', 'navy', 'maroon', 'gold', 'silver', 
    'indigo', 'turquoise'
]

# Crear mapeo de etiquetas a colores
def get_label_colors():
    """Genera el mapeo de etiquetas ra铆z a colores."""
    root_labels = set()
    for label in LABEL_LIST:
        if label != 'O':
            root_label = label.split('-', 1)[-1] 
            root_labels.add(root_label)
    
    label2color = {}
    for i, root_label in enumerate(sorted(list(root_labels))):
        label2color[root_label] = COLOR_PALETTE[i % len(COLOR_PALETTE)]
    
    return label2color

LABEL2COLOR = get_label_colors()

# Configuraci贸n de procesamiento
MAX_LENGTH = 512
NORMALIZATION_FACTOR = 1000  # Factor para normalizar coordenadas de bbox