| 26 | from encoders import load_encoder_esVIT, load_encoder_resnet |
| 27 | |
| 28 | def get_args_parser(): |
| 29 | parser = argparse.ArgumentParser('Preprocessing script esvit', add_help=False) |
| 30 | parser.add_argument( |
| 31 | "--input_slide", |
| 32 | type=str, |
| 33 | help="Path to input WSI file", |
| 34 | ) |
| 35 | parser.add_argument( |
| 36 | "--output_dir", |
| 37 | type=str, |
| 38 | help="Directory to save output data", |
| 39 | ) |
| 40 | parser.add_argument( |
| 41 | "--checkpoint", |
| 42 | type=str, |
| 43 | help="Feature extractor weights checkpoint", |
| 44 | ) |
| 45 | parser.add_argument( |
| 46 | "--batch_size", |
| 47 | type=int, |
| 48 | default=512, |
| 49 | ) |
| 50 | parser.add_argument( |
| 51 | "--tile_size", |
| 52 | help="Desired tile size in microns (should be the same value as used in feature extraction model).", |
| 53 | type=int, |
| 54 | required=True, |
| 55 | ) |
| 56 | parser.add_argument( |
| 57 | "--out_size", |
| 58 | help="Resize the square tile to this output size (in pixels).", |
| 59 | type=int, |
| 60 | default=224, |
| 61 | ) |
| 62 | parser.add_argument( |
| 63 | "--method", |
| 64 | help="Segmentation method, otsu or stain deconv", |
| 65 | type=str, |
| 66 | default='otsu', |
| 67 | ) |
| 68 | parser.add_argument( |
| 69 | "--dist_threshold", |
| 70 | type=int, |
| 71 | default=4, |
| 72 | help="L2 norm distance when spatially merging pacthes.", |
| 73 | ) |
| 74 | parser.add_argument( |
| 75 | "--corr_threshold", |
| 76 | type=float, |
| 77 | default=0.6, |
| 78 | help="Cosine similarity distance when semantically merging pacthes.", |
| 79 | ) |
| 80 | parser.add_argument( |
| 81 | "--workers", |
| 82 | help="The number of workers to use for the data loader. Only relevant when using a GPU.", |
| 83 | type=int, |
| 84 | default=4, |
| 85 | ) |