ludusc commited on
Commit
f2b3196
1 Parent(s): def48ab

labels no id or unnamed

Browse files
pages/3_Oxford_Vases_Disentanglement.py CHANGED
@@ -54,9 +54,11 @@ with input_col_1:
54
  type_col = st.selectbox('Concept category:', tuple(['Provenance', 'Shape Name', 'Fabric', 'Technique']))
55
 
56
  ann_df = pd.read_csv(f'./data/vase_annotated_files/sim_{type_col}_seeds0000-20000.csv')
57
- labels = ann_df.columns
58
-
59
- concept_ids = st.multiselect('Concepts:', tuple(labels), max_selections=2, default=[labels[0], labels[1]])
 
 
60
 
61
  st.write('**Choose a latent space to disentangle**')
62
  space_id = st.selectbox('Space:', tuple(['W', 'Z']))
@@ -93,7 +95,7 @@ smoothgrad_col_1, smoothgrad_col_2, smoothgrad_col_3, smoothgrad_col_4, smoothgr
93
 
94
  # ---------------------------- DISPLAY COL 1 ROW 1 ------------------------------
95
  with output_col_1:
96
- separation_vector, number_important_features, imp_nodes, performance = get_separation_space(concept_ids, annotations, ann_df, latent_space=st.session_state.space_id, samples=100)
97
  # st.write(f'Class ID {input_id} - {input_label}: {pred_prob*100:.3f}% confidence')
98
  st.write('Concept vector', separation_vector)
99
  header_col_1.write(f'Concept {st.session_state.concept_ids} - Space {st.session_state.space_id} - Number of relevant nodes: {number_important_features} - Val classification performance: {performance}')# - Nodes {",".join(list(imp_nodes))}')
@@ -146,8 +148,8 @@ else:
146
  original_image_vec = annotations['w_vectors'][st.session_state.image_id]
147
 
148
  img = generate_original_image(original_image_vec, model, latent_space=st.session_state.space_id)
149
- cols = list(ann_df.columns)
150
- top_pred = ann_df.loc[st.session_state.image_id, cols].astype(float).idxmax()
151
  # input_image = original_image_dict['image']
152
  # input_label = original_image_dict['label']
153
  # input_id = original_image_dict['id']
 
54
  type_col = st.selectbox('Concept category:', tuple(['Provenance', 'Shape Name', 'Fabric', 'Technique']))
55
 
56
  ann_df = pd.read_csv(f'./data/vase_annotated_files/sim_{type_col}_seeds0000-20000.csv')
57
+ labels = list(ann_df.columns)
58
+ labels.remove('ID')
59
+ labels.remove('Unnamed: 0')
60
+
61
+ concept_ids = st.multiselect('Concepts:', tuple(labels), max_selections=2, default=[labels[2], labels[3]])
62
 
63
  st.write('**Choose a latent space to disentangle**')
64
  space_id = st.selectbox('Space:', tuple(['W', 'Z']))
 
95
 
96
  # ---------------------------- DISPLAY COL 1 ROW 1 ------------------------------
97
  with output_col_1:
98
+ separation_vector, number_important_features, imp_nodes, performance = get_separation_space(concept_ids, annotations, ann_df, latent_space=st.session_state.space_id, samples=150)
99
  # st.write(f'Class ID {input_id} - {input_label}: {pred_prob*100:.3f}% confidence')
100
  st.write('Concept vector', separation_vector)
101
  header_col_1.write(f'Concept {st.session_state.concept_ids} - Space {st.session_state.space_id} - Number of relevant nodes: {number_important_features} - Val classification performance: {performance}')# - Nodes {",".join(list(imp_nodes))}')
 
148
  original_image_vec = annotations['w_vectors'][st.session_state.image_id]
149
 
150
  img = generate_original_image(original_image_vec, model, latent_space=st.session_state.space_id)
151
+
152
+ top_pred = ann_df.loc[st.session_state.image_id, labels].astype(float).idxmax()
153
  # input_image = original_image_dict['image']
154
  # input_label = original_image_dict['label']
155
  # input_id = original_image_dict['id']