<jupyter_start><jupyter_text>Lungs<jupyter_code>img_params = {'img_width': 330,
              'img_height': 256}

X_val = np.load('CT-COV-Lungs-Crop/Val/X_val.npy')
y_val = np.load('CT-COV-Lungs-Crop/Val/y_val.npy')
X_val_rgb = np.load('CT-COV-Lungs-Crop/Val/X_val_rgb.npy')
y_val_rgb = np.load('CT-COV-Lungs-Crop/Val/y_val_rgb.npy')
model_functions = [get_model_simple(**img_params), get_model_tiny(**img_params), get_model_small(**img_params), get_model_largew(**img_params), get_model_larget(**img_params)]
model_functions_rgb = [get_efficientnet_b3(**img_params), load_efficientnet(**img_params)]
calculate_aucs('lungs', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
calculate_aucs('lungs-classw', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
model_functions = [get_model_simple(if_dataaug=True, data_augmentation=dataaug_layer(0.05, -0.1, 0.05,num_channels=1, **img_params), **img_params), 
                   get_model_tiny(if_dataaug=True, data_augmentation=dataaug_layer(0.05, -0.1, 0.05, num_channels=1, **img_params), **img_params), 
                   get_model_small(if_dataaug=True, data_augmentation=dataaug_layer(0.05, -0.1, 0.05, num_channels=1, **img_params), **img_params), 
                   get_model_largew(if_dataaug=True, data_augmentation=dataaug_layer(0.05, -0.1, 0.05, num_channels=1, **img_params), **img_params), 
                   get_model_larget(if_dataaug=True, data_augmentation=dataaug_layer(0.05, -0.1, 0.05, num_channels=1, **img_params), **img_params)]
model_functions_rgb = [get_efficientnet_b3(if_dataaug=True, data_augmentation=dataaug_layer(0.05, -0.1, 0.05, num_channels=3, **img_params), **img_params), 
                       load_efficientnet(if_dataaug=True, data_augmentation=dataaug_layer(0.05, -0.1, 0.05, num_channels=3, **img_params), **img_params)]
calculate_aucs('lungs-dataaug', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
calculate_aucs('lungs-classw-dataaug', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
model = get_efficientnet_b3(**img_params)
model.load_weights('best-models/efficientnetb3-imagenet-weights/' + 'lungs' + '.ckpt')
plt.figure(figsize=(20,7))
plt.suptitle('EfficientNet B3 - pretrained on ImageNet (lungs-baseline)')
plt.subplot(121)
plot_roc_curves(model, X_val_rgb, y_val_rgb)
plt.subplot(122)
plot_pr_curves(model, X_val_rgb, y_val_rgb);<jupyter_output><empty_output><jupyter_text>Lungs - no crop<jupyter_code>img_params = {'img_width': 512,
              'img_height': 512}

X_val = np.load('CT-COV-Lungs/Val/X_val.npy')
y_val = np.load('CT-COV-Lungs/Val/y_val.npy')
X_val_rgb = np.load('CT-COV-Lungs/Val/X_val_rgb.npy')
y_val_rgb = np.load('CT-COV-Lungs/Val/y_val_rgb.npy')
model_functions = [get_model_simple(**img_params), get_model_tiny(**img_params), get_model_small(**img_params), get_model_largew(**img_params), get_model_larget(**img_params)]
model_functions_rgb = [get_efficientnet_b3(**img_params), load_efficientnet(**img_params)]
calculate_aucs('lungs-nocrop', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
calculate_aucs('lungs-nocrop-classw', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
model_functions = [get_model_simple(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.15, num_channels=1, **img_params), **img_params), 
                   get_model_tiny(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.15, num_channels=1, **img_params), **img_params), 
                   get_model_small(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.15, num_channels=1, **img_params), **img_params), 
                   get_model_largew(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.15, num_channels=1, **img_params), **img_params), 
                   get_model_larget(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.15, num_channels=1, **img_params), **img_params)]
model_functions_rgb = [get_efficientnet_b3(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.15, num_channels=3, **img_params), **img_params), 
                       load_efficientnet(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.15, num_channels=3, **img_params), **img_params)]
