sree4411 commited on
Commit
e39f19d
·
verified ·
1 Parent(s): dcf4d90

Update pages/3_Life Cycle Of ML Project.py

Browse files
Files changed (1) hide show
  1. pages/3_Life Cycle Of ML Project.py +33 -18
pages/3_Life Cycle Of ML Project.py CHANGED
@@ -186,48 +186,59 @@ elif st.session_state.page == "unstructured_data":
186
  st.session_state.page = "introduction_to_image"
187
 
188
  # ----------------- Introduction to Image -----------------
 
189
  elif st.session_state.page == "Introduction_to_image":
190
- st.header("🖼️ What is Image")
191
  st.markdown("""
192
- ###: What is an image?\nAn image is a two-dimensional visual representation of objects, people, scenes, or concepts. It can be captured using devices like cameras, scanners, or created digitally. Images are composed of individual units called pixels, which contain information about brightness and color.
193
- Types of Images:
 
 
194
  - **Raster Images (Bitmap)**: Composed of a grid of pixels. Common formats include:
195
- - JPEG
196
- - PNG
197
- - GIF
198
- - **Vector Images**: Defined by mathematical equations and geometric shapes like lines and curves. Common format:
199
- - SVG (Scalable Vector Graphics)
200
  - **3D Images**: Represent objects or scenes in three dimensions, often used for rendering and modeling.
201
- Image Representation:
 
202
  - **Grayscale Image**: Each pixel has a single intensity value, typically ranging from 0 (black) to 255 (white), representing different shades of gray.
203
  - **Color Image**: Usually represented in the RGB color space, where each pixel consists of three values indicating the intensity of Red, Green, and Blue.
204
- Applications of Images:
 
205
  - **Photography & Visual Media**: Capturing moments and storytelling.
206
  - **Medical Imaging**: Diagnosing conditions using X-rays, MRIs, etc.
207
  - **Machine Learning & AI**: Tasks like image classification, object detection, and facial recognition.
208
  - **Remote Sensing**: Analyzing geographic and environmental data using satellite imagery.
209
- - **Graphic Design & Art**: Creating creative visual content for marketing and design.
210
- """)
211
 
