| 2094 | } |
| 2095 | |
| 2096 | void sam_print_usage(int argc, char ** argv, const sam_params & params) { |
| 2097 | fprintf(stderr, "usage: %s [options]\n", argv[0]); |
| 2098 | fprintf(stderr, "\n"); |
| 2099 | fprintf(stderr, "options:\n"); |
| 2100 | fprintf(stderr, " -h, --help show this help message and exit\n"); |
| 2101 | fprintf(stderr, " -s SEED, --seed SEED RNG seed (default: -1)\n"); |
| 2102 | fprintf(stderr, " -t N, --threads N number of threads to use during computation (default: %d)\n", params.n_threads); |
| 2103 | fprintf(stderr, " -m FNAME, --model FNAME\n"); |
| 2104 | fprintf(stderr, " model path (default: %s)\n", params.model.c_str()); |
| 2105 | fprintf(stderr, " -i FNAME, --inp FNAME\n"); |
| 2106 | fprintf(stderr, " input file (default: %s)\n", params.fname_inp.c_str()); |
| 2107 | fprintf(stderr, " -o FNAME, --out FNAME\n"); |
| 2108 | fprintf(stderr, " mask file name prefix (default: %s)\n", params.fname_out.c_str()); |
| 2109 | fprintf(stderr, " -sm, --single-mask\n"); |
| 2110 | fprintf(stderr, " single mask output (default multi mask output)\n"); |
| 2111 | fprintf(stderr, "SAM hyperparameters:\n"); |
| 2112 | fprintf(stderr, " -mt FLOAT, --mask-threshold\n"); |
| 2113 | fprintf(stderr, " mask threshold (default: %f)\n", params.mask_threshold); |
| 2114 | fprintf(stderr, " -it FLOAT, --iou-threshold\n"); |
| 2115 | fprintf(stderr, " iou threshold (default: %f)\n", params.iou_threshold); |
| 2116 | fprintf(stderr, " -st FLOAT, --score-threshold\n"); |
| 2117 | fprintf(stderr, " score threshold (default: %f)\n", params.stability_score_threshold); |
| 2118 | fprintf(stderr, " -so FLOAT, --score-offset\n"); |
| 2119 | fprintf(stderr, " score offset (default: %f)\n", params.stability_score_offset); |
| 2120 | fprintf(stderr, " -e FLOAT, --epsilon\n"); |
| 2121 | fprintf(stderr, " epsilon (default: %f)\n", params.eps); |
| 2122 | fprintf(stderr, " -ed FLOAT, --epsilon-decoder-transformer\n"); |
| 2123 | fprintf(stderr, " epsilon decoder transformer (default: %f)\n", params.eps_decoder_transformer); |
| 2124 | fprintf(stderr, "SAM prompt:\n"); |
| 2125 | fprintf(stderr, " -p [x,y], --point-prompt\n"); |
| 2126 | fprintf(stderr, " point to be used as prompt for SAM (default: %f,%f). Must be in a format FLOAT,FLOAT \n", params.prompt.pt.x, params.prompt.pt.y); |
| 2127 | fprintf(stderr, " -b [x1,y1,x2,y2], --box-prompt\n"); |
| 2128 | fprintf(stderr, " box to be used as prompt for SAM (default: %f,%f,%f,%f). Must be in a format FLOAT,FLOAT,FLOAT,FLOAT \n", |
| 2129 | params.prompt.box.x1, params.prompt.box.y1, params.prompt.box.x2, params.prompt.box.y2); |
| 2130 | fprintf(stderr, "\n"); |
| 2131 | } |
| 2132 | |
| 2133 | bool sam_params_parse(int argc, char ** argv, sam_params & params) { |
| 2134 | |