calculate_aucs('lungs-nocrop-dataaug', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
calculate_aucs('lungs-nocrop-classw-dataaug', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
model = load_efficientnet(**img_params)
model.load_weights('best-models/efficientnetb3-weights/' + 'lungs-nocrop' + '.ckpt')
plt.figure(figsize=(20,7))
plt.suptitle('EfficientNet B3 (lungs-nocrop-baseline)')
plt.subplot(121)
plot_roc_curves(model, X_val_rgb, y_val_rgb)
plt.subplot(122)
plot_pr_curves(model, X_val_rgb, y_val_rgb);<jupyter_output><empty_output><jupyter_text>Crop<jupyter_code>img_params = {'img_width': 512,
              'img_height': 328}

X_val = np.load('CT-COV-Crop/Val/X_val.npy')
y_val = np.load('CT-COV-Crop/Val/y_val.npy')
X_val_rgb = np.load('CT-COV-Crop/Val/X_val_rgb.npy')
y_val_rgb = np.load('CT-COV-Crop/Val/y_val_rgb.npy')
model_functions = [get_model_simple(**img_params), get_model_tiny(**img_params), get_model_small(**img_params), get_model_largew(**img_params), get_model_larget(**img_params)]
model_functions_rgb = [get_efficientnet_b3(**img_params), load_efficientnet(**img_params)]
calculate_aucs('crop', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
calculate_aucs('crop-classw', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
model_functions = [get_model_simple(if_dataaug=True, data_augmentation=dataaug_layer(0.07, -0.1, 0.07, num_channels=1, **img_params), **img_params), 
                   get_model_tiny(if_dataaug=True, data_augmentation=dataaug_layer(0.07, -0.1, 0.07, num_channels=1, **img_params), **img_params), 
                   get_model_small(if_dataaug=True, data_augmentation=dataaug_layer(0.07, -0.1, 0.07, num_channels=1, **img_params), **img_params), 
                   get_model_largew(if_dataaug=True, data_augmentation=dataaug_layer(0.07, -0.1, 0.07, num_channels=1, **img_params), **img_params), 
                   get_model_larget(if_dataaug=True, data_augmentation=dataaug_layer(0.07, -0.1, 0.07, num_channels=1, **img_params), **img_params)]
model_functions_rgb = [get_efficientnet_b3(if_dataaug=True, data_augmentation=dataaug_layer(0.07, -0.1, 0.07, num_channels=3, **img_params), **img_params), 
                       load_efficientnet(if_dataaug=True, data_augmentation=dataaug_layer(0.07, -0.1, 0.07, num_channels=3, **img_params), **img_params)]
calculate_aucs('crop-dataaug', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
calculate_aucs('crop-classw-dataaug', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)<jupyter_output><empty_output><jupyter_text>No background<jupyter_code>img_params = {'img_width': 512,
              'img_height': 512}

X_val = np.load('CT-COV-Contour/Val/X_val.npy')
y_val = np.load('CT-COV-Contour/Val/y_val.npy')
X_val_rgb = np.load('CT-COV-Contour/Val/X_val_rgb.npy')
y_val_rgb = np.load('CT-COV-Contour/Val/y_val_rgb.npy')
model_functions = [get_model_simple(**img_params), get_model_tiny(**img_params), get_model_small(**img_params), get_model_largew(**img_params), get_model_larget(**img_params)]
model_functions_rgb = [get_efficientnet_b3(**img_params), load_efficientnet(**img_params)]
calculate_aucs('nobackg', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
calculate_aucs('nobackg-classw', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
model_functions = [get_model_simple(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.1, num_channels=1, **img_params), **img_params), 
                   get_model_tiny(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.1, num_channels=1, **img_params), **img_params), 
                   get_model_small(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.1, num_channels=1, **img_params), **img_params), 
                   get_model_largew(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.1, num_channels=1, **img_params), **img_params), 
                   get_model_larget(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.1, num_channels=1, **img_params), **img_params)]
model_functions_rgb = [get_efficientnet_b3(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.1, num_channels=3, **img_params), **img_params), 
                       load_efficientnet(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.1, num_channels=3, **img_params), **img_params)]
