Update app.py
Browse files
app.py
CHANGED
|
@@ -166,6 +166,7 @@ def run_model_gpu240(img, max_iter):
|
|
| 166 |
masks, flows, _ = model.eval(img, niter = max_iter)#, channels = [0,0])
|
| 167 |
return masks, flows
|
| 168 |
|
|
|
|
| 169 |
from zipfile import ZipFile
|
| 170 |
def cellpose_segment(filepath, resize = 1000,max_iter = 250):
|
| 171 |
|
|
@@ -173,7 +174,9 @@ def cellpose_segment(filepath, resize = 1000,max_iter = 250):
|
|
| 173 |
#zip_path = 'masks.zip'
|
| 174 |
with ZipFile(zip_path, 'w') as myzip:
|
| 175 |
for j in range((len(filepath))):
|
| 176 |
-
|
|
|
|
|
|
|
| 177 |
img_input = imread(filepath[j])
|
| 178 |
#img_input = np.array(img_pil)
|
| 179 |
img = image_resize(img_input, resize = resize)
|
|
@@ -188,7 +191,8 @@ def cellpose_segment(filepath, resize = 1000,max_iter = 250):
|
|
| 188 |
else:
|
| 189 |
raise ValueError("Image size must be less than 20,000")
|
| 190 |
|
| 191 |
-
print(masks.max())
|
|
|
|
| 192 |
target_size = (img_input.shape[1], img_input.shape[0])
|
| 193 |
if (target_size[0]!=img.shape[1] or target_size[1]!=img.shape[0]):
|
| 194 |
# scale it back to keep the orignal size
|
|
|
|
| 166 |
masks, flows, _ = model.eval(img, niter = max_iter)#, channels = [0,0])
|
| 167 |
return masks, flows
|
| 168 |
|
| 169 |
+
import datetime
|
| 170 |
from zipfile import ZipFile
|
| 171 |
def cellpose_segment(filepath, resize = 1000,max_iter = 250):
|
| 172 |
|
|
|
|
| 174 |
#zip_path = 'masks.zip'
|
| 175 |
with ZipFile(zip_path, 'w') as myzip:
|
| 176 |
for j in range((len(filepath))):
|
| 177 |
+
now = datetime.datetime.now()
|
| 178 |
+
formatted_now = now.strftime("%Y-%m-%d %H:%M:%S")
|
| 179 |
+
|
| 180 |
img_input = imread(filepath[j])
|
| 181 |
#img_input = np.array(img_pil)
|
| 182 |
img = image_resize(img_input, resize = resize)
|
|
|
|
| 191 |
else:
|
| 192 |
raise ValueError("Image size must be less than 20,000")
|
| 193 |
|
| 194 |
+
print(formatted_now, j, masks.max(), os.path.split(filepath[j])[-1]))
|
| 195 |
+
|
| 196 |
target_size = (img_input.shape[1], img_input.shape[0])
|
| 197 |
if (target_size[0]!=img.shape[1] or target_size[1]!=img.shape[0]):
|
| 198 |
# scale it back to keep the orignal size
|