Spaces:
Sleeping
Sleeping
Update pages/Data Collection.py
Browse files- pages/Data Collection.py +56 -19
pages/Data Collection.py
CHANGED
|
@@ -493,34 +493,71 @@ def image_details_page():
|
|
| 493 |
- **Light Source**: Light from sources like the sun or a bulb hits an object.
|
| 494 |
- **Reflection**: Light bounces off the object's surface.
|
| 495 |
- **Capture**: The reflected light is recorded by a camera sensor or the human eye.
|
|
|
|
|
|
|
|
|
|
| 496 |
""")
|
| 497 |
|
| 498 |
subheading("Why is an Image Represented as a Grid?")
|
| 499 |
st.write("""
|
| 500 |
-
-
|
| 501 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 502 |
""")
|
| 503 |
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
subheading("1. Black and White")
|
| 507 |
-
st.write("""
|
| 508 |
-
- Represents two colors: **Black (0)** and **White (255)**.
|
| 509 |
-
- Used for simple image processing tasks where color isn't essential.
|
| 510 |
-
""")
|
| 511 |
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
- Preserves brightness details but loses color information.
|
| 516 |
-
""")
|
| 517 |
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
""")
|
| 523 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 524 |
# Basic Operations Section
|
| 525 |
elif page == "Basic Operations":
|
| 526 |
|
|
|
|
| 493 |
- **Light Source**: Light from sources like the sun or a bulb hits an object.
|
| 494 |
- **Reflection**: Light bounces off the object's surface.
|
| 495 |
- **Capture**: The reflected light is recorded by a camera sensor or the human eye.
|
| 496 |
+
- In images pixels are the **feautures** and these pixels contains **information** as shape,color,patterns.
|
| 497 |
+
- No of pixels = height*width these both decides the resolution.
|
| 498 |
+
- More no of pixels more clarity more information gained.
|
| 499 |
""")
|
| 500 |
|
| 501 |
subheading("Why is an Image Represented as a Grid?")
|
| 502 |
st.write("""
|
| 503 |
+
- Pixels in an image are arranged in a grid-like structure.
|
| 504 |
+
- Each **row** in the grid corresponds to a **data point** (a group of pixels).
|
| 505 |
+
- Each **column** in the grid represents a **feature** of those data points.
|
| 506 |
+
- Both image data and tabular data can be visualized as grids.
|
| 507 |
+
- This concept aligns with tabular data, where the structure is similar, but the interpretation differs:
|
| 508 |
+
- **In images**: Each row represents a set of data points (pixels), and the columns represent their features.
|
| 509 |
+
- **In tables**:Each row represents an individual data point, and each column corresponds to a feature of that data point.
|
| 510 |
""")
|
| 511 |
|
| 512 |
+
st.header("Color Spaces")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 513 |
|
| 514 |
+
# Explanation for Color Spaces
|
| 515 |
+
st.write("""
|
| 516 |
+
Color space is a technique used to represent the colors of an image. This technique helps us preserve the colors while converting them into numerical values, which machine learning models can understand.
|
|
|
|
|
|
|
| 517 |
|
| 518 |
+
For example, in image classification tasks like differentiating between dogs and cats:
|
| 519 |
+
- The first step is to collect a bunch of dog and cat images. These images may be in formats such as PNG, JPG, or JPEG.
|
| 520 |
+
- However, machine learning models can only understand numbers, so color spaces are used to convert the image colors into numerical representations.
|
| 521 |
+
""")
|
|
|
|
| 522 |
|
| 523 |
+
# Subheading for Black and White color space
|
| 524 |
+
st.subheader("1. Black and White")
|
| 525 |
+
st.write("""
|
| 526 |
+
- Represents only two colors: **Black (0)** and **White (255)**.
|
| 527 |
+
- Used for simple image processing tasks where color isn't essential.
|
| 528 |
+
- **Disadvantage**: It only preserves black and white, so other colors (like red, green, or brown) are completely lost.
|
| 529 |
+
- For example, by using the image's width and height (rows and columns), we can create a **2D array** where each pixel is represented by either 0 (black) or 255 (white).
|
| 530 |
+
- **Use case**: Binary classification problems like simple object detection, where only the presence or absence of a feature matters.
|
| 531 |
+
""")
|
| 532 |
+
|
| 533 |
+
# Subheading for Grayscale color space
|
| 534 |
+
st.subheader("2. Grayscale")
|
| 535 |
+
st.write("""
|
| 536 |
+
- Extends black and white to include **256 shades of gray**.
|
| 537 |
+
- Preserves brightness details but loses color information.
|
| 538 |
+
- **Disadvantage**: If the image has colors like red, green, or brown, it cannot preserve those since grayscale only represents shades of gray.
|
| 539 |
+
- After converting an image to grayscale, each pixel can take values from 0 (black) to 255 (white), with every intermediate value representing a shade of gray.
|
| 540 |
+
- **Use case**: Applications where only intensity (brightness) matters, like edge detection or certain medical imaging applications.
|
| 541 |
+
""")
|
| 542 |
+
|
| 543 |
+
# Subheading for RGB color space
|
| 544 |
+
st.subheader("3. RGB (Red, Green, Blue)")
|
| 545 |
+
st.write("""
|
| 546 |
+
- Combines three color channels: **Red**, **Green**, and **Blue**.
|
| 547 |
+
- Each channel can represent **256 shades** (0-255).
|
| 548 |
+
- By mixing different intensities of red, green, and blue, you can create over **16 million possible colors**.
|
| 549 |
+
- This is the most commonly used color space for colored images and is widely used in digital displays, cameras, and image processing tasks.
|
| 550 |
+
- In RGB color space, each pixel is represented by three values, one for each channel (Red, Green, Blue). The image is represented as a **3D array** where each pixel has three values (R, G, B).
|
| 551 |
+
- **Disadvantage**: It requires more data (3 values per pixel), which can be computationally intensive.
|
| 552 |
+
""")
|
| 553 |
+
|
| 554 |
+
# Connecting the concepts
|
| 555 |
+
st.subheader("Key Differences Between 2D and 3D Arrays in Color Spaces")
|
| 556 |
+
st.write("""
|
| 557 |
+
- **2D Arrays**: Used in Black and White or Grayscale color spaces. Each pixel is represented by a single value (black/white or a shade of gray).
|
| 558 |
+
- **3D Arrays**: Used in RGB color space, where each pixel is represented by three values (Red, Green, Blue), forming a 3D structure of the image.
|
| 559 |
+
""")
|
| 560 |
+
|
| 561 |
# Basic Operations Section
|
| 562 |
elif page == "Basic Operations":
|
| 563 |
|