Spaces:
Running
Running
Update binary_segmentation.py
Browse files- binary_segmentation.py +2 -1
binary_segmentation.py
CHANGED
|
@@ -14,6 +14,7 @@ import torch.nn.functional as F
|
|
| 14 |
from PIL import Image
|
| 15 |
from torchvision import transforms
|
| 16 |
import cv2
|
|
|
|
| 17 |
|
| 18 |
# Configure logging
|
| 19 |
logging.basicConfig(
|
|
@@ -530,7 +531,7 @@ class BinarySegmenter:
|
|
| 530 |
|
| 531 |
# ✅ QUANTIZE to INT8 for CPU speedup
|
| 532 |
if DEVICE == "cpu":
|
| 533 |
-
|
| 534 |
self.model = torch.quantization.quantize_dynamic(
|
| 535 |
self.model,
|
| 536 |
{torch.nn.Linear, torch.nn.Conv2d},
|
|
|
|
| 14 |
from PIL import Image
|
| 15 |
from torchvision import transforms
|
| 16 |
import cv2
|
| 17 |
+
import torch.quantization
|
| 18 |
|
| 19 |
# Configure logging
|
| 20 |
logging.basicConfig(
|
|
|
|
| 531 |
|
| 532 |
# ✅ QUANTIZE to INT8 for CPU speedup
|
| 533 |
if DEVICE == "cpu":
|
| 534 |
+
|
| 535 |
self.model = torch.quantization.quantize_dynamic(
|
| 536 |
self.model,
|
| 537 |
{torch.nn.Linear, torch.nn.Conv2d},
|