forked from verivital/nnv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AISOLA23 code, medminst3d verification
- Loading branch information
Showing
59,321 changed files
with
3,957 additions
and
26 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+2.23 KB
code/nnv/examples/NN/medmnist/results/verification_bright_adrenalmnist3d.mat
Binary file not shown.
Binary file added
BIN
+2.25 KB
code/nnv/examples/NN/medmnist/results/verification_bright_fracturemnist3d.mat
Binary file not shown.
Binary file added
BIN
+2.26 KB
code/nnv/examples/NN/medmnist/results/verification_bright_nodulemnist3d.mat
Binary file not shown.
Binary file added
BIN
+2.25 KB
code/nnv/examples/NN/medmnist/results/verification_bright_organmnist3d.mat
Binary file not shown.
Binary file added
BIN
+2.18 KB
code/nnv/examples/NN/medmnist/results/verification_bright_synapsemnist3d.mat
Binary file not shown.
Binary file added
BIN
+2.18 KB
code/nnv/examples/NN/medmnist/results/verification_bright_vesselmnist3d.mat
Binary file not shown.
Binary file added
BIN
+2.23 KB
code/nnv/examples/NN/medmnist/results/verification_dark_adrenalmnist3d.mat
Binary file not shown.
Binary file added
BIN
+2.23 KB
code/nnv/examples/NN/medmnist/results/verification_dark_fracturemnist3d.mat
Binary file not shown.
Binary file added
BIN
+2.26 KB
code/nnv/examples/NN/medmnist/results/verification_dark_nodulemnist3d.mat
Binary file not shown.
Binary file added
BIN
+2.2 KB
code/nnv/examples/NN/medmnist/results/verification_dark_organmnist3d.mat
Binary file not shown.
Binary file added
BIN
+2.17 KB
code/nnv/examples/NN/medmnist/results/verification_dark_synapsemnist3d.mat
Binary file not shown.
Binary file added
BIN
+2.21 KB
code/nnv/examples/NN/medmnist/results/verification_dark_vesselmnist3d.mat
Binary file not shown.
Binary file added
BIN
+28.4 KB
code/nnv/examples/NN/medmnist/results/verification_multipleAttacks_adrenalmnist3d.mat
Binary file not shown.
Binary file added
BIN
+28.5 KB
code/nnv/examples/NN/medmnist/results/verification_multipleAttacks_fracturemnist3d.mat
Binary file not shown.
Binary file added
BIN
+28.8 KB
code/nnv/examples/NN/medmnist/results/verification_multipleAttacks_nodulemnist3d.mat
Binary file not shown.
Binary file added
BIN
+28.4 KB
code/nnv/examples/NN/medmnist/results/verification_multipleAttacks_organmnist3d.mat
Binary file not shown.
Binary file added
BIN
+27.5 KB
code/nnv/examples/NN/medmnist/results/verification_multipleAttacks_synapsemnist3d.mat
Binary file not shown.
Binary file added
BIN
+28 KB
code/nnv/examples/NN/medmnist/results/verification_multipleAttacks_vesselmnist3d.mat
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
%% Verify all possible 3D classification models for medmnist data | ||
|
||
|
||
medmnist_path = "data/mat_files/"; % path to data | ||
|
||
datasets = dir(medmnist_path+"*.mat"); | ||
|
||
for i=1:length(datasets) | ||
|
||
if endsWith(datasets(i).name, "3d.mat") | ||
|
||
% get current dataset to verify | ||
dataset = medmnist_path + datasets(i).name; | ||
|
||
try % verification | ||
|
||
disp("Begin verification of " + datasets(i).name); | ||
|
||
% Load data | ||
load(dataset); | ||
|
||
% data to verify (test set) | ||
test_images = permute(test_images, [2 3 4 5 1]); | ||
test_labels = test_labels + 1; | ||
|
||
% load network | ||
load("models/model_"+string(datasets(i).name)); | ||
matlabNet = net; | ||
net = matlab2nnv(net); | ||
|
||
% adversarial attacks | ||
names = ["dark";"bright"]; | ||
max_pixels = [50;100;200]; | ||
noise_vals = [1;2;3]; | ||
|
||
% select volumes to verify | ||
N = 200; | ||
inputs = test_images(:,:,:,:,1:N); | ||
targets = test_labels(1:N); | ||
|
||
% Initialize results | ||
results = zeros(2, N, length(names), length(max_pixels), length(noise_vals)); | ||
|
||
% verify volumes with all attack combos | ||
for a=1:length(names) | ||
for b=1:length(max_pixels) | ||
for c=1:length(noise_vals) | ||
% create attack from variables | ||
adv_attack = struct; | ||
adv_attack.Name = names(a); | ||
adv_attack.max_pixels = max_pixels(b); | ||
adv_attack.noise_de = noise_vals(c); | ||
if strcmp(names(a),'dark') | ||
adv_attack.threshold = 150; | ||
elseif strcmp(names(a), 'bright') | ||
adv_attack.threshold = 100; | ||
end | ||
% Compute verification | ||
results(:,:,a,b,c) = verify_medmnist3d(net, inputs, targets, adv_attack); | ||
end | ||
end | ||
end | ||
|
||
% save results | ||
save("results/verification_multipleAttacks_"+datasets(i).name, "results"); | ||
|
||
catch ME | ||
|
||
warning("Failed!!") | ||
warning(ME.message); | ||
disp(medmnist_path+datasets(i).name) | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+16.8 KB
...f Benchmark Generation for the Verification of NN Image Classifiers/MNIST/acc_results.mat
Binary file not shown.
Oops, something went wrong.