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

micro_sam.automatic_segmentation: embeddings #945

Closed
aloboa opened this issue Mar 18, 2025 · 5 comments
Closed

micro_sam.automatic_segmentation: embeddings #945

aloboa opened this issue Mar 18, 2025 · 5 comments

Comments

@aloboa
Copy link

aloboa commented Mar 18, 2025

I understand that, in micro_sam.automatic_segmentation,

  -e EMBEDDING_PATH, --embedding_path EMBEDDING_PATH
                        The path where the embeddings will be saved.

if embeddings do not exist, they are are created in that folder, but that if they exist, they are read from that folder

Correct?

@constantinpape
Copy link
Contributor

Yes, that is correct.

Note that you don't have to give that argument at all, in that case the embeddings will just be computed internally and will not be saved to a file.

@aloboa
Copy link
Author

aloboa commented Mar 18, 2025

Note that you don't have to give that argument at all, in that case the embeddings will just be computed internally and will not be saved to a file.

My understanding is that embeddings must be calculated for each image (and model) and then the same embeddings can be used with different values of
-pred_iou_thresh, --stability_score_thresh and --box_nms_thresh, to speed up the processing, correct?

BTW -pred_iou_thresh, --stability_score_thresh and --box_nms_thresh are not listed by the -h option:

$ micro_sam.automatic_segmentation -h
usage: micro_sam.automatic_segmentation [-h] -i INPUT_PATH -o OUTPUT_PATH [-e EMBEDDING_PATH] [--pattern PATTERN] [-k KEY]
                                        [-m MODEL_TYPE] [-c CHECKPOINT] [--tile_shape TILE_SHAPE [TILE_SHAPE ...]]
                                        [--halo HALO [HALO ...]] [-n NDIM] [--mode MODE] [--annotate] [-d DEVICE] [-v]

@constantinpape
Copy link
Contributor

constantinpape commented Mar 20, 2025

My understanding is that embeddings must be calculated for each image (and model) and then the same embeddings can be used with different values of
-pred_iou_thresh, --stability_score_thresh and --box_nms_thresh, to speed up the processing, correct?

Yes, that is correct.

BTW -pred_iou_thresh, --stability_score_thresh and --box_nms_thresh are not listed by the -h option:

Yes, this is because they are part of keyword arguments that depend on whether AMG or AIS is used. It is difficult to expose them as first class citizen in the CLI.

@constantinpape
Copy link
Contributor

I think the questions here are all resolved.

@aloboa
Copy link
Author

aloboa commented Mar 29, 2025

I think the questions here are all resolved.

Yes, but please see https://forum.image.sc/t/specifying-embeddings-in-suite-of-micro-sam-automatic-segmentation-runs/110549.

BTW -pred_iou_thresh, --stability_score_thresh and --box_nms_thresh are not listed by the -h option:

Yes, this is because they are part of keyword arguments that depend on whether AMG or AIS is used. It is difficult to expose them as first class citizen in the CLI.

It is more difficult to use the options if you do not even know they exist. An alternative would be having two separate commands, one for AMG and another for AIS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants