Coder Social home page Coder Social logo

Comments (6)

hideinthesoul avatar hideinthesoul commented on August 15, 2024 1

in efficient_sam.py, modify line 156 and 161:
def get_rescaled_pts(self, batched_points: torch.Tensor, input_h: int, input_w: int): return torch.stack( [ torch.where( batched_points[..., 0] >= 0, batched_points[..., 0] * self.image_encoder.img_size / input_w, **torch.tensor(-1.0, device=batched_points.device).float()**, ### modify -1 to this ), torch.where( batched_points[..., 1] >= 0, batched_points[..., 1] * self.image_encoder.img_size / input_h, **torch.tensor(-1.0, device=batched_points.device).float()**, ### modify -1 to this ), ], dim=-1, )

from efficientsam.

yformer avatar yformer commented on August 15, 2024

@TaoTXiXi, can you share which line causes that issue?

from efficientsam.

TaoTXiXi avatar TaoTXiXi commented on August 15, 2024

Sure, this is where the error occurred.
Traceback (most recent call last):
File "G:/mycode/PythonCode/EfficientSAM-main/EfficientSAM_example.py", line 37, in
predicted_logits, predicted_iou = model(
File "D:\software\Miniconda3\envs\myProject\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "G:\mycode\PythonCode\EfficientSAM-main\efficient_sam\efficient_sam.py", line 207, in forward
return self.predict_masks(
File "G:\mycode\PythonCode\EfficientSAM-main\efficient_sam\efficient_sam.py", line 83, in predict_masks
rescaled_batched_points = self.get_rescaled_pts(batched_points, input_h, input_w)
File "G:\mycode\PythonCode\EfficientSAM-main\efficient_sam\efficient_sam.py", line 153, in get_rescaled_pts
torch.where(
RuntimeError: expected scalar type float but found double.

from efficientsam.

yformer avatar yformer commented on August 15, 2024

@TaoTXiXi, we checked EfficientSAM_example.py works well from our side. Can you create a new virtual env to rerun it?

from efficientsam.

hjinnkim avatar hjinnkim commented on August 15, 2024

Hello! I have encountered exactly same issue with @TaoTXiXi . I'm using conda environment with torch==1.11 with cuda==11.3.

If you don't mind, can you share your virtual environment configurations @yformer ?

from efficientsam.

hjinnkim avatar hjinnkim commented on August 15, 2024

Never mind, I solved the problem after upgrading my torch version from 1.11 to 1.12.1. I think older versions of torch have error with torch.where function.

from efficientsam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.