Skip to content

Commit

Permalink
peer reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
wahabk committed Jan 27, 2025
1 parent 1d7b549 commit d559e8e
Show file tree
Hide file tree
Showing 11 changed files with 132 additions and 24 deletions.
Binary file added output/Paper/figMetricsSim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified output/Paper/figPR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 17 additions & 17 deletions output/Paper/figPR.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/Paper/figSchematic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 96 additions & 0 deletions output/Paper/figSchematic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified output/Paper/unet_att_log_1170.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified output/Paper/unet_log_1161.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified output/Paper/unet_tp_1160.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified output/figs/metrics_on_sim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion scripts/Paper/pr_figs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,20 @@ def add_model(this_df, this_axs, i, p, y="tp_precision", marker="r"):

def plot_pr(losses:pd.DataFrame, title="str"):
plot_params = ['volfrac', 'snr', 'cnr', 'particle_size', 'brightness', 'r']
titles = ['Density $\phi$', 'SNR', 'CNR', 'Size ($\mu m$)', '$f_\mu$ (0-255)', 'Radius (pxls)']
titles = ['Density $\phi$', 'SNR', 'CNR', 'Size ($\mu m$)', r'$f_{\bar{x}}$ (0-255)', 'Radius (pxls)']
xticks = [
[0.1, 0.25, 0.4, 0.55],
[0, 1, 5, 10],
[0, 1, 5, 10],
[0.1, 0.5, 1],
[0, 125, 255],
[4, 9, 14],
]

fig,axs = plt.subplots(2,len(plot_params), sharey=True)
plt.tight_layout(pad=0)

# Plot precision row
this_axs = axs[0,:].flatten()
for i, p in enumerate(plot_params):
this_df = losses[losses['type'].isin([p])]
Expand All @@ -49,8 +58,10 @@ def plot_pr(losses:pd.DataFrame, title="str"):
this_axs[i].set_ylabel("Precision", fontsize='large')
this_axs[i].set_yticks([0,0.25,0.5,0.75,1])
this_axs[i].set_ylim(-0.1,1.1)
if i == 5:
this_axs[i].legend(["TP", "U-net"])

# Plot recall row
this_axs = axs[1,:].flatten()
for i, p in enumerate(plot_params):
this_df = losses[losses['type'].isin([p])]
Expand All @@ -62,6 +73,7 @@ def plot_pr(losses:pd.DataFrame, title="str"):
this_axs[i].scatter(x=p, y = 'tp_recall', data=this_df, color='black', marker='<', alpha=0.5)
this_axs[i].scatter(x=p, y = 'recall', data=this_df, color='red', marker='>', alpha=0.5)
this_axs[i].set_xlabel(titles[i], fontsize='large')
this_axs[i].set_xticks(xticks[i])
if i == 0:
this_axs[i].set_ylabel("Recall", fontsize='large')

Expand Down
12 changes: 6 additions & 6 deletions scripts/figs/ap_on_sim.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from sklearn.inspection import plot_partial_dependence
from colloidoscope import DeepColloid
from colloidoscope.hoomd_sim_positions import read_gsd, convert_hoomd_positions
from colloidoscope.simulator import crop_positions_for_label
Expand All @@ -17,9 +16,10 @@


if __name__ == '__main__':
dataset_path = '/mnt/scratch/ak18001/Colloids/'
# dataset_path = '/mnt/scratch/ak18001/Colloids/'
# dataset_path = '/home/ak18001/Data/HDD/Colloids'
# dataset_path = '/home/wahab/Data/HDD/Colloids'
dataset_path = '/home/wahab/data/Colloids'
# dataset_path = '/mnt/storage/home/ak18001/scratch/Colloids'
dc = DeepColloid(dataset_path)

Expand All @@ -44,7 +44,7 @@
pred_pos = true_pos

ap, precisions, recalls, thresholds = dc.average_precision(true_pos, pred_pos, diameters=diameters)
dc.plot_pr(ap, precisions, recalls, thresholds, name='True', tag='o-', color='black', axs=axs[0,0], title='True positions')
dc.plot_pr(ap, precisions, recalls, thresholds, name='True', tag='o-', color='black', axs=axs[0,0], title='A - True positions')
# ap, precisions, recalls, thresholds = dc.average_precision(true_pos, pred_pos, diameters=diameters)
# fig = dc.plot_pr(ap, precisions, recalls, thresholds, name='Prediction', tag='x-', color='gray', axs=axs[0,0])
x, y = dc.get_gr(pred_pos, 100, 100)
Expand All @@ -55,7 +55,7 @@
pred_pos = true_pos[:len(true_pos)//2]

ap, precisions, recalls, thresholds = dc.average_precision(true_pos, pred_pos, diameters=diameters)
dc.plot_pr(ap, precisions, recalls, thresholds, name='Pred', tag='o-', color='red', axs=axs[0,1], title='Half missing')
dc.plot_pr(ap, precisions, recalls, thresholds, name='Pred', tag='o-', color='red', axs=axs[0,1], title='B - Half missing')
x, y = dc.get_gr(pred_pos, 100, 100)
dc.plot_gr(x, y, diameter, label=f'Pred', color='red', axs=axs[1,1])

Expand All @@ -71,7 +71,7 @@
pred_pos = np.concatenate([pred_pos, anomalies], axis=0)

ap, precisions, recalls, thresholds = dc.average_precision(true_pos, pred_pos, diameters=diameters)
dc.plot_pr(ap, precisions, recalls, thresholds, name='Pred', tag='o-', color='green', axs=axs[0,2], title='Half added')
dc.plot_pr(ap, precisions, recalls, thresholds, name='Pred', tag='o-', color='green', axs=axs[0,2], title='C - Half added')
x, y = dc.get_gr(pred_pos, 100, 100)
dc.plot_gr(x, y, diameter, label=f'Pred', color='green', axs=axs[1,2])

Expand All @@ -86,7 +86,7 @@
pred_pos = np.concatenate([pred_pos, anomalies], axis=0)

ap, precisions, recalls, thresholds = dc.average_precision(true_pos, pred_pos, diameters=diameters)
dc.plot_pr(ap, precisions, recalls, thresholds, name='Pred', tag='o-', color='blue', axs=axs[0,3], title='Half missing/added')
dc.plot_pr(ap, precisions, recalls, thresholds, name='Pred', tag='o-', color='blue', axs=axs[0,3], title='D - Half missing/added')
x, y = dc.get_gr(pred_pos, 100, 100)
dc.plot_gr(x, y, diameter, label=f'Pred', color='blue', axs=axs[1,3])

Expand Down

0 comments on commit d559e8e

Please sign in to comment.