Update sam2point/utils.py
Browse files- sam2point/utils.py +0 -11
sam2point/utils.py
CHANGED
|
@@ -8,8 +8,6 @@ import torch
|
|
| 8 |
def build_fold(path):
|
| 9 |
if os.path.exists(path):
|
| 10 |
return True
|
| 11 |
-
# shutil.rmtree(path)
|
| 12 |
-
# return True
|
| 13 |
os.makedirs(path)
|
| 14 |
return False
|
| 15 |
|
|
@@ -38,11 +36,8 @@ def visualize_frame_with_mask(grid0, grid1, grid2, a0_mask, a1_mask, a2_mask, po
|
|
| 38 |
|
| 39 |
def visualize_per_frame(grid, foldpath, resolution, args=None):
|
| 40 |
grid = torch.nn.functional.interpolate(grid, size=(resolution, resolution), mode=args.mode)
|
| 41 |
-
# gridb = torch.nn.functional.interpolate(grid, size=(256, 256), mode='nearest')
|
| 42 |
-
# grid = grida * 0.8 + gridb * 0.2
|
| 43 |
|
| 44 |
imgs = grid.cpu().numpy()
|
| 45 |
-
#print(imgs[0, :, 0:3, 0:3])
|
| 46 |
n, _, _, _ = grid.shape
|
| 47 |
for ii in range(n):
|
| 48 |
r = np.uint8(imgs[ii, 0, :, :]*255)
|
|
@@ -50,12 +45,6 @@ def visualize_per_frame(grid, foldpath, resolution, args=None):
|
|
| 50 |
b = np.uint8(imgs[ii, 2, :, :]*255)
|
| 51 |
img = cv2.merge([b, g, r])
|
| 52 |
|
| 53 |
-
# bilateralFilter
|
| 54 |
-
# img = cv2.bilateralFilter(img, d=-1, sigmaColor=25, sigmaSpace=7)
|
| 55 |
-
# img = cv2.bilateralFilter(img, d=9, sigmaColor=50, sigmaSpace=16)
|
| 56 |
-
# img = cv2.GaussianBlur(img, (5, 5), 0)
|
| 57 |
-
# img = cv2.medianBlur(img, 5)
|
| 58 |
-
|
| 59 |
cv2.imwrite('{}/{}.png'.format(foldpath, ii), img)
|
| 60 |
return
|
| 61 |
|
|
|
|
| 8 |
def build_fold(path):
|
| 9 |
if os.path.exists(path):
|
| 10 |
return True
|
|
|
|
|
|
|
| 11 |
os.makedirs(path)
|
| 12 |
return False
|
| 13 |
|
|
|
|
| 36 |
|
| 37 |
def visualize_per_frame(grid, foldpath, resolution, args=None):
|
| 38 |
grid = torch.nn.functional.interpolate(grid, size=(resolution, resolution), mode=args.mode)
|
|
|
|
|
|
|
| 39 |
|
| 40 |
imgs = grid.cpu().numpy()
|
|
|
|
| 41 |
n, _, _, _ = grid.shape
|
| 42 |
for ii in range(n):
|
| 43 |
r = np.uint8(imgs[ii, 0, :, :]*255)
|
|
|
|
| 45 |
b = np.uint8(imgs[ii, 2, :, :]*255)
|
| 46 |
img = cv2.merge([b, g, r])
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
cv2.imwrite('{}/{}.png'.format(foldpath, ii), img)
|
| 49 |
return
|
| 50 |
|