CASIA-IVA-Lab / FastSAM

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

示例代码bbox多加了[] #128

Open Liu-yixi opened 1 year ago

HaoqianSong commented 11 months ago

/home/pcl/anaconda3/envs/FastSAM/bin/python /home/pcl/yolo/FastSAM/1.py

image 1/1 /home/pcl/yolo/FastSAM/images/dogs.jpg: 576x1024 16 objects, 273.5ms Speed: 2.9ms preprocess, 273.5ms inference, 42.2ms postprocess per image at shape (1, 3, 1024, 1024) Traceback (most recent call last): File "/home/pcl/yolo/FastSAM/1.py", line 14, in ann = prompt_process.box_prompt(bbox=[[200, 200, 300, 300]]) File "/home/pcl/yolo/FastSAM/fastsam/prompt.py", line 385, in box_prompt assert (bbox[2] != 0 and bbox[3] != 0) IndexError: list index out of range

最后的示例,运行是这个结果,你是说的这个问题吗?错误在# bbox default shape [0,0,0,0] -> [x1,y1,x2,y2] ann = prompt_process.box_prompt(bbox=[[200, 200, 300, 300]])此行代码,注释掉此行代码可以运行。报错为超出范围,不知道啥原因,你知道咋解决吗?

Liu-yixi commented 11 months ago

ann = prompt_process.box_prompt(bbox=[[200, 200, 300, 300]]) ->(改为) ann = prompt_process.box_prompt(bbox=[200, 200, 300, 300])

Liu-yixi commented 11 months ago

或者改为 ann = prompt_process.box_prompt(bboxs=[[200, 200, 300, 300]])

HaoqianSong commented 11 months ago

好的,谢谢

ErolCitak commented 10 months ago

We have just found the correct way to achieve this problem:

The only thing you need to change is the argument name;

Change this one: ann = prompt_process.box_prompt(bbox=[[500,750, 3700, 2800]]) To: ann = prompt_process.box_prompt(bboxes=[[200, 200, 300, 300]])

Please pay attention to argument name: "bbox" --> "bboxes"