calculate_aucs('nobackg-dataaug', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
calculate_aucs('nobackg-classw-dataaug', model_functions, model_functions_rgb,get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)<jupyter_output><empty_output><jupyter_text>Original images<jupyter_code>img_params = {'img_width': 512,
              'img_height': 512}

X_val = np.load('CT-COV19/Val/X_val.npy')
y_val = np.load('CT-COV19/Val/y_val.npy')
X_val_rgb = np.load('CT-COV19/Val/X_val_rgb.npy')
y_val_rgb = np.load('CT-COV19/Val/y_val_rgb.npy')
model_functions = [get_model_simple(**img_params), get_model_tiny(**img_params), get_model_small(**img_params), get_model_largew(**img_params), get_model_larget(**img_params)]
model_functions_rgb = [get_efficientnet_b3(**img_params), load_efficientnet(**img_params)]
calculate_aucs('first', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
calculate_aucs('first-classw', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
model_functions = [get_model_simple(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.1, num_channels=1, **img_params), **img_params), 
                   get_model_tiny(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.1, num_channels=1, **img_params), **img_params), 
                   get_model_small(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.1, num_channels=1, **img_params), **img_params), 
                   get_model_largew(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.1, num_channels=1, **img_params), **img_params), 
                   get_model_larget(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.1, num_channels=1, **img_params), **img_params)]
model_functions_rgb = [get_efficientnet_b3(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.1, num_channels=3, **img_params), **img_params), 
                       load_efficientnet(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.1, num_channels=3, **img_params), **img_params)]
calculate_aucs('first-dataaug', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
calculate_aucs('first-classw-dataaug', model_functions, model_functions_rgb, get_model_bit(), X_val, y_val, X_val_rgb, y_val_rgb, None)
model = get_model_simple(if_dataaug=True, data_augmentation=dataaug_layer(0.1, -0.2, 0.1, num_channels=1, **img_params), **img_params)
model.load_weights('best-models/simple-weights/' + 'first-classw-dataaug' + '.ckpt')
plt.figure(figsize=(20,7))
plt.suptitle('Simple Model (original-classw-dataaug)')
plt.subplot(121)
plot_roc_curves(model, X_val, y_val)
plt.subplot(122)
plot_pr_curves(model, X_val, y_val);
model = get_model_tiny(**img_params)
model.load_weights('best-models/tiny-weights/' + 'first' + '.ckpt')
plt.figure(figsize=(20,7))
plt.suptitle('Tiny Model (original-baseline)')
plt.subplot(121)
plot_roc_curves(model, X_val, y_val)
plt.subplot(122)
plot_pr_curves(model, X_val, y_val);
model = get_model_small(**img_params)
model.load_weights('best-models/small-weights/' + 'first' + '.ckpt')
plt.figure(figsize=(20,7))
plt.suptitle('Small Model (original-baseline)')
plt.subplot(121)
plot_roc_curves(model, X_val, y_val)
plt.subplot(122)
plot_pr_curves(model, X_val, y_val);
model = get_model_largew(**img_params)
model.load_weights('best-models/largew-weights/' + 'first-classw' + '.ckpt')
plt.figure(figsize=(20,7))
plt.suptitle('LargeW Model (original-classw)')
plt.subplot(121)
plot_roc_curves(model, X_val, y_val)
plt.subplot(122)
plot_pr_curves(model, X_val, y_val);
model = get_model_larget(**img_params)
model.load_weights('best-models/larget-weights/' + 'first' + '.ckpt')
plt.figure(figsize=(20,7))
plt.suptitle('LargeT Model (original-baseline)')
plt.subplot(121)
plot_roc_curves(model, X_val, y_val)
plt.subplot(122)
plot_pr_curves(model, X_val, y_val);
model = get_model_larget(**img_params)
model.load_weights('best-models/larget-weights/' + 'first' + '.ckpt')
plt.figure(figsize=(20,7))
plt.suptitle('LargeT Model (original-baseline)')
plt.subplot(121)
plot_roc_curves(model, X_val, y_val)
plt.subplot(122)
plot_pr_curves(model, X_val, y_val);
model = get_model_bit()
model.load_weights('best-models/googlebit-weights/' + 'first' + '.ckpt')
plt.figure(figsize=(20,7))
plt.suptitle('ResNet-50 (original-baseline)')
plt.subplot(121)
plot_roc_curves(model, X_val_rgb/np.max(X_val_rgb), y_val_rgb)
plt.subplot(122)
plot_pr_curves(model, X_val_rgb/np.max(X_val_rgb), y_val_rgb);<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1520854526958291, 'fraction_numerical': 0.03073681150995495, 'mean_word_length': 6.758173618940248, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '464702', 'license': 'MIT', 'n_tokens_mistral': 5758, 'n_tokens_neox': 5437, 'n_words': 704, 'path': 'notebooks/AUC-Scores.ipynb', 'repo_name': 'marta-0/covid-ct', 'size': '13762'}