ChaoningZhang / MobileSAM

This is the official code for MobileSAM project that makes SAM lightweight for mobile applications and beyond!
Apache License 2.0
4.68k stars 481 forks source link

Report two bugs in using MobileSAMv2 #127

Open GPIOX opened 9 months ago

GPIOX commented 9 months ago

Thank you for releasing MobileSAMv2. It is a useful tool in my research and saves more training time and memory

I would report two bugs in using MobileSAMv2 and I deal with these questions:

1. TypeError: 'type' object is not subscriptable: Many codes such as scale_factor: list[float] or None = None, report TypeError.

To do this correctly, maybe you should try:

from typing import List, Dict, Tuple scale_factor: List[float] or None = None

2. MobileSAMv2/efficientvit/models/nn/act.py: 21 Line: "gelu": partial(nn.GELU, approximate="tanh") report ValueError: partial object functools.partial(<class 'torch.nn.modules.activation.GELU'>, approximate='tanh') has incorrect arguments

My solution is replacing "partial(nn.GELU, approximate="tanh")" as nn.GELU

This is the first time I've used the issue feature, so I apologize for any mistakes.

yl17104265 commented 9 months ago

The first problem may be the python version, >= 3.9

yanzongs commented 6 months ago

Hello, may I ask if I have the following error, how should I solve it?

Traceback (most recent call last): File "D:\MobileSAM\MobileSAMv2\Inference.py", line 122, in main(args) File "D:\MobileSAM\MobileSAMv2\Inference.py", line 79, in main input_boxes1 = obj_results[0].boxes.xyxy TypeError: 'NoneType' object is not subscriptable

IuliaElisa commented 6 months ago

Hi, it usually means that the model didn't predict any object on that image, so the obj_results is empty.

yanzongs commented 6 months ago

Hi, it usually means that the model didn't predict any object on that image, so the obj_results is empty.

But I used the official photo input, why did I fail to predict the object? I also reported the same error when I used another photo input

moyans commented 5 months ago

python 3.9, same question