Lewislou commited on
Commit
d4776d1
1 Parent(s): 515facd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -7
README.md CHANGED
@@ -48,12 +48,13 @@ Here is how to use this model:
48
  ```python
49
 
50
  from skimage import io, segmentation, morphology, measure, exposure
51
- from cell_sribd_model import MyModel
52
  import numpy as np
53
  import tifffile as tif
54
  import requests
 
55
 
56
- img_name = 'cell_00010.png'
57
  def normalize_channel(img, lower=1, upper=99):
58
  non_zero_vals = img[np.nonzero(img)]
59
  percentiles = np.percentile(non_zero_vals, [lower, upper])
@@ -78,12 +79,10 @@ for i in range(3):
78
  img_channel_i = img_data[:,:,i]
79
  if len(img_channel_i[np.nonzero(img_channel_i)])>0:
80
  pre_img_data[:,:,i] = normalize_channel(img_channel_i, lower=1, upper=99)
81
-
82
-
83
- #config = ModelConfig()
84
- #print(config)
85
- my_model = MyModel.from_pretrained("Lewislou/cellseg_sribd")
86
  checkpoints = torch.load('model.pt')
 
87
  my_model.load_checkpoints(checkpoints)
88
  with torch.no_grad():
89
  output = my_model(pre_img_data)
 
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])
 
79
  img_channel_i = img_data[:,:,i]
80
  if len(img_channel_i[np.nonzero(img_channel_i)])>0:
81
  pre_img_data[:,:,i] = normalize_channel(img_channel_i, lower=1, upper=99)
82
+ #dummy_input = np.zeros((512,512,3)).astype(np.uint8)
83
+ my_model = MultiStreamCellSegModel.from_pretrained("Lewislou/cellseg_sribd")
 
 
 
84
  checkpoints = torch.load('model.pt')
85
+ my_model.__init__(ModelConfig())
86
  my_model.load_checkpoints(checkpoints)
87
  with torch.no_grad():
88
  output = my_model(pre_img_data)