matanzig commited on
Commit
4827425
·
verified ·
1 Parent(s): 252a234

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +120 -1
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  title: Interior Design GenAI
3
- emoji: 😻
4
  colorFrom: green
5
  colorTo: gray
6
  sdk: gradio
@@ -12,3 +12,122 @@ license: mit
12
  ---
13
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  title: Interior Design GenAI
3
+ emoji: 🏡
4
  colorFrom: green
5
  colorTo: gray
6
  sdk: gradio
 
12
  ---
13
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
15
+
16
+
17
+ # 🏡 VISIONARY: AI-Powered Interior Design Engine
18
+
19
+ > An advanced, multi-modal recommendation system leveraging Deep Learning (CLIP), Unsupervised Clustering (K-Means), and Generative AI to understand stylistic intent and retrieve context-aware interior design architecture.
20
+
21
+ ---
22
+
23
+ ## 📖 Executive Summary
24
+ Welcome to **Visionary**. Traditional visual search engines rely on basic pixel-matching or color histograms, which often fail to grasp the structural and semantic nuances of interior design. This project solves that by utilizing the `openai/clip-vit-base-patch32` vision-language model to project raw images into a 512-dimensional semantic space. By doing so, the system understands abstract concepts—such as "minimalist," "industrial," or "warm lighting"—and retrieves highly accurate room designs based on user inspiration photos or textual descriptions.
25
+
26
+ ---
27
+
28
+ ## 🗄️ 1. Dataset Architecture
29
+
30
+ For the foundation of this engine, we selected the `my_interior_design_dataset` from Hugging Face. This dataset is exceptionally well-suited for high-level visual recommendation tasks.
31
+
32
+ * **Total Volume:** 33,453 images (~33,500 in the training split).
33
+ * **Storage Size:** 535 MB.
34
+ * **Standardization:** All image matrices are perfectly uniform at a `256x256` pixel resolution.
35
+ * **Categorical Richness:** Every sample is enriched with two primary ground-truth labels:
36
+ * **Style:** 11 distinct design classes (e.g., *Rustic, Bohemian, Transitional, Mid-Century Modern*).
37
+ * **Room:** 5 functional architectural classes (e.g., *Bedroom, Kitchen, Dining Room, Living Room, Bathroom*).
38
+
39
+ ---
40
+
41
+ ## 📊 2. Exploratory Data Analysis (EDA)
42
+
43
+ Before feeding data into deep neural networks, we conducted rigorous Exploratory Data Analysis to validate structural integrity and uncover hidden visual biases.
44
+
45
+ ### 2.1 Initial Sanity Checks & Data Integrity
46
+ * **Missing Value Verification:** We inspected the metadata arrays and confirmed **zero missing values (NaNs)**. Every visual sample is explicitly paired with valid ground-truth labels.
47
+ * **Dimension Uniformity:** Batch tensor operations require exact spatial dimensions. Our checks passed flawlessly—100% of the tested samples maintain the strict 256x256 boundary, eliminating the need for dynamic resizing during training.
48
+
49
+ ### 2.2 Class Distribution Analysis
50
+ Understanding the distribution of our labels is critical to identifying potential model biases.
51
+ * **Room Types:** We observed a moderate class imbalance. *Class 4 (Living Room)* is the dominant category with >10,000 samples, whereas *Class 3* contains ~4,000.
52
+ * **Interior Styles:** The stylistic distribution is more balanced, gently sloping from ~4,000 samples down to ~2,100 in the least frequent class.
53
+ * **Takeaway:** While the model has ample data to generate robust embeddings across all vectors, the recommendation engine might naturally perform with higher confidence on Living Rooms due to broader exposure during the embedding phase.
54
+
55
+ <div align="center">
56
+ <img src="REPLACE_THIS_WITH_IMAGE_LINK.png" alt="Class Distribution Bar Charts" width="800"/>
57
+ <br>
58
+ <em>Figure 1: Distribution of Room Types and Interior Styles across the dataset.</em>
59
+ </div>
60
+
61
+ ### 2.3 RGB Channel Distribution
62
+ Unlike tabular data, images are composed of pixel intensities across Red, Green, and Blue channels.
63
+ * **Insights:** The generated histogram reveals a dataset that is predominantly bright and well-lit. Notably, the **Red channel dominates** the higher intensity ranges. This perfectly aligns with real-world interior photography, which heavily features warm ambient lighting, wooden textures, and earth-toned furniture. Our CLIP model utilizes these specific warm-light biases as strong features for calculating room similarities.
64
+
65
+ <div align="center">
66
+ <img src="REPLACE_THIS_WITH_IMAGE_LINK.png" alt="RGB Histogram" width="600"/>
67
+ <br>
68
+ <em>Figure 2: RGB Pixel Intensity Distribution highlighting warm-tone dominance.</em>
69
+ </div>
70
+
71
+ ### 2.4 Spatial Variance & The "Mean Image"
72
+ To identify structural patterns, we computed the mathematical "Mean Image" by averaging pixel arrays within specific classes (e.g., Bedrooms).
73
+ * **Insights:** The resulting images were highly amorphous and blurry, lacking distinct structural boundaries like beds or counters. This proves a high degree of spatial variance—rooms are photographed from vastly different angles and depths.
74
+ * **Conclusion:** This strictly validates our decision to use Deep Learning embeddings over traditional computer vision techniques; we need a model that detects *semantic objects*, regardless of where they are spatially located in the frame.
75
+
76
+ <div align="center">
77
+ <img src="REPLACE_THIS_WITH_IMAGE_LINK.png" alt="Mean Images by Room Type" width="800"/>
78
+ <br>
79
+ <em>Figure 3: Mean Image representation showing high spatial variance.</em>
80
+ </div>
81
+
82
+ ---
83
+
84
+ ## 🧠 3. Semantic Embeddings & Clustering Pipeline
85
+
86
+ We extracted a randomized, reproducible subset of 5,000 images (`seed=42`) to optimize computational efficiency while fully capturing the dataset's architectural diversity.
87
+
88
+ ### 3.1 Feature Extraction (CLIP)
89
+ We deployed Hugging Face's `openai/clip-vit-base-patch32`. Leveraging PyTorch (`torch.no_grad()`) and GPU acceleration, we processed the visual data through the transformer, extracting a highly dense **512-dimensional vector** for each image. These vectors capture complex stylistic signatures.
90
+
91
+ ### 3.2 Unsupervised K-Means Clustering
92
+ To test the quality of these embeddings, we applied a K-Means clustering algorithm, explicitly instructing it to find 5 clusters (`n_clusters=5`) to mirror our 5 ground-truth room types.
93
+
94
+ ### 3.3 Dimensionality Reduction (t-SNE) & Coherence
95
+ Projecting 512 dimensions down to a 2D visual scatter plot via t-SNE yielded outstanding results. Rather than a chaotic cloud, the data formed highly cohesive "islands."
96
+
97
+ By cross-tabulating the generated clusters against actual room labels, distinct identities emerged:
98
+ * **Cluster 0 (The Bathroom Cluster):** Highly specialized, containing 706 Bathrooms and almost zero overlaps.
99
+ * **Cluster 1 (Kitchen & Dining):** A semantic overlap reflecting real-world open-concept architecture.
100
+ * **Cluster 4:** Dominated entirely by Living Rooms.
101
+ * **Clusters 2 & 3 (Soft-Furnishings):** A logical blending of Bedrooms and Living Rooms, driven by shared semantic textures (rugs, beds, upholstery).
102
+
103
+ <div align="center">
104
+ <img src="REPLACE_THIS_WITH_IMAGE_LINK.png" alt="t-SNE Scatter Plot" width="700"/>
105
+ <br>
106
+ <em>Figure 4: t-SNE 2D Projection showing distinct semantic clustering of 512D embeddings.</em>
107
+ </div>
108
+
109
+ <div align="center">
110
+ <img src="REPLACE_THIS_WITH_IMAGE_LINK.png" alt="Cross-Tabulation Matrix" width="600"/>
111
+ <br>
112
+ <em>Figure 5: Cross-tabulation proving alignment between unsupervised clusters and ground-truth labels.</em>
113
+ </div>
114
+
115
+ ---
116
+
117
+ ## 🚀 4. Recommendation Engine & Final Application
118
+
119
+ The highly coherent 512D matrix was exported as an optimized `.parquet` file to serve as the brain of our production recommendation engine.
120
+
121
+ ### System Architecture:
122
+ 1. **Input Processing:** When a user interacts with the Gradio UI—either by uploading an inspiration photo or typing a conceptual text prompt—the system passes the input through the CLIP processor, translating it into the exact mathematical vector space as our database.
123
+ 2. **Cosine Similarity:** The engine measures the geometric angle between the user's vector and the 5,000 vectors in our catalog.
124
+ 3. **Top-K Retrieval:** The algorithm ranks the closest spatial matches and retrieves the top 3 results alongside their exact confidence scores.
125
+
126
+ <div align="center">
127
+ <img src="REPLACE_THIS_WITH_IMAGE_LINK.png" alt="Recommendation Engine Results" width="900"/>
128
+ <br>
129
+ <em>Figure 6: System successfully matching a textual/visual input to real-world interior designs.</em>
130
+ </div>
131
+
132
+ ### 🎯 Final Verdict
133
+ Testing the complete pipeline confirmed that the system does not simply match raw colors. It successfully extracts and matches abstract architectural concepts and stylistic intent. The backend logic proved highly reliable and was successfully deployed as a fully interactive Hugging Face Space frontend application.