Commit
·
4c63fb6
1
Parent(s):
9faaf0e
Add half precision setting in README.
Browse files
README.md
CHANGED
@@ -124,6 +124,7 @@ birefnet = ... # -- BiRefNet should be loaded with codes above, either way.
|
|
124 |
torch.set_float32_matmul_precision(['high', 'highest'][0])
|
125 |
birefnet.to('cuda')
|
126 |
birefnet.eval()
|
|
|
127 |
|
128 |
def extract_object(birefnet, imagepath):
|
129 |
# Data settings
|
@@ -135,7 +136,7 @@ def extract_object(birefnet, imagepath):
|
|
135 |
])
|
136 |
|
137 |
image = Image.open(imagepath)
|
138 |
-
input_images = transform_image(image).unsqueeze(0).to('cuda')
|
139 |
|
140 |
# Prediction
|
141 |
with torch.no_grad():
|
|
|
124 |
torch.set_float32_matmul_precision(['high', 'highest'][0])
|
125 |
birefnet.to('cuda')
|
126 |
birefnet.eval()
|
127 |
+
birefnet.half()
|
128 |
|
129 |
def extract_object(birefnet, imagepath):
|
130 |
# Data settings
|
|
|
136 |
])
|
137 |
|
138 |
image = Image.open(imagepath)
|
139 |
+
input_images = transform_image(image).unsqueeze(0).to('cuda').half()
|
140 |
|
141 |
# Prediction
|
142 |
with torch.no_grad():
|