Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define score threshold as input parameter #5

Merged
merged 4 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/swimming-pool-detection/GE/config_GE.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ make_predictions.py:
detectron2_config_file: '../detectron2_config_GE.yaml' # path relative to the working_folder
model_weights:
pth_file: 'logs/model_final.pth'

score_lower_threshold: 0.05

assess_predictions.py:
datasets:
ground_truth_labels_geojson: output_GE/ground_truth_labels.geojson
Expand Down
14 changes: 8 additions & 6 deletions scripts/make_predictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
WORKING_DIR = cfg['working_folder']
SAMPLE_TAGGED_IMG_SUBDIR = cfg['sample_tagged_img_subfolder']
LOG_SUBDIR = cfg['log_subfolder']


SCORE_LOWER_THR = cfg['score_lower_threshold']

os.chdir(WORKING_DIR)
# let's make the output directories in case they don't exist
Expand All @@ -89,14 +90,15 @@
cfg.OUTPUT_DIR = LOG_SUBDIR

cfg.MODEL.WEIGHTS = MODEL_PTH_FILE
predictor = DefaultPredictor(cfg)

# ---- make predictions
threshold = 0.05

# set the testing threshold for this model
threshold = SCORE_LOWER_THR
threshold_str = str( round(threshold, 2) ).replace('.', 'dot')
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = threshold

cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = threshold # set the testing threshold for this model
predictor = DefaultPredictor(cfg)

# ---- make predictions
for dataset in COCO_FILES_DICT.keys():

predictions = {}
Expand Down