Spaces:
Build error
Build error
Update pages/LIFE_CYCLE_OF_MACHINE_LEARNING.py
Browse files
pages/LIFE_CYCLE_OF_MACHINE_LEARNING.py
CHANGED
|
@@ -147,44 +147,50 @@ def unstructured_data_page():
|
|
| 147 |
- Social media posts
|
| 148 |
""")
|
| 149 |
|
| 150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
st.header("🖼️ Handling Image Data")
|
| 152 |
st.markdown("""
|
| 153 |
Image data can be processed using libraries like OpenCV and PIL (Pillow). Images often need to be preprocessed for tasks like analysis, classification, or feature extraction. Common operations include:
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
|
|
|
| 161 |
|
| 162 |
st.code("""
|
| 163 |
from PIL import Image
|
| 164 |
import numpy as np
|
| 165 |
import matplotlib.pyplot as plt
|
| 166 |
|
| 167 |
-
|
| 168 |
image = Image.open('sample_image.jpg')
|
| 169 |
image.show()
|
| 170 |
|
| 171 |
-
|
| 172 |
gray_image = image.convert('L')
|
| 173 |
gray_image.show()
|
| 174 |
|
| 175 |
-
|
| 176 |
resized_image = image.resize((200, 200))
|
| 177 |
resized_image.show()
|
| 178 |
|
| 179 |
-
|
| 180 |
rotated_image = image.rotate(90)
|
| 181 |
rotated_image.show()
|
| 182 |
|
| 183 |
-
|
| 184 |
image_array = np.array(image)
|
| 185 |
print(image_array.shape)
|
| 186 |
-
|
| 187 |
-
# Display the image array as a plot
|
| 188 |
plt.imshow(image)
|
| 189 |
plt.title("Original Image")
|
| 190 |
plt.axis('off')
|
|
@@ -192,32 +198,31 @@ plt.show()
|
|
| 192 |
""", language='python')
|
| 193 |
|
| 194 |
st.markdown("""
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
|
|
|
| 202 |
|
| 203 |
### Challenges and Solutions Section
|
| 204 |
st.markdown("### Challenges with Unstructured Data")
|
| 205 |
st.write("""
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
|
|
|
| 210 |
|
| 211 |
st.markdown("### Solutions")
|
| 212 |
st.write("""
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
# Button to Navigate to Introduction to Image
|
| 219 |
-
if st.button("Introduction to Image"):
|
| 220 |
-
st.session_state.page = "introduction_to_image"
|
| 221 |
|
| 222 |
# Navigation Button
|
| 223 |
if st.button("Back to Data Collection"):
|
|
|
|
| 147 |
- Social media posts
|
| 148 |
""")
|
| 149 |
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
# Button to Navigate to Introduction to Image
|
| 153 |
+
if st.button("Introduction to Image"):
|
| 154 |
+
st.session_state.page = "introduction_to_image"
|
| 155 |
+
|
| 156 |
+
###Handling Image Data Section
|
| 157 |
st.header("🖼️ Handling Image Data")
|
| 158 |
st.markdown("""
|
| 159 |
Image data can be processed using libraries like OpenCV and PIL (Pillow). Images often need to be preprocessed for tasks like analysis, classification, or feature extraction. Common operations include:
|
| 160 |
+
|
| 161 |
+
Reading and displaying images
|
| 162 |
+
Converting to grayscale
|
| 163 |
+
Resizing and cropping
|
| 164 |
+
Rotating and flipping
|
| 165 |
+
Applying filters
|
| 166 |
+
Edge detection and other transformations
|
| 167 |
+
""")
|
| 168 |
|
| 169 |
st.code("""
|
| 170 |
from PIL import Image
|
| 171 |
import numpy as np
|
| 172 |
import matplotlib.pyplot as plt
|
| 173 |
|
| 174 |
+
Open an image file
|
| 175 |
image = Image.open('sample_image.jpg')
|
| 176 |
image.show()
|
| 177 |
|
| 178 |
+
Convert image to grayscale
|
| 179 |
gray_image = image.convert('L')
|
| 180 |
gray_image.show()
|
| 181 |
|
| 182 |
+
Resize the image
|
| 183 |
resized_image = image.resize((200, 200))
|
| 184 |
resized_image.show()
|
| 185 |
|
| 186 |
+
Rotate the image by 90 degrees
|
| 187 |
rotated_image = image.rotate(90)
|
| 188 |
rotated_image.show()
|
| 189 |
|
| 190 |
+
Convert the image to a NumPy array and display its shape
|
| 191 |
image_array = np.array(image)
|
| 192 |
print(image_array.shape)
|
| 193 |
+
Display the image array as a plot
|
|
|
|
| 194 |
plt.imshow(image)
|
| 195 |
plt.title("Original Image")
|
| 196 |
plt.axis('off')
|
|
|
|
| 198 |
""", language='python')
|
| 199 |
|
| 200 |
st.markdown("""
|
| 201 |
+
Common Image Processing Techniques:
|
| 202 |
+
|
| 203 |
+
Resizing: Adjust the dimensions of an image for uniformity in models.
|
| 204 |
+
Cropping: Extract a region of interest (ROI) from an image.
|
| 205 |
+
Grayscale Conversion: Simplify image data by reducing it to a single channel.
|
| 206 |
+
Rotation/Flipping: Perform augmentations to increase the dataset for model training.
|
| 207 |
+
Edge Detection: Identify edges in images using filters like the Sobel or Canny filters.
|
| 208 |
+
""")
|
| 209 |
|
| 210 |
### Challenges and Solutions Section
|
| 211 |
st.markdown("### Challenges with Unstructured Data")
|
| 212 |
st.write("""
|
| 213 |
+
|
| 214 |
+
Noise and Inconsistency: Data is often incomplete or noisy.
|
| 215 |
+
Storage Requirements: Large size and variability in data types.
|
| 216 |
+
Processing Time: Analyzing unstructured data is computationally expensive.
|
| 217 |
+
""")
|
| 218 |
|
| 219 |
st.markdown("### Solutions")
|
| 220 |
st.write("""
|
| 221 |
+
|
| 222 |
+
Data Cleaning: Preprocess data to remove noise.
|
| 223 |
+
Efficient Storage: Use NoSQL databases (e.g., MongoDB) or cloud storage.
|
| 224 |
+
Parallel Processing: Utilize frameworks like Apache Spark.
|
| 225 |
+
""")
|
|
|
|
|
|
|
|
|
|
| 226 |
|
| 227 |
# Navigation Button
|
| 228 |
if st.button("Back to Data Collection"):
|