sree4411 commited on
Commit
e4f9064
·
verified ·
1 Parent(s): 71982b5

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 +104 -44
pages/3_Life Cycle Of ML Project.py CHANGED
@@ -133,56 +133,116 @@ elif st.session_state.page == "unstructured_data":
133
  - Audio files (e.g., .mp3, .wav)
134
  """)
135
 
136
- st.header("📄 Handling Text Data")
137
- st.markdown("""
138
- Text data can be analyzed using Natural Language Processing (NLP) techniques.
139
- """)
140
- st.code("""
141
  # Reading text data
142
- with open('sample.txt', 'r') as file:
143
- text = file.read()
144
- print(text)
145
  # Basic text processing using NLTK
146
- import nltk
147
- from nltk.tokenize import word_tokenize
148
- nltk.download('punkt')
149
- tokens = word_tokenize(text)
150
- print(tokens)
151
- """, language='python')
152
-
153
-
154
- st.header("🎥 Handling Video Data")
155
- st.markdown("""
156
- Videos can be processed frame by frame using OpenCV.
157
- """)
158
- st.code("""
159
- import cv2
160
  # Capture video
161
- video = cv2.VideoCapture('sample_video.mp4')
162
- while video.isOpened():
163
- ret, frame = video.read()
164
- if not ret:
165
- break
166
- cv2.imshow('Frame', frame)
167
- if cv2.waitKey(1) & 0xFF == ord('q'):
168
- break
169
- video.release()
170
- cv2.destroyAllWindows()
171
- """, language='python')
172
 
173
- st.header("🖼️ Handling Image Data")
174
- st.markdown("""
175
- Image data can be processed using libraries like OpenCV and PIL (Pillow).
176
- """)
177
- st.code("""
178
- from PIL import Image
179
  # Open an image file
180
- image = Image.open('sample_image.jpg')
181
- image.show()
182
  # Convert image to grayscale
183
- gray_image = image.convert('L')
184
- gray_image.show()
185
- """, language='python')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
 
187
  if st.button(":red[Back to Data Collection]"):
188
  st.session_state.page = "data_collection"
 
133
  - Audio files (e.g., .mp3, .wav)
134
  """)
135
 
136
+ #st.header("📄 Handling Text Data")
137
+ # st.markdown("""
138
+ # Text data can be analyzed using Natural Language Processing (NLP) techniques.
139
+ # st.code("""
 
140
  # Reading text data
141
+ #with open('sample.txt', 'r') as file:
142
+ # text = file.read()
143
+ # print(text)
144
  # Basic text processing using NLTK
145
+ #import nltk
146
+ #from nltk.tokenize import word_tokenize
147
+ ##print(tokens)
148
+ # """, language='python')
149
+
150
+
151
+ # st.header("🎥 Handling Video Data")
152
+ # st.markdown("""
153
+ # Videos can be processed frame by frame using OpenCV.
154
+ # """)
155
+ # st.code("""
156
+ #import cv2
 
 
157
  # Capture video
158
+ #video = cv2.VideoCapture('sample_video.mp4')
159
+ #while video.isOpened():
160
+ #ret, frame = video.read()
161
+ #if not ret:
162
+ # break
163
+ #cv2.imshow('Frame', frame)
164
+ #if cv2.waitKey(1) & 0xFF == ord('q'):
165
+ # break
166
+ #video.release()
167
+ #cv2.destroyAllWindows()
168
+ #""", language='python')
169
 
170
+ # st.header("🖼️ Handling Image Data")
171
+ # st.markdown("""
172
+ # Image data can be processed using libraries like OpenCV and PIL (Pillow).
173
+ #""")
174
+ # st.code("""
175
+ #from PIL import Image
176
  # Open an image file
177
+ #image = Image.open('sample_image.jpg')
178
+ #image.show()
179
  # Convert image to grayscale
