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

Running very slowly #136

Open
CurryKd7 opened this issue Sep 14, 2024 · 0 comments
Open

Running very slowly #136

CurryKd7 opened this issue Sep 14, 2024 · 0 comments

Comments

@CurryKd7
Copy link

image_path = ("/home/dongjun/zdj/code/CAST-simple/data/cityscapes/leftImg8bit/train/aachen"
"/aachen_000000_000019_leftImg8bit.png")

加载图像

raw_image = np.array(Image.open(image_path).convert("RGB"))

st = time.time()

构建模型

efficientvit_sam = create_sam_model(
name="xl1", weight_url="/home/dongjun/zdj/model/Efficientvit_sam/xl1.pt",
)
efficientvit_sam = efficientvit_sam.cuda().eval()
efficientvit_mask_generator = EfficientViTSamAutomaticMaskGenerator(efficientvit_sam)
masks, feat = efficientvit_mask_generator.generate(raw_image)
class EfficientViTSamAutomaticMaskGenerator(SamAutomaticMaskGenerator):
def init(
self,
model: EfficientViTSam,
points_per_side: int or None = 64,
points_per_batch: int = 128,
pred_iou_thresh: float = 0.86,
stability_score_thresh: float = 0.92,
stability_score_offset: float = 0.7,
box_nms_thresh: float = 0.7,
crop_n_layers: int = 0,
crop_nms_thresh: float = 0.7,
crop_overlap_ratio: float = 512 / 1500,
crop_n_points_downscale_factor: int = 1,
point_grids: list[np.ndarray] or None = None,
min_mask_region_area: int = 25,
output_mode: str = "binary_mask",

The above is my segmentation of a single image and the selection of some parameters. The running time is about 10 seconds or more, and it is not as efficient as SAM. May I ask why?

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

1 participant