We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
**%cd /content/FastSAM import torch from PIL import Image import matplotlib.pyplot as plt from fastsam import FastSAM, FastSAMPrompt
model_path = "/content/FastSAM.pt" img_path = "/content/grid.png" device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = FastSAM(model_path)
input_image = Image.open(img_path).convert("RGB")
everything_results = model( input_image, device=device, retina_masks=True, imgsz=1024, conf=0.4, iou=0.9 )
prompt_process = FastSAMPrompt(input_image, everything_results, device=device) ann = prompt_process.everything_prompt()
result_image = prompt_process.plot( annotations=ann, withContours=True, better_quality=True, output_path='dahyun.png' )**
The text was updated successfully, but these errors were encountered:
No branches or pull requests
**%cd /content/FastSAM
import torch
from PIL import Image
import matplotlib.pyplot as plt
from fastsam import FastSAM, FastSAMPrompt
Set up parameters
model_path = "/content/FastSAM.pt"
img_path = "/content/grid.png"
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
Load model
model = FastSAM(model_path)
Load and process image
input_image = Image.open(img_path).convert("RGB")
Run inference
everything_results = model(
input_image,
device=device,
retina_masks=True,
imgsz=1024,
conf=0.4,
iou=0.9
)
Process results
prompt_process = FastSAMPrompt(input_image, everything_results, device=device)
ann = prompt_process.everything_prompt()
Plot results
result_image = prompt_process.plot(
annotations=ann,
withContours=True,
better_quality=True,
output_path='dahyun.png'
)**
The text was updated successfully, but these errors were encountered: