Update README.md
Browse files
README.md
CHANGED
|
@@ -47,14 +47,18 @@ Here is how to use this model:
|
|
| 47 |
|
| 48 |
```python
|
| 49 |
|
|
|
|
| 50 |
from skimage import io, segmentation, morphology, measure, exposure
|
| 51 |
from sribd_cellseg_models import MultiStreamCellSegModel,ModelConfig
|
| 52 |
import numpy as np
|
| 53 |
import tifffile as tif
|
| 54 |
import requests
|
| 55 |
import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
img_name = 'cell_00023.tiff'
|
| 58 |
def normalize_channel(img, lower=1, upper=99):
|
| 59 |
non_zero_vals = img[np.nonzero(img)]
|
| 60 |
percentiles = np.percentile(non_zero_vals, [lower, upper])
|
|
@@ -86,5 +90,8 @@ my_model.__init__(ModelConfig())
|
|
| 86 |
my_model.load_checkpoints(checkpoints)
|
| 87 |
with torch.no_grad():
|
| 88 |
output = my_model(pre_img_data)
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
```
|
|
|
|
| 47 |
|
| 48 |
```python
|
| 49 |
|
| 50 |
+
|
| 51 |
from skimage import io, segmentation, morphology, measure, exposure
|
| 52 |
from sribd_cellseg_models import MultiStreamCellSegModel,ModelConfig
|
| 53 |
import numpy as np
|
| 54 |
import tifffile as tif
|
| 55 |
import requests
|
| 56 |
import torch
|
| 57 |
+
from PIL import Image
|
| 58 |
+
from overlay import visualize_instances_map
|
| 59 |
+
import cv2
|
| 60 |
+
img_name = 'test_images/cell_00551.tiff'
|
| 61 |
|
|
|
|
| 62 |
def normalize_channel(img, lower=1, upper=99):
|
| 63 |
non_zero_vals = img[np.nonzero(img)]
|
| 64 |
percentiles = np.percentile(non_zero_vals, [lower, upper])
|
|
|
|
| 90 |
my_model.load_checkpoints(checkpoints)
|
| 91 |
with torch.no_grad():
|
| 92 |
output = my_model(pre_img_data)
|
| 93 |
+
overlay = visualize_instances_map(pre_img_data,star_label)
|
| 94 |
+
cv2.imwrite('prediction.png', cv2.cvtColor(overlay, cv2.COLOR_RGB2BGR))
|
| 95 |
+
|
| 96 |
|
| 97 |
```
|