mahmoudalyosify commited on
Commit
2740843
Β·
verified Β·
1 Parent(s): 0fcee78

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +12 -12
src/streamlit_app.py CHANGED
@@ -208,11 +208,11 @@ st.markdown("""
208
  # ==========================================================================
209
  # Sidebar Configuration
210
  # ==========================================================================
211
- st.sidebar.markdown("### βš™οΈ Engine Settings")
212
  top_k_slider = st.sidebar.slider("Number of results (K)", min_value=3, max_value=20, value=6, step=1)
213
 
214
  st.sidebar.markdown("---")
215
- st.sidebar.markdown("### πŸ† Trained Backbone Model")
216
  st.sidebar.markdown("""
217
  * **Architecture**: ResNet-50 (CIFAR STEM adjusted)
218
  * **Training Type**: Self-Supervised (SimCLR)
@@ -224,14 +224,14 @@ st.sidebar.markdown("""
224
  """)
225
 
226
  st.sidebar.markdown("---")
227
- st.sidebar.markdown("### ⚑ Backend Pipeline")
228
  st.sidebar.markdown("""
229
  * **Inference Engine**: ONNX Runtime CPU
230
  * **Vector Database**: FAISS (IndexFlatIP)
231
  * **Similarity Metric**: Exact Cosine Similarity
232
  * **Database Size**: 10,000 Images
233
  """)
234
- st.sidebar.caption("Group 20, CISC 867, Queen's University, Spring 2026")
235
 
236
  # ==========================================================================
237
  # Main Title
@@ -240,7 +240,7 @@ st.title("Real-time SimCLR Image Retrieval Engine")
240
  st.markdown("##### Self-Supervised Representation Learning with ResNet-50 & FAISS Indexing")
241
 
242
  # Define Tabs
243
- tab1, tab2 = st.tabs(["πŸ” Real-Time Search", "πŸ“Š Ablation Study Dashboard"])
244
 
245
  # ==========================================================================
246
  # TAB 1: Visual Search Engine
@@ -256,7 +256,7 @@ with tab1:
256
  query_info = None
257
 
258
  with col_left:
259
- st.markdown("### πŸ“€ Select Query Image")
260
 
261
  # Method 1: Upload a file
262
  uploaded_file = st.file_uploader("Upload an image...", type=["jpg", "png", "jpeg"])
@@ -289,7 +289,7 @@ with tab1:
289
  st.error("Reference image file not found.")
290
 
291
  with col_right:
292
- st.markdown("### πŸ”Ž Visual Similarity Search Results")
293
 
294
  if query_image is not None:
295
  t_start = time.time()
@@ -371,7 +371,7 @@ with tab1:
371
  col.markdown(card_content, unsafe_allow_html=True)
372
 
373
  else:
374
- st.info("πŸ’‘ Please upload a custom image or click the button to select a random test image to query the visual search engine!")
375
 
376
  # ==========================================================================
377
  # TAB 2: Ablation Study Dashboard
@@ -412,7 +412,7 @@ with tab2:
412
  st.markdown(card_html, unsafe_allow_html=True)
413
 
414
  st.markdown("---")
415
- st.markdown("#### πŸ’‘ Key Project Takeaways")
416
  col1, col2 = st.columns(2)
417
 
418
  with col1:
@@ -420,16 +420,16 @@ with tab2:
420
  ##### 1. The Shortcut-Learning Problem 🧩
421
  Without Color Jitter, contrastive self-supervised encoders exploit low-level **color histograms** as a shortcut to maximize mutual information, rather than learning general shapes and semantic features. This results in weaker downstream representations, showing a severe performance limit (e.g. baseline Crop+Flip+Blur achieves only **64.49%**).
422
 
423
- ##### 2. The Color Jitter Shield πŸ›‘οΈ
424
  Adding photometric distortion (color jittering) forces the model to ignore color profiles and focus on invariant structures, spatial boundaries, and contours. This single ablation yields a massive average boost of **+18.1 pp** across all settings, pushing our best encoder (Exp 41) to a stellar **84.30% Top-1 accuracy**!
425
  """)
426
 
427
  with col2:
428
  st.markdown("""
429
- ##### 3. Model Architecture & Stem Tuning βš™οΈ
430
  Modifying the standard ResNet-50 conv1 stem from 3x3 (stride 1) and removing the initial MaxPool was crucial to preserve the resolution of 32x32 CIFAR-10 images.
431
 
432
- ##### 4. Near Foundation-Model Upper Bound πŸ†
433
  Our zero-shot CLIP ViT-B/32 foundation model evaluation sets the academic upper bound at **88.80%**. Our custom-trained SimCLR ResNet-50 achieves **95% of this performance** (**84.30%**) while using **8,000x less training data**!
434
  """)
435
 
 
208
  # ==========================================================================
209
  # Sidebar Configuration
210
  # ==========================================================================
211
+ st.sidebar.markdown("### Engine Settings")
212
  top_k_slider = st.sidebar.slider("Number of results (K)", min_value=3, max_value=20, value=6, step=1)
213
 
214
  st.sidebar.markdown("---")
215
+ st.sidebar.markdown("### Trained Backbone Model")
216
  st.sidebar.markdown("""
217
  * **Architecture**: ResNet-50 (CIFAR STEM adjusted)
218
  * **Training Type**: Self-Supervised (SimCLR)
 
224
  """)
225
 
226
  st.sidebar.markdown("---")
227
+ st.sidebar.markdown("### Backend Pipeline")
228
  st.sidebar.markdown("""
229
  * **Inference Engine**: ONNX Runtime CPU
230
  * **Vector Database**: FAISS (IndexFlatIP)
231
  * **Similarity Metric**: Exact Cosine Similarity
232
  * **Database Size**: 10,000 Images
233
  """)
234
+ st.sidebar.caption("Mahmoud Alyosify - Natalie Monged & Mirna Embaby, CISC 867, Queen's University, Spring 2026")
235
 
236
  # ==========================================================================
237
  # Main Title
 
240
  st.markdown("##### Self-Supervised Representation Learning with ResNet-50 & FAISS Indexing")
241
 
242
  # Define Tabs
243
+ tab1, tab2 = st.tabs(["Real-Time Search", "Ablation Study Dashboard"])
244
 
245
  # ==========================================================================
246
  # TAB 1: Visual Search Engine
 
256
  query_info = None
257
 
258
  with col_left:
259
+ st.markdown("### Select Query Image")
260
 
261
  # Method 1: Upload a file
262
  uploaded_file = st.file_uploader("Upload an image...", type=["jpg", "png", "jpeg"])
 
289
  st.error("Reference image file not found.")
290
 
291
  with col_right:
292
+ st.markdown("### Visual Similarity Search Results")
293
 
294
  if query_image is not None:
295
  t_start = time.time()
 
371
  col.markdown(card_content, unsafe_allow_html=True)
372
 
373
  else:
374
+ st.info("Please upload a custom image or click the button to select a random test image to query the visual search engine!")
375
 
376
  # ==========================================================================
377
  # TAB 2: Ablation Study Dashboard
 
412
  st.markdown(card_html, unsafe_allow_html=True)
413
 
414
  st.markdown("---")
415
+ st.markdown("#### Key Project Takeaways")
416
  col1, col2 = st.columns(2)
417
 
418
  with col1:
 
420
  ##### 1. The Shortcut-Learning Problem 🧩
421
  Without Color Jitter, contrastive self-supervised encoders exploit low-level **color histograms** as a shortcut to maximize mutual information, rather than learning general shapes and semantic features. This results in weaker downstream representations, showing a severe performance limit (e.g. baseline Crop+Flip+Blur achieves only **64.49%**).
422
 
423
+ ##### 2. The Color Jitter Shield
424
  Adding photometric distortion (color jittering) forces the model to ignore color profiles and focus on invariant structures, spatial boundaries, and contours. This single ablation yields a massive average boost of **+18.1 pp** across all settings, pushing our best encoder (Exp 41) to a stellar **84.30% Top-1 accuracy**!
425
  """)
426
 
427
  with col2:
428
  st.markdown("""
429
+ ##### 3. Model Architecture & Stem Tuning
430
  Modifying the standard ResNet-50 conv1 stem from 3x3 (stride 1) and removing the initial MaxPool was crucial to preserve the resolution of 32x32 CIFAR-10 images.
431
 
432
+ ##### 4. Near Foundation-Model Upper Bound
433
  Our zero-shot CLIP ViT-B/32 foundation model evaluation sets the academic upper bound at **88.80%**. Our custom-trained SimCLR ResNet-50 achieves **95% of this performance** (**84.30%**) while using **8,000x less training data**!
434
  """)
435