diff --git a/code/nnv/examples/Submission/WiP_3d/functions/add_voxels.m b/code/nnv/examples/Submission/WiP_3d/functions/add_voxels.m index 159f5f68a..2c50ed1c9 100644 --- a/code/nnv/examples/Submission/WiP_3d/functions/add_voxels.m +++ b/code/nnv/examples/Submission/WiP_3d/functions/add_voxels.m @@ -5,17 +5,15 @@ % Return a VolumeStar of a brightening attack on a few pixels % Initialize vars - ct = 0; % keep track of pixels modified - flag = 0; % determine when to stop modifying pixels vol = single(vol); at_vol = vol; % we can find the edge of the shape - shape = edge3(vol); % this should be okay for this data, but let's test it + shape = edge3(vol,'approxcanny',0.6); % this should be okay for this data, but let's test it % select a random pixel - idxs = find(shape) && ~find(vol); - voxels = max(voxels,length(idxs)); + idxs = setdiff(find(shape), find(vol)); + voxels = min(voxels,length(idxs)); % For now, we can select the first ones at_vol(idxs(1:voxels)) = 255; diff --git a/code/nnv/examples/Submission/WiP_3d/functions/remove_voxels.m b/code/nnv/examples/Submission/WiP_3d/functions/remove_voxels.m index b98ba0353..dc5703098 100644 --- a/code/nnv/examples/Submission/WiP_3d/functions/remove_voxels.m +++ b/code/nnv/examples/Submission/WiP_3d/functions/remove_voxels.m @@ -5,17 +5,15 @@ % Return a VolumeStar of a brightening attack on a few pixels % Initialize vars - ct = 0; % keep track of pixels removed - flag = 0; % determine when to stop modifying pixels vol = single(vol); at_vol = vol; % we can find the edge of the shape - shape = edge3(vol); % this should be okay for this data, but let's test it + shape = edge3(vol,'approxcanny',0.6); % this should be okay for this data, but let's test it % select a random pixel - idxs = find(shape) && find(vol); - voxels = max(voxels,length(idxs)); + idxs = intersect(find(shape),find(vol)); + voxels = min(voxels,length(idxs)); % For now, we can select the first ones at_vol(idxs(1:voxels)) = 0; diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_10.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_10.png index 2e4a18834..9aa22a8e1 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_2.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_2.png index 4226074d8..8f6792090 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_25.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_25.png index eb2c8857a..70c5c7c81 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_5.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_5.png index 2a443887e..e64ee892d 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_bright_5.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_10.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_10.png index 7a932b3e7..22579a839 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_2.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_2.png index 23c7f1951..a2522099c 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_25.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_25.png index 63dbc9f5c..2e5774517 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_5.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_5.png index ba86857eb..7a623e26b 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/avgTime_dark_5.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_10.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_10.png index 63a3f7459..5a94ebed7 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_2.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_2.png index f8d961f71..a6a6ae004 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_25.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_25.png index 020bf444d..7e0a1a70e 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_5.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_5.png index 85339cdcd..9e1fdb9a5 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_bright_5.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_10.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_10.png index 3cdd7e196..e10ece93b 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_2.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_2.png index 9c4834452..01de59df7 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_25.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_25.png index cdc798726..80219bbfe 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_5.png b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_5.png index 9c4834452..92b56b88c 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/fracture/verification_dark_5.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_10.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_10.png index 1fa239edd..c6b23e64b 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_2.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_2.png index 87f8f0bfd..02ccb7262 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_25.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_25.png index a2ec5e308..212fa9943 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_5.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_5.png index 3570dadab..8c5fe3a94 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_bright_5.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_10.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_10.png index 2e5ddcb41..dfbe88ae0 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_2.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_2.png index 3f60409ea..8b784d096 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_25.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_25.png index e7a284819..46984e249 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_5.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_5.png index 308cdada5..1f1d8aa4b 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/avgTime_dark_5.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_10.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_10.png index 235f67ef8..51a5d2053 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_2.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_2.png index 8dbe04758..d4326554b 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_25.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_25.png index ed016d18d..30827e275 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_5.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_5.png index 235f67ef8..749dfc69c 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_bright_5.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_10.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_10.png index bee0ec780..986ddd26e 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_2.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_2.png index 2ad37ae35..52f548afe 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_25.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_25.png index bee0ec780..8cfc164ee 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_5.png b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_5.png index 4229ee3b0..607e92cee 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/nodule/verification_dark_5.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_10.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_10.png index d89d15983..b835b6e66 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_2.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_2.png index ddd45fbb3..71f941ea2 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_25.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_25.png index 77dc2fa1e..2780fb9f6 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_5.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_5.png index 76d5b8cf7..4ffe8e408 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_bright_5.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_10.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_10.png index e80cc90b7..76ece678e 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_2.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_2.png index ee13b6aa8..afa389dbc 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_25.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_25.png index c3d507464..06c301174 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_5.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_5.png index b921875d0..f06b7e9bd 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/avgTime_dark_5.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_10.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_10.png index c5e8daa27..00cdaee71 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_2.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_2.png index 1e3fc4d62..412fc05cf 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_25.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_25.png index 8bc978ea3..f3931b531 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_5.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_5.png index 6e525a5fb..00cdaee71 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_bright_5.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_10.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_10.png index 53207f00e..6aa7e71b9 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_2.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_2.png index be85b1422..f996bd48c 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_25.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_25.png index 136158609..baff249fa 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_5.png b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_5.png index 5db5df039..eb0b1e730 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/organ/verification_dark_5.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_10.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_10.png index ee8d49ac4..7bd73e358 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_2.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_2.png index 810a57a2f..ea27ac09d 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_25.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_25.png index 261782692..028a2c3f0 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_5.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_5.png index 592d2d818..5e651982d 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_bright_5.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_10.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_10.png index ebca5b08b..331f650de 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_2.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_2.png index de8474c79..dfdd15731 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_25.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_25.png index 6ef5b36d8..ed1360a22 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_5.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_5.png index 2eef7e209..de3797f8c 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/avgTime_dark_5.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_10.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_10.png index c0a7feb70..df396d9cd 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_2.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_2.png index 65d35fa0e..fb8840dae 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_25.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_25.png index 628099124..de0f4bca2 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_5.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_5.png index 65d35fa0e..acab4eb6d 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_bright_5.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_10.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_10.png index a982c5038..3dbf0caa1 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_10.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_10.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_2.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_2.png index 2bfb58543..de0f4bca2 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_2.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_2.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_25.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_25.png index f9bdf8f26..aa6f2b99f 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_25.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_25.png differ diff --git a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_5.png b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_5.png index a982c5038..ea4e6c71d 100644 Binary files a/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_5.png and b/code/nnv/examples/Submission/WiP_3d/plots/synapse/verification_dark_5.png differ 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 new file mode 100644 index 000000000..2459cf1eb Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_add_1_100.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_add_1_1000.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_add_1_1000.mat new file mode 100644 index 000000000..ff8decfa7 Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_add_1_1000.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_add_1_50.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_add_1_50.mat new file mode 100644 index 000000000..cefb924db Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_add_1_50.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_add_1_500.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_add_1_500.mat new file mode 100644 index 000000000..b5f320463 Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_add_1_500.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_remove_1_100.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_remove_1_100.mat new file mode 100644 index 000000000..fbc625d38 Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_remove_1_100.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_remove_1_1000.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_remove_1_1000.mat new file mode 100644 index 000000000..d5f127a3b Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_remove_1_1000.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_remove_1_50.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_remove_1_50.mat new file mode 100644 index 000000000..db805a4fb Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_remove_1_50.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_remove_1_500.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_remove_1_500.mat new file mode 100644 index 000000000..60bf80706 Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_adrenal_remove_1_500.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_add_1_100.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_add_1_100.mat new file mode 100644 index 000000000..43c0b3fed Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_add_1_100.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_add_1_1000.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_add_1_1000.mat new file mode 100644 index 000000000..290144fa5 Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_add_1_1000.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_add_1_50.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_add_1_50.mat new file mode 100644 index 000000000..dcdb70574 Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_add_1_50.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_add_1_500.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_add_1_500.mat new file mode 100644 index 000000000..08a182f68 Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_add_1_500.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_remove_1_100.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_remove_1_100.mat new file mode 100644 index 000000000..d9bd3bdf2 Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_remove_1_100.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_remove_1_1000.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_remove_1_1000.mat new file mode 100644 index 000000000..e4a21a6ac Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_remove_1_1000.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_remove_1_50.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_remove_1_50.mat new file mode 100644 index 000000000..86c504610 Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_remove_1_50.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_remove_1_500.mat b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_remove_1_500.mat new file mode 100644 index 000000000..37cf6442c Binary files /dev/null and b/code/nnv/examples/Submission/WiP_3d/results/verification_vessel_remove_1_500.mat differ diff --git a/code/nnv/examples/Submission/WiP_3d/run_all.m b/code/nnv/examples/Submission/WiP_3d/run_all.m index a6eb08749..6ff562bd3 100644 --- a/code/nnv/examples/Submission/WiP_3d/run_all.m +++ b/code/nnv/examples/Submission/WiP_3d/run_all.m @@ -1,9 +1,12 @@ %% Shape only data (3d) +disp("... adrenal ..."); verify_adrenal; +disp("... vessel ..."); verify_vessel; + %% Volume data (general 3D) @@ -24,4 +27,5 @@ disp("... Creating plots..."); -visualize_results; +visualize_results_gen; +visualize_results_shape; diff --git a/code/nnv/examples/Submission/WiP_3d/verify_adrenal.m b/code/nnv/examples/Submission/WiP_3d/verify_adrenal.m index 704ef8609..de5e9f0fd 100644 --- a/code/nnv/examples/Submission/WiP_3d/verify_adrenal.m +++ b/code/nnv/examples/Submission/WiP_3d/verify_adrenal.m @@ -34,6 +34,7 @@ % Study variables advType = ["add", "remove"]; maxpixels = [50, 100, 500, 1000]; %out of 28x28x28 pixels +% maxpixels = 1000; epsilon = 1; % ep / 255 diff --git a/code/nnv/examples/Submission/WiP_3d/verify_vessel.m b/code/nnv/examples/Submission/WiP_3d/verify_vessel.m index 0a8c2dab3..738fa2cf4 100644 --- a/code/nnv/examples/Submission/WiP_3d/verify_vessel.m +++ b/code/nnv/examples/Submission/WiP_3d/verify_vessel.m @@ -20,7 +20,7 @@ net = matlab2nnv(net); % select volumes to verify -N = 24; % even for numCores +N = 50; % even for numCores inputs = single(test_images(:,:,:,:,1:N)); targets = single(test_labels(1:N)); diff --git a/code/nnv/examples/Submission/WiP_3d/visualize_results.m b/code/nnv/examples/Submission/WiP_3d/visualize_results_gen.m similarity index 96% rename from code/nnv/examples/Submission/WiP_3d/visualize_results.m rename to code/nnv/examples/Submission/WiP_3d/visualize_results_gen.m index 95fcb4ffd..f0e14d02a 100644 --- a/code/nnv/examples/Submission/WiP_3d/visualize_results.m +++ b/code/nnv/examples/Submission/WiP_3d/visualize_results_gen.m @@ -3,17 +3,16 @@ results = dir('results'); % Variable in the study -% datasets = ["adrenal", "fracture", "nodule", "organ", "synapse", "vessel"]; datasets = ["fracture", "nodule", "organ", "synapse"]; attackType = ["bright", "dark"]; maxpixels = ["50", "100", "500", "1000"]; epsilon = ["2", "5", "10", "25"]; % epsilon/255 % Initialize directories -mkdir('plots'); -for i=datasets - mkdir("plots/"+i); -end +% mkdir('plots'); +% for i=datasets +% mkdir("plots/"+i); +% end %% Visualize verification results/trends @@ -124,8 +123,8 @@ % Create figure (results) f = figure('visible','off'); - bar(1:3, counts','stacked') % plot results - grid + bar(1:3, counts','stacked'); % plot results + grid; % set values for x-axis xticks([1 2 3]); xticklabels(epsilon) diff --git a/code/nnv/examples/Submission/WiP_3d/visualize_results_shape.m b/code/nnv/examples/Submission/WiP_3d/visualize_results_shape.m new file mode 100644 index 000000000..09c8c6037 --- /dev/null +++ b/code/nnv/examples/Submission/WiP_3d/visualize_results_shape.m @@ -0,0 +1,196 @@ +%% Get all results, one dataset at a time + +results = dir('results'); + +% Variable in the study +datasets = ["adrenal", "vessel"]; +attackType = ["bright", "dark"]; +maxpixels = ["50", "100", "500", "1000"]; +epsilon = ["1"]; % epsilon/255 + +% Initialize directories +% mkdir('plots'); +% for i=datasets +% mkdir("plots/"+i); +% end + +%% Visualize verification results/trends + +% What do we want to show? + +% 1) Trends +% - Time: How does the time increases as the input set gets larger? +% - Epsilon increasing +% - Number of pixels increasing +% - results: How robust are the models as we increase the size of the attack? more unknowns? more sats? +% - Epsilon increasing +% - Number of pixels increasing +% 2) Certified robust accuracy +% - Is it much worse than the accuracy of the model? +% - Do we need more samples? + + +% Time for plots (maxpixels variable) +for ds = datasets + for adv = attackType + for ep = epsilon + + % Initialize vars to plot + sat = []; + unsat = []; + unk = []; + miss = []; + avgVT = []; + avgRT = []; + + % Get data + for mp = maxpixels + resFile = "results/verification_" + ds + "_" + adv + "_" + ep + "_" + mp +".mat"; + res = summarize_results(resFile); + sat = [sat, res.sat]; + unsat = [unsat, res.unsat]; + unk = [unk, res.unknown]; + miss = [miss, res.misclassified]; + avgVT = [avgVT, res.avgTime]; % average computation time to verify one instance + avgRT = [avgRT, res.avgRT]; % average computation time to compute the reachable sets (miss and sat do not count here) + end + counts = [unsat; sat; unk; miss]; + + + % Create figure (results) + f = figure('visible','off'); + bar(1:4, counts','stacked') % plot verification results + grid; + % set values for x-axis + xticks([1 2 3 4]); + xticklabels(maxpixels); + % axis labels + xlabel('Max pixels perturbed'); + ylabel('# instances') + % legend + leg = {"unsat", "sat", "unknown", "missclass"}; + legend(leg, 'Location', 'best'); + % save figure + saveas(f, "plots/" + ds + "/verification_" + adv + "_" + ep + ".png"); + + % create figure (time) + f = figure('visible','off'); + % plot computation time results + plot(1:4, avgVT, 'r--o'); + hold on; + plot(1:4, avgRT, 'b--v'); + % set values for x-axis + xticks([1 2 3 4]); + xticklabels(maxpixels) + % axis labels + xlabel('Max pixels perturbed'); + ylabel("Average Time (s)") + % legend + leg = {"all", "unsat & unknown"}; + legend(leg, 'Location', 'best'); + % save figure + saveas(f, "plots/" + ds + "/avgTime_" + adv + "_" + ep + ".png"); + + end + end +end + +% Time for plots (epsilon variable) +for ds = datasets + for adv = attackType + for mp = maxpixels + + % Initialize vars to plot + sat = []; + unsat = []; + unk = []; + miss = []; + avgVT = []; + avgRT = []; + + % Get data + for ep = epsilon + resFile = "results/verification_" + ds + "_" + adv + "_" + ep + "_" + mp +".mat"; + res = summarize_results(resFile); + sat = [sat, res.sat]; + unsat = [unsat, res.unsat]; + unk = [unk, res.unknown]; + miss = [miss, res.misclassified]; + avgVT = [avgVT, res.avgTime]; % average computation time to verify one instance + avgRT = [avgRT, res.avgRT]; % average computation time to compute the reachable sets (miss and sat do not count here) + end + counts = [unsat; sat; unk; miss]; + + % Create figure (results) + f = figure('visible','off'); + bar(1:3, counts','stacked') % plot results + grid + % set values for x-axis + xticks([1 2 3]); + xticklabels(epsilon) + % axis labels + xlabel('epsilon (\epsilon)'); + ylabel('# instances') + % legend + leg = {"unsat", "sat", "unknown", "missclass"}; + legend(leg, 'Location', 'best'); + % save figure + saveas(f, "plots/" + ds + "/verification_" + adv + "_" + mp + ".png"); + + % create figure (time) + f = figure('visible','off'); + % plot timing results + plot(1:3, avgVT, 'r--o'); + hold on; + plot(1:3, avgRT, 'b--v'); + % set values for x-axis + xticks([1 2 3]); + xticklabels(epsilon) + % axis labels + xlabel('epsilon (\epsilon)'); + ylabel("Average Time (s)") + % legend + leg = {"all", "unsat & unknown"}; + legend(leg, 'Location', 'best'); + % save figure + saveas(f, "plots/" + ds + "/avgTime_" + adv + "_" + mp + ".png"); + + end + end +end + + +%% Helper functions + +function summary = summarize_results(resFile) + + % Provide details from results file + summary = struct; + data = load(resFile); + results = data.results; + + % Total number of samples examined + summary.N = length(results); + + % Verified (unsat) + summary.unsat = sum(results(:,1) == 1); + + % Falsified (sat) from input set + summary.sat = sum(results(:,1) == 0); + + % Unknown (not using exact) + summary.unknown = sum(results(:,1) == 2); + + % Misclasified (sat) of original image + summary.misclassified = sum(results(:,1) == -1); + + % Also possible -2 (error), which may be out of memory (most common here) + summary.avgTime = sum(results(:,2))/summary.N; + + % Find instances where reachability is needed + x = [find(results(:,1)==2); find(results(:,1)==1)]; + nx = length(x); % how many instances reachability is computed for + + % Average time only for unknown and unsat properties (reachsets computed) + summary.avgRT = sum(results(x,2))/nx; +end \ No newline at end of file