Skip to content

Commit e5f831d

Browse files
committed
v1.3.6
- 解决了sam2图像标注不支持cpu运行的问题。 - 优化了使用远程sam时,主界面的卡顿问题。
1 parent aa7bc92 commit e5f831d

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

ISAT/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# @Author : LG
33

44
__author__ = 'yatengLG'
5-
__version__ = '1.3.5'
5+
__version__ = '1.3.6'

ISAT/segment_any/sam2/build_sam.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
def build_sam2(
7272
config_file,
7373
ckpt_path=None,
74-
device="cuda",
74+
device="cuda" if torch.cuda.is_available() else "cpu",
7575
mode="eval",
7676
hydra_overrides_extra=[],
7777
apply_postprocessing=True,

ISAT/widgets/mainwindow.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
import numpy as np
3737
import torch
3838
import cv2 # 调整图像饱和度
39-
import datetime
4039
from skimage.draw.draw import polygon
4140
import requests
41+
import orjson
4242

4343

4444
class QtBoxStyleProgressBar(QtWidgets.QProgressBar):
@@ -93,9 +93,11 @@ def sam_encoder(self, image: np.ndarray):
9393
)
9494

9595
if response.status_code == 200:
96-
features = response.json()['features']
97-
original_size = tuple(response.json()['original_size'])
98-
input_size = tuple(response.json()['input_size'])
96+
data = orjson.loads(response.content)
97+
features = data["features"]
98+
original_size = data["original_size"]
99+
input_size = data["input_size"]
100+
99101
dtype = self.mainwindow.segany.model_dtype
100102
device = self.mainwindow.segany.device
101103

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ def get_install_requires():
6363
'tqdm>=4.66.1',
6464
'fuzzywuzzy',
6565
'python-Levenshtein',
66-
'iopath'
66+
'iopath',
67+
'orjson'
6768
],
6869

6970
classifiers=[

0 commit comments

Comments
 (0)