Skip to content

Commit dc74199

Browse files
author
Mark-ZhouWX
committed
update text-inference
1 parent 2d41342 commit dc74199

File tree

4 files changed

+2
-5
lines changed

4 files changed

+2
-5
lines changed

official/cv/segment-anything/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ python text_inference.py --checkpoint=your/path/to/ckpt
116116

117117
Below is an experimental result prompted with `wheels`. _Note that the model is trained with limited data and the smallest SAM type `vit_b`._
118118
<div align="center">
119-
<img alt="img.png" src="images/blip2-text-prompt-wheel.jpg" width="600"/>
119+
<img alt="img.png" src="images/blip2-text-prompt-wheel.png" width="600"/>
120120
</div>
121121

122122
## Demo
Binary file not shown.
269 KB
Loading

official/cv/segment-anything/text_inference.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ def infer(args):
6565
print(f'prompt is: {args.text_prompt}')
6666
mask_logits = network(image, text_ids=input_ids)[0] # (1, 1, 1024, 1024)
6767

68-
with Timer('Second time inference'):
69-
mask_logits = network(image, text_ids=input_ids)[0] # (1, 1, 1024, 1024)
70-
7168
# Step3: post-process
7269
with Timer('post-process'):
7370
mask_logits = mask_logits.asnumpy()[0, 0] > 0.0
@@ -86,7 +83,7 @@ def infer(args):
8683

8784
if __name__ == '__main__':
8885
parser = argparse.ArgumentParser(description=("Runs inference on one image"))
89-
parser.add_argument("--image_path", type=str, default='./datasets/sa-1b/sa_000000/sa_1.jpg', help="Path to an input image.")
86+
parser.add_argument("--image_path", type=str, default='./images/truck.jpg', help="Path to an input image.")
9087
parser.add_argument(
9188
"--model-type",
9289
type=str,

0 commit comments

Comments
 (0)