CASIA-IVA-Lab / FastSAM

Fast Segment Anything
GNU Affero General Public License v3.0
7.47k stars 707 forks source link

Minor error #64

Closed shersoni610 closed 1 year ago

shersoni610 commented 1 year ago

Hello,

I am running the cat example given in the image folder. On MAC-M1, I get the following error:

img_array = np.frombuffer(buf, dtype=np.uint8).reshape(rows, cols, 3) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: cannot reshape array of size 24883200 into shape (1920,1080,3)

can someone help?

zxDeepDiver commented 1 year ago

It seems you input a png file and it has the alpha channel.

csv610 commented 1 year ago

I used the example in the folder. What should I do?

zxDeepDiver commented 1 year ago

I used the example in the folder. What should I do?

Can you remove the alpha channel of your image? Only the rgb 3-channel is needed.

shersoni610 commented 1 year ago

It is jpg file in the image folder.

zxDeepDiver commented 1 year ago

It is jpg file in the image folder.

your image byte length is 1920 * 1080 * 4, I suggest you check the imread settings.

berry-ding commented 1 year ago

Hi @shersoni610, under MacOS-M1, Matplotlib has different default values. Please confirm that the following line of code can be executed. https://github.com/CASIA-IVA-Lab/FastSAM/blob/02d038259e997b6a92e9a8e8a2664979feafdacb/fastsam/prompt.py#L110C1-L111C40

zxDeepDiver commented 1 year ago

We will close this issue first. Feel free to reopen it if you have any questions.

csv610 commented 1 year ago

Hello I had to comment out two lines of  imwrite and the line above it to make the code work.

Sent from Yahoo Mail for iPhone

On Saturday, July 1, 2023, 1:20 AM, Wenchao Ding @.***> wrote:

Hi @shersoni610, under MacOS-M1, Matplotlib has different default values. Please confirm that the following line of code can be executed. https://github.com/CASIA-IVA-Lab/FastSAM/blob/02d038259e997b6a92e9a8e8a2664979feafdacb/fastsam/prompt.py#L110C1-L111C40

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>