Comments (6)
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.
@TaoTXiXi, can you share which line causes that issue?
from efficientsam.
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.
@TaoTXiXi, we checked EfficientSAM_example.py works well from our side. Can you create a new virtual env to rerun it?
from efficientsam.
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.
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)
- SqueezeSAM HOT 2
- CoreML HOT 2
- How to do Saliency segmentation? HOT 1
- Saliency Segment CODE WANTED HOT 3
- how to train our dataset?thanks for your answer HOT 2
- SAMI Module and Training Codes? HOT 4
- Segment Anything CPP Wrapper for macOS HOT 1
- Is there GPU support for box-prompted SAM? HOT 7
- why zero-shot instance segmentation on COCO dataset is bad HOT 1
- Is that possible using this as pretrained with LLaVa?> HOT 4
- What does input_labels mean? HOT 1
- multibox-prompt inference HOT 2
- EfficientSAM available on the Microscopy Imaging software Fiji HOT 1
- how to use background point HOT 1
- When there are multiple points as prompts (for example, more than five points), some point areas cannot be segmented. HOT 1
- pre-trained parameters
- pre-trained parameters
- Why is it slow to segment everything? Is there a good solution? HOT 1
- Is it possible to fine-tune it to extract single-category objects based only on mask prompt
- Wrong EfficientSAM model from Model_zoo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from efficientsam.