-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c500de
commit af52503
Showing
4 changed files
with
52 additions
and
5 deletions.
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
23 changes: 23 additions & 0 deletions
23
bayesian_cnn_prometheus/analysis/apply_variance_postprocess.py
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,23 @@ | ||
import cv2 | ||
import numpy as np | ||
|
||
|
||
def is_contour_bad(c): | ||
_, radius = cv2.minEnclosingCircle(c) | ||
return radius > 10 | ||
|
||
|
||
def getXFromRect(item): | ||
return item[0] | ||
|
||
|
||
def apply_variance_postprocess(variance: np.ndarray): | ||
lower_bound = np.percentile(variance, 99.6) | ||
variance[lower_bound > variance] = 0 | ||
|
||
variance[np.nonzero(variance)] = 255 | ||
variance = variance.astype(np.uint8) | ||
for i in range(variance.shape[0]): | ||
im = cv2.erode(variance[i], np.ones((3, 3))) | ||
variance[i, :, :] = cv2.dilate(im, np.ones((3, 3))) | ||
return variance |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import os | ||
import sys | ||
from pathlib import Path | ||
|
||
from bayesian_cnn_prometheus.run_training_for_experiments import create_sbatch_script | ||
|
||
|
||
def run_analysis_for_experiment(): | ||
model_path = sys.argv[1] | ||
config_path = sys.argv[2] | ||
input_path = sys.argv[3] | ||
output_path = sys.argv[4] | ||
|
||
script_path = create_sbatch_script(Path(output_path)) | ||
os.system(f'sbatch {script_path} analysis/analyse_lesions.py {model_path} {config_path} {input_path} {output_path}') | ||
|
||
|
||
if __name__ == '__main__': | ||
run_analysis_for_experiment() |