segment-anything
segment-anything copied to clipboard
error occurs in python scritps
1st :masks,_, _ = predictor.predict('bed')
AssertionError: point_labels must be supplied if point_coords is supplied.
2ed: from segment_anything import build_sam, SamAutomaticMaskGenerator mask_generator = SamAutomaticMaskGenerator(build_sam(checkpoint=pth_path)) masks = mask_generator_generate(img) NameError: name 'mask_generator_generate' is not defined
how to deal with that ques?
mask_generator_generate ->mask_generator.generate is done!
thx! that's clear ,how about the 1st errors? what should I write the correct type of
I'm trying too! :)
Traceback (most recent call last):
File "/home/gabriel/workspace/MASKs/makeMasks.py", line 4, in
AttributeError: 'str' object has no attribute 'shape' Could not get it to work
AttributeError: 'str' object has no attribute 'shape' Could not get it to work
Has anyone solved this problem? I too have a 'str' object that has no 'shape' attribute. No idea how to deal with it. Help
seams like the object should be a numpi, but is a string, anyone?
像对象这样的接缝应该是一个 numpi,但是是一个字符串,有人吗?
img = cv2.imread("notebooks/images/dog.jpg") img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) predictor.set_image(img)
seams like the object should be a numpi, but is a string, anyone?
it's a NumPy array of an image
Should use cv2.imread() to load the image, this way will solve the problem saying " AttributeError: 'str' object has no attribute 'shape' "