File size: 6,781 Bytes
191195c
9167246
191195c
9167246
191195c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9167246
 
 
191195c
 
9167246
 
 
 
 
 
 
 
 
 
 
191195c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9167246
 
 
191195c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import streamlit as st 
import streamlit.components.v1 as components
import os  
# import cv2

ROOT_FIG_DIR = f'{os.getcwd()}/figures/'
def get_product_dev_page_layout():
    # st.title("Data Details")

    # st.write(
    #     """
    #     ##
    #     Examining data is the key factor here and it provides deta-centric approach to test any idea.
    #     """)

    # list_test = """<ul>
    #                     <li><strong>Target Group: </strong>Developer, Model Owners, Product Managers</li>
    #                 </ul>"""
    # st.markdown(list_test, unsafe_allow_html=True)
    # LAYING OUT THE MIDDLE SECTION OF THE APP WITH THE MAPS
    # row4_1, row4_2, row4_3 = st.columns((1,1,1))

    row4_1, row4_2, row4_3 = st.tabs(["Data Source Information", "Exploratory Data Stats", "Data Onboarding"])

    with row4_1:
        # st.write("**Data Source Info**")
        st.subheader('Data Source Information')
        # new_title = '<h4 style="color:Green;">Data set infor:</h4>'
        # st.markdown(new_title, unsafe_allow_html=True)
        # where the data comes and how it is collected, what the data includes, what are the details of the data, how the data is used.
        # answers four different questions
        st.write(" Data set consists of OCT images from CNV, DME, DRUSEN and NORMAL cases...(from 4686 adult patients) a")

        st.caption('Source')
        st.write("[Labeled Optical Coherence Tomography (OCT) and Chest X-Ray Images for Classification](https://data.mendeley.com/datasets/rscbjbr9sj/3)")

        with st.expander('Data Collection Details(Click for more info)'):
            st.write("""As stated OCT images are clloected from the Shiley Eye Institute of the University of California San Diego, 
            the California Retinal Research Foundation,
            Medical Center Ophthalmology Associates, the Shanghai First People’s Hospital, and Beijing Tongren Eye Center between
        July 1, 2013 and March 1, 2017.""")
        st.caption('Case Samples')
        # https://www.aao.org/eye-health/ask-ophthalmologist-q/choroidal-neovascularization-definition-treatment
        st.image('./figures/oct_details.png')

        list_test = """<ul>Case explanations:
                            <li><strong>CNV: </strong>t) choroidal neovascularization (CNV) with neovascular membrane (white arrowheads) and associated subretinal fluid (arrows</li>
                            <li> <strong style="color:Green;"><em>DRUSEN: </em></strong> Multiple drusen (arrowheads) present in early AMD</li>
                            <li><strong>DME: </strong>) Diabetic
    macular edema (DME) with retinal-thickening-associated intraretinal fluid</li>
                            <li>Normal</li>
                        </ul>"""
        st.markdown(list_test, unsafe_allow_html=True)

        
        st.caption('License:')
        with st.expander('License: CC BY 4.0 license'):
            st.write("""
                The files associated with this dataset are licensed under a Creative Commons Attribution 4.0 International license. What does this mean?
                You can share, copy and modify this dataset so long as you give appropriate credit, 
                provide a link to the CC BY license, and indicate if changes were made, but you may not do 
                so in a way that suggests the rights holder has endorsed you or your use of the dataset. 
                Note that further permission may be required for any content within the dataset 
                that is identified as belonging to a third party. More details about the licences can be found 
                [here](https://creativecommons.org/about/cclicenses/).
            """)

        # st.write("Open to be used for researh.")

    with row4_2:
        st.subheader('Exploratory Data Stats')
        with st.expander('Training Data Info'):
            HtmlFile = open(f'{ROOT_FIG_DIR}/train_set_report.html', 'r', encoding='utf-8')
            source_code = HtmlFile.read() 
            components.html(source_code,scrolling=True, height=500)

        with st.expander('Test Data Info'):
            HtmlFile = open(f'{ROOT_FIG_DIR}/test_set_report.html', 'r', encoding='utf-8')
            source_code = HtmlFile.read() 
            components.html(source_code,scrolling=True, height=500)
        
        with st.expander('Sample Visualization for each Category'):
            clss = st.selectbox('Select a category(class)', ["CNV","DME", "NORMAL", "DRUSEN"])
            img_path = f'{ROOT_FIG_DIR}/{clss}_samples.png'
            st.image(img_path)
            # HtmlFile = open(f'{ROOT_FIG_DIR}/test_set_report.html', 'r', encoding='utf-8')
            # source_code = HtmlFile.read() 
            # components.html(source_code,scrolling=True, height=500)

    with row4_3:
        # st.write("**Post Processesd Data Details**")
        st.subheader('Pre-Processing Details')
        st.write(
        """
        ##
        Since the training set has a problem of class imbalanced, we need to solve this issue. To do so, representative sampling strategy is used with hierarchical clustering. 
        """)
        # st.caption('')
        new_title = '<h5 style="color:Black;">Post Processing Steps:</h5>'
        st.markdown(new_title, unsafe_allow_html=True)
        code = '''def representative_sampling():
        for each_class in category_list:
            embeddings = get_resnet50_embeddings(each_class)
            n_cluster = run_hierarchical_clustering(embeddings)
            samples = get_representative_n_samples_within_each_cluster(n_cluster)'''
        st.code(code, language='python')

        with st.expander('Training Data Info after Representative Sampling'):
            HtmlFile = open(f'{ROOT_FIG_DIR}/filtered_set_report.html', 'r', encoding='utf-8')
            source_code = HtmlFile.read() 
            components.html(source_code,scrolling=True, height=500)
        st.write("Model Input Size Resizing: 180x180x3")
        # st.caption('Post Processing Steps:')
        # code = '''def representative_sampling():
        #     ...     for class_i in category_list:
        #     ...         print("Hello, Streamlit!")'''
        # st.code(code, language='python')
        # st.code('for class_i in category_list: hiearhical_cluster(class_i)')


def get_developer_page_layout():
    st.header("Developer")

    markdown = """
    1. For the [GitHub repository](https://github.com/giswqs/streamlit-multipage-template) or [use it as a template](https://github.com/giswqs/streamlit-multipage-template/generate) for your own project.
    2. Customize the sidebar by changing the sidebar text and logo in each Python files.
    3. Find your favorite emoji from https://emojipedia.org.
    """

    st.markdown(markdown)