Tohru127 commited on
Commit
c77907e
ยท
verified ยท
1 Parent(s): 4a1bdd2

error version

Browse files
Files changed (1) hide show
  1. app.py +62 -0
app.py CHANGED
@@ -183,6 +183,43 @@ dpt_processor = None
183
  def process_image(image, model_choice="GLPN (Recommended)", visualization_type="mesh"):
184
  """Main processing pipeline - simplified from first version"""
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  if image is None:
187
  return None, None, None, "Please upload an image first.", None
188
 
@@ -727,6 +764,12 @@ with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as de
727
  - https://www.creators3d.com/online-viewer
728
  - Just drag and drop your OBJ/PLY file
729
 
 
 
 
 
 
 
730
 
731
  ## Tips for Best Results
732
 
@@ -745,6 +788,7 @@ with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as de
745
  - Extreme close-ups or very distant scenes
746
  - Heavy shadows or very dark images
747
  - Transparent objects
 
748
 
749
  ## Understanding the Metrics
750
 
@@ -823,6 +867,10 @@ with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as de
823
  # ========== CITATION TAB ==========
824
  with gr.Tab("๐Ÿ“„ Citation & Credits"):
825
  gr.Markdown("""
 
 
 
 
826
  ### For GLPN Model:
827
  ```bibtex
828
  @inproceedings{kim2022global,
@@ -851,18 +899,32 @@ with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as de
851
  - **PyTorch**: Deep learning framework
852
  - **Plotly**: Interactive 3D visualization
853
  - **Gradio**: Web interface
 
 
 
 
 
 
 
 
 
854
  """)
855
 
856
  # ========== FOOTER ==========
857
  gr.Markdown("""
858
  ---
859
 
 
 
860
  This application demonstrates comprehensive understanding of:
861
  - Computer vision and deep learning
862
  - 3D geometry and reconstruction
863
  - Software engineering best practices
864
  - Research methodology and evaluation
865
 
 
 
 
866
  """)
867
 
868
  # ============================================================================
 
183
  def process_image(image, model_choice="GLPN (Recommended)", visualization_type="mesh"):
184
  """Main processing pipeline - simplified from first version"""
185
 
186
+ def _generate_quality_assessment(metrics):
187
+ """Generate quality assessment based on metrics"""
188
+ assessment = []
189
+
190
+ # Check outlier removal
191
+ outlier_pct = (metrics['outliers_removed'] / metrics['initial_points']) * 100
192
+ if outlier_pct < 5:
193
+ assessment.append("โœ… Very clean depth estimation (low noise)")
194
+ elif outlier_pct < 15:
195
+ assessment.append("โœ… Good depth quality (normal noise level)")
196
+ else:
197
+ assessment.append("โš ๏ธ High noise in depth estimation")
198
+
199
+ # Check manifold properties
200
+ if metrics['is_edge_manifold'] and metrics['is_vertex_manifold']:
201
+ assessment.append("โœ… Excellent topology - mesh is well-formed")
202
+ elif metrics['is_vertex_manifold']:
203
+ assessment.append("โš ๏ธ Good local topology but has some edge issues")
204
+ else:
205
+ assessment.append("โš ๏ธ Topology issues present - may need cleanup")
206
+
207
+ # Check watertight
208
+ if metrics['is_watertight']:
209
+ assessment.append("โœ… Watertight mesh - ready for 3D printing!")
210
+ else:
211
+ assessment.append("โ„น๏ธ Not watertight - use MeshLab's 'Close Holes' for 3D printing")
212
+
213
+ # Check complexity
214
+ if metrics['triangles'] > 1000000:
215
+ assessment.append("โ„น๏ธ Very detailed mesh - may be slow in some software")
216
+ elif metrics['triangles'] > 500000:
217
+ assessment.append("โœ… High detail mesh - good quality")
218
+ else:
219
+ assessment.append("โœ… Moderate detail - good balance of quality and performance")
220
+
221
+ return "\n".join(f"- {item}" for item in assessment)
222
+
223
  if image is None:
224
  return None, None, None, "Please upload an image first.", None
225
 
 
764
  - https://www.creators3d.com/online-viewer
765
  - Just drag and drop your OBJ/PLY file
766
 
767
+ ### For 3D Printing:
768
+ 1. Use the `mesh.stl` file
769
+ 2. Check metrics: Look for "Watertight: โœ“"
770
+ 3. Import into your slicer (Cura, PrusaSlicer, etc.)
771
+ 4. Scale to desired size
772
+ 5. Slice and print!
773
 
774
  ## Tips for Best Results
775
 
 
788
  - Extreme close-ups or very distant scenes
789
  - Heavy shadows or very dark images
790
  - Transparent objects
791
+ - Outdoor scenes with sky (models trained on indoor data)
792
 
793
  ## Understanding the Metrics
794
 
 
867
  # ========== CITATION TAB ==========
868
  with gr.Tab("๐Ÿ“„ Citation & Credits"):
869
  gr.Markdown("""
870
+ ## How to Cite
871
+
872
+ If you use this application in your research, please cite the relevant papers:
873
+
874
  ### For GLPN Model:
875
  ```bibtex
876
  @inproceedings{kim2022global,
 
899
  - **PyTorch**: Deep learning framework
900
  - **Plotly**: Interactive 3D visualization
901
  - **Gradio**: Web interface
902
+
903
+ ## License & Usage
904
+
905
+ - **Code**: MIT License
906
+ - **Generated 3D Models**: You own the outputs
907
+
908
+ ## Contact & Support
909
+
910
+ For issues, questions, or suggestions, use the Community tab on Hugging Face.
911
  """)
912
 
913
  # ========== FOOTER ==========
914
  gr.Markdown("""
915
  ---
916
 
917
+ ### ๐ŸŽ“ PhD Application Demo
918
+
919
  This application demonstrates comprehensive understanding of:
920
  - Computer vision and deep learning
921
  - 3D geometry and reconstruction
922
  - Software engineering best practices
923
  - Research methodology and evaluation
924
 
925
+ **Developed for academic research purposes**
926
+
927
+ *Version 1.0*
928
  """)
929
 
930
  # ============================================================================