Skip to content
Permalink
Browse files

fix(preprocessor): add numpy transform

  • Loading branch information...
jemmyshin committed Oct 15, 2019
1 parent cfee124 commit 24e41bec439b81a14bc602f548c385cbe9b508c9
Showing with 6 additions and 3 deletions.
  1. +6 −3 gnes/preprocessor/helper.py
@@ -388,9 +388,12 @@ def detect_peak_boundary(distances: List[float],


def torch_transform(img):
import torchvision.transforms as transforms
return transforms.Compose([transforms.ToTensor(),
transforms.Normalize(mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5))])(img)
try:
import torchvision.transforms as transforms
return transforms.Compose([transforms.ToTensor(),
transforms.Normalize(mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5))])(img)
except (ImportError, ModuleNotFoundError):
return np.asarray(img) * 2 / 255. - 1.


def get_all_subarea(img):

0 comments on commit 24e41be

Please sign in to comment.
You can’t perform that action at this time.