Generation test
@@ -109,8 +109,8 @@ def parse_md_to_html_blocks(md_content):
|
|||||||
html_blocks.append(f'''<p class=MsoCaption style="text-align:center"><a name="{bookmark_id}"><span lang=ES style="font-size:12.0pt;line-height:150%">Figura {figure_counter}. </span></a><i><span lang=ES style="font-size:12.0pt;line-height:150%;font-weight:normal">{fig_title}</span></i></p>''')
|
html_blocks.append(f'''<p class=MsoCaption style="text-align:center"><a name="{bookmark_id}"><span lang=ES style="font-size:12.0pt;line-height:150%">Figura {figure_counter}. </span></a><i><span lang=ES style="font-size:12.0pt;line-height:150%;font-weight:normal">{fig_title}</span></i></p>''')
|
||||||
|
|
||||||
if os.path.exists(fig_path):
|
if os.path.exists(fig_path):
|
||||||
# Use actual image with proper Word-compatible format
|
# Use actual image with proper Word-compatible format (max 400px width, 500px height to fit page)
|
||||||
html_blocks.append(f'''<p class=MsoNormal style="text-align:center"><span lang=ES><img width=500 src="{fig_file}" alt="{fig_title}"/></span></p>''')
|
html_blocks.append(f'''<p class=MsoNormal style="text-align:center"><span lang=ES><img style="max-width:400px;max-height:500px;width:auto;height:auto" src="{fig_file}" alt="{fig_title}"/></span></p>''')
|
||||||
else:
|
else:
|
||||||
# Fallback to placeholder
|
# Fallback to placeholder
|
||||||
html_blocks.append(f'''<p class=MsoNormal style="text-align:center;border:1px dashed #999;padding:20px;margin:10px 40px;background:#f9f9f9"><span lang=ES style="color:#666">[Insertar diagrama Mermaid aquí]</span></p>''')
|
html_blocks.append(f'''<p class=MsoNormal style="text-align:center;border:1px dashed #999;padding:20px;margin:10px 40px;background:#f9f9f9"><span lang=ES style="color:#666">[Insertar diagrama Mermaid aquí]</span></p>''')
|
||||||
|
|||||||
@@ -40,37 +40,18 @@ Este capítulo establece los objetivos del trabajo siguiendo la metodología SMA
|
|||||||
|
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
flowchart TD
|
A["Fase 1<br/>Dataset"] --> B["Fase 2<br/>Benchmark"] --> C["Fase 3<br/>Espacio"] --> D["Fase 4<br/>Optimización"] --> E["Fase 5<br/>Validación"]
|
||||||
A["Fase 1: Preparación del Dataset<br/>
|
|
||||||
• Conversión PDF → Imágenes (300 DPI)<br/>
|
|
||||||
• Extracción de texto de referencia (PyMuPDF)<br/>
|
|
||||||
• Estructura: carpetas img/ y txt/ pareadas"]
|
|
||||||
|
|
||||||
B["Fase 2: Benchmark Comparativo<br/>
|
|
||||||
• Evaluación de EasyOCR, PaddleOCR, DocTR<br/>
|
|
||||||
• Métricas: CER, WER<br/>
|
|
||||||
• Selección del modelo base"]
|
|
||||||
|
|
||||||
C["Fase 3: Definición del Espacio de Búsqueda<br/>
|
|
||||||
• Identificación de hiperparámetros configurables<br/>
|
|
||||||
• Definición de rangos y distribuciones<br/>
|
|
||||||
• Configuración de Ray Tune + Optuna"]
|
|
||||||
|
|
||||||
D["Fase 4: Optimización de Hiperparámetros<br/>
|
|
||||||
• Ejecución de 64 trials con Ray Tune<br/>
|
|
||||||
• Paralelización (2 trials concurrentes)<br/>
|
|
||||||
• Registro de métricas y configuraciones"]
|
|
||||||
|
|
||||||
E["Fase 5: Validación y Análisis<br/>
|
|
||||||
• Comparación baseline vs optimizado<br/>
|
|
||||||
• Análisis de correlaciones<br/>
|
|
||||||
• Documentación de resultados"]
|
|
||||||
|
|
||||||
A --> B --> C --> D --> E
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Descripción de las fases:**
|
||||||
|
|
||||||
|
- **Fase 1 - Preparación del Dataset**: Conversión PDF a imágenes (300 DPI), extracción de ground truth con PyMuPDF
|
||||||
|
- **Fase 2 - Benchmark Comparativo**: Evaluación de EasyOCR, PaddleOCR, DocTR con métricas CER/WER
|
||||||
|
- **Fase 3 - Espacio de Búsqueda**: Identificación de hiperparámetros y configuración de Ray Tune + Optuna
|
||||||
|
- **Fase 4 - Optimización**: Ejecución de 64 trials con paralelización (2 concurrentes)
|
||||||
|
- **Fase 5 - Validación**: Comparación baseline vs optimizado, análisis de correlaciones
|
||||||
|
|
||||||
### Fase 1: Preparación del Dataset
|
### Fase 1: Preparación del Dataset
|
||||||
|
|
||||||
#### Fuente de Datos
|
#### Fuente de Datos
|
||||||
|
|||||||
@@ -61,10 +61,10 @@ def convert_to_png(diagrams):
|
|||||||
with open(temp_file, 'w', encoding='utf-8') as f:
|
with open(temp_file, 'w', encoding='utf-8') as f:
|
||||||
f.write(diagram['code'])
|
f.write(diagram['code'])
|
||||||
|
|
||||||
# Convert using mmdc
|
# Convert using mmdc with higher resolution for better readability
|
||||||
try:
|
try:
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
[MMDC, '-i', temp_file, '-o', output_file, '-b', 'white', '-w', '800'],
|
[MMDC, '-i', temp_file, '-o', output_file, '-b', 'white', '-w', '1600', '-s', '2'],
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
timeout=60
|
timeout=60
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 37 KiB |