180
+ #gray_image = image.convert('L')
181
+ #gray_image.show()
182
+ # """, language='python')
183
+
184
+ if st.button("Introduction to Image"):
185
+ st.session_state.page = "introduction_to_image"
186
+ # ----------------- Introduction to Image -----------------
187
+ def introduction_to_image_page():
188
+ st.header("🖼️ What is Image")
189
+ st.markdown(""" An image is a two-dimensional visual representation of objects, people, scenes, or concepts.
190
+ It can be captured using devices like cameras, scanners, or created digitally.
191
+ Images are composed of individual units called pixels, which contain information about brightness and color.
192
+ **Types of Images:** - **Raster Images (Bitmap)**: Composed of a grid of pixels.
193
+ Common formats include: - JPEG
194
+ - PNG
195
+ - GIF
196
+ - **Vector Images**: Defined by mathematical equations and geometric shapes like lines and curves.
197
+ Common format:
198
+ - SVG (Scalable Vector Graphics)
199
+ - **3D Images**: Represent objects or scenes in three dimensions, often used for rendering and modeling.
200
+ **Image Representation:**
201
+ - **Grayscale Image**: Each pixel has a single intensity value, typically ranging from 0 (black) to 255 (white), representing different shades of gray.
202
+ - **Color Image**: Usually represented in the RGB color space, where each pixel consists of three values indicating the intensity of Red, Green, and Blue.
203
+ **Applications of Images:**
204
+ - **Photography & Visual Media**: Capturing moments and storytelling.
205
+ - **Medical Imaging**: Diagnosing conditions using X-rays, MRIs, etc.
206
+ - **Machine Learning & AI**: Tasks like image classification, object detection, and facial recognition.
207
+ - **Remote Sensing**: Analyzing geographic and environmental data using satellite imagery.
208
+ - **Graphic Design & Art**: Creating creative visual content for marketing and design. """)
209
+ st.code(""" from PIL import Image import numpy as np import matplotlib.pyplot as plt
210
+ # Open an image file
211
+ image = Image.open('sample_image.jpg')
212
+ image.show()
213
+ # Convert image to grayscale
214
+ gray_image = image.convert('L')
215
+ gray_image.show()
216
+ # Resize the image
217
+ resized_image = image.resize((200, 200))
218
+ resized_image.show()
219
+ # Rotate the image by 90 degrees
220
+ rotated_image = image.rotate(90) r
221
+ otated_image.show()
222
+ # Convert the image to a NumPy array and display its shape
223
+ image_array = np.array(image)
224
+ print(image_array.shape)
225
+ # Display the image array as a plot
226
+ plt.imshow(image)
227
+ plt.title("Original Image")
228
+ plt.axis('off')
229
+ plt.show() """, language='python')
230
+ st.header("Color Spaces in Machine Learning")
231
+ st.markdown(""" A color space is a mathematical model for representing colors.
232
+ In machine learning, different color spaces can be used for preprocessing and analyzing image data, depending on the task.
233
+ **Common Color Spaces:**
234
+ - **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.
235
+ - **Use Cases**: Image classification, general-purpose image analysis.
236
+ - **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.
237
+ - **Use Cases**: Color-based object detection, image segmentation, color tracking.
238
+ - **CMYK (Cyan, Magenta, Yellow, Black)**: Primarily used for printing, not commonly used in machine learning, but useful for preparing images for printers.
239
+ - **Use Cases**: Printing applications.
240
+ - **LAB (Lightness, A, B)**: Designed to be perceptually uniform, meaning that the perceptual difference between colors is consistent across the space.
241
+ - **Use Cases**: Color correction, image processing tasks requiring color consistency. """)
242
+ # Button to Navigate to Operations Using OpenCV
243
+ if st.button("Operations Using OpenCV"):
244
+ st.session_state.page = "operations_using_opencv"
245
+ # Navigation Button
246
 
247
  if st.button(":red[Back to Data Collection]"):
248
  st.session_state.page = "data_collection"