From 3eda77b1b3935314800f7a1adfd281792aa64a8c Mon Sep 17 00:00:00 2001 From: Diego Manzanas Date: Wed, 28 Aug 2024 17:10:00 -0500 Subject: [PATCH] Run experiments with correctly classified inputs only --- .../verification_adrenal_add_1_100.mat | Bin 648 -> 632 bytes .../results/verification_adrenal_add_1_50.mat | Bin 634 -> 610 bytes .../verification_adrenal_add_1_500.mat | Bin 631 -> 607 bytes .../Submission/WiP_3d/verify_adrenal.m | 22 ++++++++++++++---- .../Submission/WiP_3d/verify_fracture.m | 22 ++++++++++++++---- .../Submission/WiP_3d/verify_nodule.m | 22 ++++++++++++++---- .../examples/Submission/WiP_3d/verify_organ.m | 20 +++++++++++++--- .../Submission/WiP_3d/verify_synapse.m | 22 ++++++++++++++---- .../Submission/WiP_3d/verify_vessel.m | 22 ++++++++++++++---- 9 files changed, 107 insertions(+), 23 deletions(-) diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_add_1_100.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_add_1_100.mat index 2459cf1eb162c2a785158efce4a917068fd42d1b..46467e7d8e783c77ef84ae713d13db4d4f787c07 100644 GIT binary patch delta 503 zcmVCn)=5%3Z}cMs4#!FtY@Vu9kEIe+I4 z8vhh@Fx575)W6Q@;Qn`3;0zuihjwq{CZk<~4o_v;7Hnx0bm)J%f3M^2^FLeM%MNfl9E!@mr@j^#o*G4$T;~Wnr2lJQ t<<~3dplNzk*8u3BouS!#&QB3^NQ}~dsQs1G!P;;F&%F{s2LSeR)-0zH`|_??B#L@I)xSxS>KMEjd}eHp8Mb2@0BXx%ya9H)bTuw0!7qmYAqRB5{TA3=x8l%$nUg1YU+D((uh zd=qr|@tWmTv#^juT-+(H{`-Os$4iWwu75uebh!HD+{dz)oDQ`+?2C@A=5)9?|BcMf zC7ce@lli-ob_+U8|Kj*ylB|%!k-V3W8kTq2_bVwjbe-gMkPJESNOUcyLn)VUF3VLx zhuB2!?%7{B9T?vo?mmBy)8X1ZpO3No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91Z=2JuzU!P0kL3l| z-9F9fAah-6=`sf)hyU_tCM{JKa`=?XfBm5RE~kU!=`Y?#fbvi082`0HG48&^2l>eho;c4pRC_4`apN;dj4FJcc{Z&IfP|$*}o3^WOq9*qqCe2+0Skz#y;b8*mJJ!k8yK{z0|r) zOKqU|rj)*?u}?W24418vI_K75M}K+al(H>A`@bD&d356nr^BpPor5!g{$pGG_H*$& rP6zcDPt)?ga5^mbo*mxHCFC&6e8zO%H=GWt!i+O&fbIkUx?$4A&J6^A diff --git a/code/nnv/examples/Submission/WiP_3d/verify_adrenal.m b/code/nnv/examples/Submission/WiP_3d/verify_adrenal.m index de5e9f0fd..080897466 100644 --- a/code/nnv/examples/Submission/WiP_3d/verify_adrenal.m +++ b/code/nnv/examples/Submission/WiP_3d/verify_adrenal.m @@ -11,7 +11,7 @@ load(dataset); % data to verify (test set) -test_images = permute(test_images, [2 3 4 5 1]); +test_images = squeeze(permute(test_images, [2 3 4 5 1])); test_labels = test_labels + 1; % load network @@ -21,8 +21,22 @@ % select volumes to verify N = 50; -inputs = single(test_images(:,:,:,:,1:N)); -targets = single(test_labels(1:N)); +idxs = zeros(N,1); +count = 1; + +for i = 1:length(test_labels) + y = classify(matlabNet,test_images(:,:,:,i)); + if single(y) == test_labels(i) + idxs(count) = i; + count = count + 1; + end + if count > N + break + end +end + +inputs = single(test_images(:,:,:,idxs)); +targets = single(test_labels(idxs)); % Reachability parameters reachOptions = struct; @@ -54,7 +68,7 @@ % 3) Begin verification analysis for i=1:N - img = squeeze(inputs(:,:,:,:,i)); + img = inputs(:,:,:,i); target = targets(i); results(i,:) = verify_instance_shape(net, img, target, adv_attack, reachOptions); end diff --git a/code/nnv/examples/Submission/WiP_3d/verify_fracture.m b/code/nnv/examples/Submission/WiP_3d/verify_fracture.m index d62961501..a4f3c119d 100644 --- a/code/nnv/examples/Submission/WiP_3d/verify_fracture.m +++ b/code/nnv/examples/Submission/WiP_3d/verify_fracture.m @@ -20,9 +20,23 @@ net = matlab2nnv(net); % select volumes to verify -N = 50; % even for numCores -inputs = single(test_images(:,:,:,:,1:N)); -targets = single(test_labels(1:N)); +N = 50; +idxs = zeros(N,1); +count = 1; + +for i = 1:length(test_labels) + y = classify(matlabNet,test_images(:,:,:,i)); + if single(y) == test_labels(i) + idxs(count) = i; + count = count + 1; + end + if count > N + break + end +end + +inputs = single(test_images(:,:,:,idxs)); +targets = single(test_labels(idxs)); % Reachability parameters reachOptions = struct; @@ -57,7 +71,7 @@ % 3) Begin verification analysis for i=1:N - img = squeeze(inputs(:,:,:,:,i)); + img = inputs(:,:,:,i); target = targets(i); results(i,:) = verify_instance_3d(net, img, target, adv_attack, reachOptions); end diff --git a/code/nnv/examples/Submission/WiP_3d/verify_nodule.m b/code/nnv/examples/Submission/WiP_3d/verify_nodule.m index 0e6e7f6af..5c48d4926 100644 --- a/code/nnv/examples/Submission/WiP_3d/verify_nodule.m +++ b/code/nnv/examples/Submission/WiP_3d/verify_nodule.m @@ -20,9 +20,23 @@ net = matlab2nnv(net); % select volumes to verify -N = 50; % even for numCores -inputs = single(test_images(:,:,:,:,1:N)); -targets = single(test_labels(1:N)); +N = 50; +idxs = zeros(N,1); +count = 1; + +for i = 1:length(test_labels) + y = classify(matlabNet,test_images(:,:,:,i)); + if single(y) == test_labels(i) + idxs(count) = i; + count = count + 1; + end + if count > N + break + end +end + +inputs = single(test_images(:,:,:,idxs)); +targets = single(test_labels(idxs)); % Reachability parameters reachOptions = struct; @@ -58,7 +72,7 @@ % 3) Begin verification analysis for i=1:N - img = squeeze(inputs(:,:,:,:,i)); + img = inputs(:,:,:,i); target = targets(i); results(i,:) = verify_instance_3d(net, img, target, adv_attack, reachOptions); end diff --git a/code/nnv/examples/Submission/WiP_3d/verify_organ.m b/code/nnv/examples/Submission/WiP_3d/verify_organ.m index 563f5ca2c..4245ecc1e 100644 --- a/code/nnv/examples/Submission/WiP_3d/verify_organ.m +++ b/code/nnv/examples/Submission/WiP_3d/verify_organ.m @@ -21,8 +21,22 @@ % select volumes to verify N = 50; -inputs = single(test_images(:,:,:,:,1:N)); -targets = single(test_labels(1:N)); +idxs = zeros(N,1); +count = 1; + +for i = 1:length(test_labels) + y = classify(matlabNet,test_images(:,:,:,i)); + if single(y) == test_labels(i) + idxs(count) = i; + count = count + 1; + end + if count > N + break + end +end + +inputs = single(test_images(:,:,:,idxs)); +targets = single(test_labels(idxs)); % Reachability parameters reachOptions = struct; @@ -57,7 +71,7 @@ % 3) Begin verification analysis for i=1:N - img = squeeze(inputs(:,:,:,:,i)); + img = inputs(:,:,:,i); target = targets(i); results(i,:) = verify_instance_3d(net, img, target, adv_attack, reachOptions); end diff --git a/code/nnv/examples/Submission/WiP_3d/verify_synapse.m b/code/nnv/examples/Submission/WiP_3d/verify_synapse.m index e09474ffb..b4e346f5b 100644 --- a/code/nnv/examples/Submission/WiP_3d/verify_synapse.m +++ b/code/nnv/examples/Submission/WiP_3d/verify_synapse.m @@ -20,9 +20,23 @@ net = matlab2nnv(net); % select volumes to verify -N = 50; % even for numCores -inputs = single(test_images(:,:,:,:,1:N)); -targets = single(test_labels(1:N)); +N = 50; +idxs = zeros(N,1); +count = 1; + +for i = 1:length(test_labels) + y = classify(matlabNet,test_images(:,:,:,i)); + if single(y) == test_labels(i) + idxs(count) = i; + count = count + 1; + end + if count > N + break + end +end + +inputs = single(test_images(:,:,:,idxs)); +targets = single(test_labels(idxs)); % Reachability parameters reachOptions = struct; @@ -57,7 +71,7 @@ % 3) Begin verification analysis for i=1:N - img = squeeze(inputs(:,:,:,:,i)); + img = inputs(:,:,:,i); target = targets(i); results(i,:) = verify_instance_3d(net, img, target, adv_attack, reachOptions); end diff --git a/code/nnv/examples/Submission/WiP_3d/verify_vessel.m b/code/nnv/examples/Submission/WiP_3d/verify_vessel.m index 738fa2cf4..ac203f647 100644 --- a/code/nnv/examples/Submission/WiP_3d/verify_vessel.m +++ b/code/nnv/examples/Submission/WiP_3d/verify_vessel.m @@ -20,9 +20,23 @@ net = matlab2nnv(net); % select volumes to verify -N = 50; % even for numCores -inputs = single(test_images(:,:,:,:,1:N)); -targets = single(test_labels(1:N)); +N = 50; +idxs = zeros(N,1); +count = 1; + +for i = 1:length(test_labels) + y = classify(matlabNet,test_images(:,:,:,i)); + if single(y) == test_labels(i) + idxs(count) = i; + count = count + 1; + end + if count > N + break + end +end + +inputs = single(test_images(:,:,:,idxs)); +targets = single(test_labels(idxs)); % Reachability parameters reachOptions = struct; @@ -52,7 +66,7 @@ % 3) Begin verification analysis for i=1:N - img = squeeze(inputs(:,:,:,:,i)); + img = inputs(:,:,:,i); target = targets(i); results(i,:) = verify_instance_shape(net, img, target, adv_attack, reachOptions); end