jarondon82 commited on
Commit
d07c513
·
1 Parent(s): 81714ce

Implementado texto explicativo dinámico que cambia según la selección de la imagen: beneficios para la imagen mejorada y desafíos para la imagen original

Browse files
Files changed (1) hide show
  1. utils/preprocessing_ui.py +37 -14
utils/preprocessing_ui.py CHANGED
@@ -105,20 +105,43 @@ def show_preprocessing_ui(image_service, img: np.ndarray) -> Dict[str, Any]:
105
  st.markdown("* Brightness decreased by 30%")
106
  st.markdown("* Contrast decreased by 30%")
107
 
108
- # Add explanation of why these improvements help
109
- st.markdown("## Why these improvements help facial analysis")
110
-
111
- # Technical explanation
112
- st.markdown("**Technical Benefits:**")
113
- st.markdown("* **Balanced contrast:** Enhances the visibility of facial features while reducing shadows and highlights")
114
- st.markdown("* **Optimal brightness:** Ensures facial features are clearly distinguishable without over-exposure")
115
- st.markdown("* **Proper sizing:** Maintains ideal dimensions for detection algorithms to recognize facial landmarks")
116
-
117
- # Impact on emotion detection
118
- st.markdown("**Impact on Emotion Detection:**")
119
- st.markdown("* **More accurate emotion classification:** Cleaner input images lead to more reliable emotion detection")
120
- st.markdown("* **Better feature extraction:** Facial features like eyes, mouth, and eyebrows are more clearly defined")
121
- st.markdown("* **Reduced noise and artifacts:** Minimizes false detections and improves confidence scores")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
  except Exception as e:
124
  # Log detailed error information
 
105
  st.markdown("* Brightness decreased by 30%")
106
  st.markdown("* Contrast decreased by 30%")
107
 
108
+ # Dynamic explanation based on selected mode
109
+ if st.session_state["selected_image_mode"] == "improved":
110
+ # Show explanation about improvements benefits
111
+ st.markdown("## Why these improvements help facial analysis")
112
+
113
+ # Technical explanation
114
+ st.markdown("**Technical Benefits:**")
115
+ st.markdown("* **Balanced contrast:** Enhances the visibility of facial features while reducing shadows and highlights")
116
+ st.markdown("* **Optimal brightness:** Ensures facial features are clearly distinguishable without over-exposure")
117
+ st.markdown("* **Proper sizing:** Maintains ideal dimensions for detection algorithms to recognize facial landmarks")
118
+
119
+ # Impact on emotion detection
120
+ st.markdown("**Impact on Emotion Detection:**")
121
+ st.markdown("* **More accurate emotion classification:** Cleaner input images lead to more reliable emotion detection")
122
+ st.markdown("* **Better feature extraction:** Facial features like eyes, mouth, and eyebrows are more clearly defined")
123
+ st.markdown("* **Reduced noise and artifacts:** Minimizes false detections and improves confidence scores")
124
+ else:
125
+ # Show explanation about potential challenges with original images
126
+ st.markdown("## Potential challenges with original images")
127
+
128
+ # Technical explanation
129
+ st.markdown("**Common issues with unprocessed images:**")
130
+ st.markdown("* **Variable lighting conditions:** Original images may have shadows or highlights that obscure facial features")
131
+ st.markdown("* **Inconsistent contrast:** Low contrast can make facial features harder to detect accurately")
132
+ st.markdown("* **Background noise:** Unprocessed images often contain visual elements that can distract detection algorithms")
133
+
134
+ # Impact on detection
135
+ st.markdown("**Potential impact on detection quality:**")
136
+ st.markdown("* **Lower detection confidence:** Original images may result in less confident emotion classifications")
137
+ st.markdown("* **Feature detection challenges:** Some facial features might be missed or misidentified")
138
+ st.markdown("* **Increased false readings:** Environmental factors in the original image could lead to misinterpretations")
139
+
140
+ # When to use original images
141
+ st.markdown("**When to use original images:**")
142
+ st.markdown("* When the original lighting and contrast are already optimal")
143
+ st.markdown("* When you want to analyze the image exactly as captured")
144
+ st.markdown("* For comparison with processed results")
145
 
146
  except Exception as e:
147
  # Log detailed error information