Update README.md
#13
by
artemtumch
- opened
README.md
CHANGED
|
@@ -113,6 +113,11 @@ torch.set_float32_matmul_precision(['high', 'highest'][0])
|
|
| 113 |
birefnet.to('cuda')
|
| 114 |
birefnet.eval()
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
def extract_object(birefnet, imagepath):
|
| 117 |
# Data settings
|
| 118 |
image_size = (1024, 1024)
|
|
@@ -124,6 +129,7 @@ def extract_object(birefnet, imagepath):
|
|
| 124 |
|
| 125 |
image = Image.open(imagepath)
|
| 126 |
input_images = transform_image(image).unsqueeze(0).to('cuda')
|
|
|
|
| 127 |
|
| 128 |
# Prediction
|
| 129 |
with torch.no_grad():
|
|
|
|
| 113 |
birefnet.to('cuda')
|
| 114 |
birefnet.eval()
|
| 115 |
|
| 116 |
+
print('BiRefNet is ready to use.')
|
| 117 |
+
|
| 118 |
+
birefnet.half()
|
| 119 |
+
print('Using half precision!')
|
| 120 |
+
|
| 121 |
def extract_object(birefnet, imagepath):
|
| 122 |
# Data settings
|
| 123 |
image_size = (1024, 1024)
|
|
|
|
| 129 |
|
| 130 |
image = Image.open(imagepath)
|
| 131 |
input_images = transform_image(image).unsqueeze(0).to('cuda')
|
| 132 |
+
input_images = input_images.half()
|
| 133 |
|
| 134 |
# Prediction
|
| 135 |
with torch.no_grad():
|