-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix steps issues #48 and #49 * prepare sum of distances, not distances to 2 closest objects * back to const erosion * fixes * fix * [:-4] -> os.path.splitext() * loss weighted by size of the object * prepare masks, distances and sizes * cleaning * adapt models and loaders to handle size matrix and calculate size weights * adapt models and loaders to handle size matrix and calculate size weights v2 * fix pipelines.py * fix some issues with calculating size-weighted loss * cleaning * update mean and std * fixes * clean * fix recall in evaluation * fix bug in erosion (#91) * Dev mosaic padding inference (#81) * added mosaic seq, unet_mosaic pipe, mosaic loader * added unet_weighted * dropped input resize at inference * dropped rescaling in loader, fixed postpro cropping * local dev * updated dilation/erosion, joined pipelines * dropped unet mask saving * added replication padding * renamed mosaic->padded, moved params to configs * padding->inference_padding * config updates * refactored padded unet * refactored unet_padding * Dev dice loss (#89) * fix size weights * add mixed dice + weighted ce loss * fixes * parametrize loss weights * remove get_datagen function overriding * dice loss per channel, some fixes * fixes and smooth added to Dice loss instead of eps * fixes and smooth added to Dice loss and eps, and parametrized * sigmoid -> softmax in dice loss * softmax2d * move softmax to models.py * parametrize softmax and sigmoid in dice loss * Dev mask prep speed up (#94) * distributed mask/distance/size generation added * dropped deprecated * dropped mask param * Dev random crop (#97) * local * added random cropping, refactored augmentations * Dev borders and dilation in preprocessing (#96) * merge multithread * preparing borders * fix PR #96 and add update metadata generation * Dev deeper archs (#102) * dropped mask param * added deeper resnets and spatial2d dropout * updated config * fixed casting * updated index * fix evaluate, add score builder in stream mode (#104) * added initial version * added simple evaluate on checkpoint script * updated config * added neptune file definition * fixed conflicts
- Loading branch information
1 parent
fe241ff
commit 3048a4b
Showing
6 changed files
with
88 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import yaml | ||
import subprocess | ||
import os | ||
|
||
import click | ||
|
||
MISSING_TRANSFORMERS = ['prediction_crop', | ||
'prediction_renamed', | ||
'mask_resize', | ||
'category_mapper', | ||
'mask_erosion', | ||
'labeler', | ||
'mask_dilation', | ||
'score_builder', | ||
'output'] | ||
|
||
|
||
@click.group() | ||
def main(): | ||
pass | ||
|
||
|
||
@main.command() | ||
@click.option('-e', '--experiment_dir', help='experiment that you want to run evaluation on', required=True) | ||
@click.option('-t', '--temp_inference_dir', help='temporary directory', required=True) | ||
@click.option('-n', '--neptune_file', help='neptne file path', required=True) | ||
def run(temp_inference_dir, experiment_dir, neptune_file): | ||
transformer_dir = os.path.join(temp_inference_dir, 'transformers') | ||
checkpoints_dir = os.path.join(temp_inference_dir, 'checkpoints') | ||
|
||
cmd = 'cp -rf {} {}'.format(experiment_dir, temp_inference_dir) | ||
subprocess.call(cmd, shell=True) | ||
|
||
cmd = 'cp {}/unet/best.torch {}/unet'.format(checkpoints_dir, transformer_dir) | ||
subprocess.call(cmd, shell=True) | ||
|
||
for missing_transformer in MISSING_TRANSFORMERS: | ||
cmd = 'touch {}/{}'.format(transformer_dir, missing_transformer) | ||
subprocess.call(cmd, shell=True) | ||
|
||
cmd = 'cp {} temporary_neptune.yaml'.format(neptune_file, checkpoints_dir, transformer_dir) | ||
subprocess.call(cmd, shell=True) | ||
|
||
cmd = 'cp {} temporary_neptune.yaml'.format(neptune_file, checkpoints_dir, transformer_dir) | ||
subprocess.call(cmd, shell=True) | ||
|
||
with open("temporary_neptune.yaml", 'r+') as f: | ||
doc = yaml.load(f) | ||
doc['parameters']['experiment_dir'] = temp_inference_dir | ||
|
||
with open("temporary_neptune.yaml", 'w+') as f: | ||
yaml.dump(doc, f, default_flow_style=False) | ||
|
||
cmd = 'neptune run --config temporary_neptune.yaml main.py -- evaluate -p unet_weighted_padded' | ||
subprocess.call(cmd, shell=True) | ||
|
||
cmd = 'rm temporary_neptune.yaml' | ||
subprocess.call(cmd, shell=True) | ||
|
||
cmd = 'rm -rf {}'.format(temp_inference_dir) | ||
subprocess.call(cmd, shell=True) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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