Spaces:
Running
Running
Create readme.txt
Browse files
my_model/utilities/readme.txt
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Directory Overview
|
2 |
+
|
3 |
+
This directory contains two essential files for the overall project as well as the demo application:
|
4 |
+
|
5 |
+
1. General Utilities Module
|
6 |
+
|
7 |
+
This module provides a collection of utility functions and classes commonly used across various parts of the application. These utilities include functions for displaying images, checking the runtime environment, generating paths, and managing GPU resources.
|
8 |
+
|
9 |
+
Functions:
|
10 |
+
- show_image(image): Display an image in various environments.
|
11 |
+
- show_image_with_matplotlib(image): Display an image using Matplotlib.
|
12 |
+
- is_jupyter_notebook() -> bool: Check if the code is running in a Jupyter notebook.
|
13 |
+
- is_pycharm() -> bool: Check if the code is running in PyCharm.
|
14 |
+
- is_google_colab() -> bool: Check if the code is running in Google Colab.
|
15 |
+
- get_image_path(name, path_type) -> str: Generate a path for models, images, or data based on the specified type.
|
16 |
+
- get_model_path(model_name) -> str: Get the path to the specified model folder.
|
17 |
+
- add_detected_objects_to_dataframe(df, detector_type, image_directory, detector) -> pd.DataFrame: Add a column to the DataFrame with detected objects for each image.
|
18 |
+
- free_gpu_resources() -> None: Clear GPU memory.
|
19 |
+
|
20 |
+
Notes:
|
21 |
+
- Ensure the required packages are installed (`numpy`, `torch`, `PIL`, `matplotlib`, `pandas`, `IPython`, `sys`).
|
22 |
+
- Supports various image formats (file paths, PIL Images, numpy arrays, PyTorch tensors).
|
23 |
+
- add_detected_objects_to_dataframe assumes an appropriate object detector is provided and configured.
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
2. UI Manager
|
28 |
+
|
29 |
+
The UIManager class manages the user interface for the Streamlit application, handling the creation and navigation of various tabs.
|
30 |
+
|
31 |
+
Class Overview:
|
32 |
+
- UIManager: Manages the Streamlit app UI.
|
33 |
+
- __init__(): Initializes the UIManager with predefined tabs.
|
34 |
+
- add_tab(tab_name: str, display_function: callable) -> None: Adds a new tab to the UI.
|
35 |
+
- display_sidebar() -> str: Displays the sidebar for navigation.
|
36 |
+
- display_selected_page(selection: str) -> None: Displays the selected page based on the user's choice.
|
37 |
+
- display_home() -> None: Displays the Home page.
|
38 |
+
- display_dataset_analysis() -> None: Displays the Dataset Analysis page.
|
39 |
+
- display_results() -> None: Displays the Results page.
|
40 |
+
- display_model_arch() -> None: Displays the Model Architecture page.
|
41 |
+
- display_run_inference() -> None: Displays the Run Inference page.
|
42 |
+
- display_dissertation_report() -> None: Displays the Dissertation Report page.
|
43 |
+
- display_code() -> None: Displays the Code page.
|
44 |
+
- display_placeholder() -> None: Displays a placeholder for future content.
|
45 |
+
|
46 |
+
|
47 |
+
Notes:
|
48 |
+
- The UIManager class facilitates the navigation and rendering of different tabs in the Streamlit app.
|
49 |
+
- Customize and extend the UI by adding new tabs with `add_tab`.
|