CLI works well on Windows
Browse files- livermask/livermask.py +2 -11
livermask/livermask.py
CHANGED
|
@@ -14,12 +14,8 @@ import pkg_resources
|
|
| 14 |
import tensorflow as tf
|
| 15 |
|
| 16 |
|
| 17 |
-
# due to this: https://github.com/tensorflow/tensorflow/issues/35029
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
# mute some warnings
|
| 22 |
-
warnings.filterwarnings('ignore', '.*output shape of zoom.*')
|
| 23 |
|
| 24 |
|
| 25 |
def intensity_normalization(volume, intensity_clipping_range):
|
|
@@ -32,7 +28,6 @@ def intensity_normalization(volume, intensity_clipping_range):
|
|
| 32 |
max_val = np.amax(result)
|
| 33 |
if (max_val - min_val) != 0:
|
| 34 |
result = (result - min_val) / (max_val - min_val)
|
| 35 |
-
|
| 36 |
return result
|
| 37 |
|
| 38 |
def post_process(pred):
|
|
@@ -40,15 +35,11 @@ def post_process(pred):
|
|
| 40 |
|
| 41 |
def get_model(output):
|
| 42 |
url = "https://drive.google.com/uc?id=12or5Q79at2BtLgQ7IaglNGPFGRlEgEHc"
|
| 43 |
-
# output = "./model.h5"
|
| 44 |
md5 = "ef5a6dfb794b39bea03f5496a9a49d4d"
|
| 45 |
gdown.cached_download(url, output, md5=md5) #, postprocess=gdown.extractall)
|
| 46 |
|
| 47 |
def func(path, output, cpu):
|
| 48 |
-
|
| 49 |
cwd = "/".join(os.path.realpath(__file__).replace("\\", "/").split("/")[:-1]) + "/"
|
| 50 |
-
|
| 51 |
-
print("Current cwd:", cwd)
|
| 52 |
name = cwd + "model.h5"
|
| 53 |
|
| 54 |
# get model
|
|
|
|
| 14 |
import tensorflow as tf
|
| 15 |
|
| 16 |
|
| 17 |
+
os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true' # due to this: https://github.com/tensorflow/tensorflow/issues/35029
|
| 18 |
+
warnings.filterwarnings('ignore', '.*output shape of zoom.*') # mute some warnings
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
def intensity_normalization(volume, intensity_clipping_range):
|
|
|
|
| 28 |
max_val = np.amax(result)
|
| 29 |
if (max_val - min_val) != 0:
|
| 30 |
result = (result - min_val) / (max_val - min_val)
|
|
|
|
| 31 |
return result
|
| 32 |
|
| 33 |
def post_process(pred):
|
|
|
|
| 35 |
|
| 36 |
def get_model(output):
|
| 37 |
url = "https://drive.google.com/uc?id=12or5Q79at2BtLgQ7IaglNGPFGRlEgEHc"
|
|
|
|
| 38 |
md5 = "ef5a6dfb794b39bea03f5496a9a49d4d"
|
| 39 |
gdown.cached_download(url, output, md5=md5) #, postprocess=gdown.extractall)
|
| 40 |
|
| 41 |
def func(path, output, cpu):
|
|
|
|
| 42 |
cwd = "/".join(os.path.realpath(__file__).replace("\\", "/").split("/")[:-1]) + "/"
|
|
|
|
|
|
|
| 43 |
name = cwd + "model.h5"
|
| 44 |
|
| 45 |
# get model
|