212
  st.code("""
213
  from PIL import Image
214
  import numpy as np
215
  import matplotlib.pyplot as plt
 
216
  # Open an image file
217
  image = Image.open('sample_image.jpg')
218
  image.show()
 
219
  # Convert image to grayscale
220
  gray_image = image.convert('L')
221
  gray_image.show()
 
222
  # Resize the image
223
  resized_image = image.resize((200, 200))
224
  resized_image.show()
 
225
  # Rotate the image by 90 degrees
226
  rotated_image = image.rotate(90)
227
  rotated_image.show()
 
228
  # Convert the image to a NumPy array and display its shape
229
  image_array = np.array(image)
230
  print(image_array.shape)
 
231
  # Display the image array as a plot
232
  plt.imshow(image)
233
  plt.title("Original Image")
@@ -238,7 +249,8 @@ elif st.session_state.page == "Introduction_to_image":
238
  st.header("Color Spaces in Machine Learning")
239
  st.markdown("""
240
  A color space is a mathematical model for representing colors. In machine learning, different color spaces can be used for preprocessing and analyzing image data, depending on the task.
241
- Common Color Spaces:
 
242
  - **RGB (Red, Green, Blue)**: The most common color space for digital images. Each pixel is represented by a combination of three values corresponding to the red, green, and blue channels.
243
  - **Use Cases**: Image classification, general-purpose image analysis.
244
  - **HSV (Hue, Saturation, Value)**: Separates color information (hue) from intensity (value), making it useful for tasks where distinguishing between color variations and intensity is important.
@@ -249,13 +261,16 @@ elif st.session_state.page == "Introduction_to_image":
249
  - **Use Cases**: Color correction, image processing tasks requiring color consistency.
250
  """)
251
 
252
- # Button to Navigate to Operations Using OpenCV
253
- if st.button("Operations Using OpenCV"):
 
 
254
  st.session_state.page = "operations_using_opencv"
255
 
256
- # Navigation Button
257
- if st.button("Back to Data Collection"):
258
- st.session_state.page = "data_collection"
 
259
 
260
  # ---------- OPERATIONS USING OPENCV --------------------------------
261
 
 
186
  st.session_state.page = "introduction_to_image"
187
 
188
  # ----------------- Introduction to Image -----------------
189
+
190
  elif st.session_state.page == "Introduction_to_image":
191
+ st.header("🖼️ What is an Image?")
192
  st.markdown("""
193
+ ### What is an Image?
194
+ An image is a two-dimensional visual representation of objects, people, scenes, or concepts. It can be captured using devices like cameras or scanners, or created digitally. Images are composed of individual units called pixels, which contain information about brightness and color.
195
+
196
+ #### Types of Images:
197
  - **Raster Images (Bitmap)**: Composed of a grid of pixels. Common formats include:
198
+ - JPEG
199
+ - PNG
200
+ - GIF
201
+ - **Vector Images**: Defined by mathematical equations and geometric shapes (like lines and curves). Common format:
202
+ - SVG (Scalable Vector Graphics)
203
  - **3D Images**: Represent objects or scenes in three dimensions, often used for rendering and modeling.
204
+
205
+ #### Image Representation:
206
  - **Grayscale Image**: Each pixel has a single intensity value, typically ranging from 0 (black) to 255 (white), representing different shades of gray.
207
  - **Color Image**: Usually represented in the RGB color space, where each pixel consists of three values indicating the intensity of Red, Green, and Blue.
208
+
209
+ #### Applications of Images:
210
  - **Photography & Visual Media**: Capturing moments and storytelling.
211
  - **Medical Imaging**: Diagnosing conditions using X-rays, MRIs, etc.
212
  - **Machine Learning & AI**: Tasks like image classification, object detection, and facial recognition.
213
  - **Remote Sensing**: Analyzing geographic and environmental data using satellite imagery.
214
+ - **Graphic Design & Art**: Creating visual content for marketing and design.
215
+ """)
216
 
217
  st.code("""
218
  from PIL import Image
219
  import numpy as np
220
  import matplotlib.pyplot as plt
221
+
222
  # Open an image file
223
  image = Image.open('sample_image.jpg')
224
  image.show()
225
+
226
  # Convert image to grayscale
227
  gray_image = image.convert('L')
228
  gray_image.show()
229
+
230
  # Resize the image
231
  resized_image = image.resize((200, 200))
232
  resized_image.show()
233
+
234
  # Rotate the image by 90 degrees
235
  rotated_image = image.rotate(90)
236
  rotated_image.show()
237
+
238
  # Convert the image to a NumPy array and display its shape
239
  image_array = np.array(image)
240
  print(image_array.shape)
241
+
242
  # Display the image array as a plot
243
  plt.imshow(image)
244
  plt.title("Original Image")
 
249
  st.header("Color Spaces in Machine Learning")
250
  st.markdown("""
251
  A color space is a mathematical model for representing colors. In machine learning, different color spaces can be used for preprocessing and analyzing image data, depending on the task.
252
+
253
+ #### Common Color Spaces:
254
  - **RGB (Red, Green, Blue)**: The most common color space for digital images. Each pixel is represented by a combination of three values corresponding to the red, green, and blue channels.
255
  - **Use Cases**: Image classification, general-purpose image analysis.
256
  - **HSV (Hue, Saturation, Value)**: Separates color information (hue) from intensity (value), making it useful for tasks where distinguishing between color variations and intensity is important.
 
261
  - **Use Cases**: Color correction, image processing tasks requiring color consistency.
262
  """)
263
 
264
+
265
+
266
+ # Button to Navigate to Operations Using OpenCV
267
+ if st.button("Operations Using OpenCV"):
268
  st.session_state.page = "operations_using_opencv"
269
 
270
+ # Button to Navigate Back to Data Collection
271
+ if st.button("Back to Data Collection"):
272
+ st.session_state.page = "data_collection"
273
+
274
 
275
  # ---------- OPERATIONS USING OPENCV --------------------------------
276