Spaces:
Running
Running
Update README.md
Browse files
README.md
CHANGED
@@ -8,4 +8,169 @@ pinned: false
|
|
8 |
license: mit
|
9 |
---
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
license: mit
|
9 |
---
|
10 |
|
11 |
+
<p align="center">
|
12 |
+
<img src = "https://raw.githubusercontent.com/DevoLearn/devolearn/master/images/banner_1.jpg">
|
13 |
+
</p>
|
14 |
+
|
15 |
+

|
16 |
+
[](https://codecov.io/gh/DevoLearn/devolearn)
|
17 |
+
[](https://github.com/DevoLearn/devolearn/issues)
|
18 |
+
[](https://github.com/DevoLearn/devolearn/graphs/contributors)
|
19 |
+
[](https://github.com/DevoLearn/devolearn/commits/master)
|
20 |
+
[](https://openworm.slack.com/archives/CMVFU7Q4W)
|
21 |
+
[](https://colab.research.google.com/github/DevoLearn/data-science-demos/blob/master/devolearn_docs/devolearn_quickstart.ipynb)
|
22 |
+
|
23 |
+
|
24 |
+
## Contents
|
25 |
+
|
26 |
+
* [Example notebooks](https://github.com/DevoLearn/devolearn#example-notebooks)
|
27 |
+
* [Segmenting the C. elegans embryo](https://github.com/DevoLearn/devolearn#segmenting-the-c-elegans-embryo)
|
28 |
+
* [Generating synthetic images of embryos with a GAN](https://github.com/DevoLearn/devolearn#generating-synthetic-images-of-embryos-with-a-pre-trained-gan)
|
29 |
+
* [Predicting populations of cells within the C. elegans embryo](https://github.com/DevoLearn/devolearn#predicting-populations-of-cells-within-the-c-elegans-embryo)
|
30 |
+
* [Contributing to DevoLearn](https://github.com/DevoLearn/devolearn/blob/master/.github/contributing.md#contributing-to-devolearn)
|
31 |
+
* [Links to datasets](https://github.com/DevoLearn/devolearn#links-to-datasets)
|
32 |
+
* [Contact us](https://github.com/DevoLearn/devolearn#authorsmaintainers)
|
33 |
+
|
34 |
+
|
35 |
+
### Installation
|
36 |
+
```python
|
37 |
+
pip install devolearn
|
38 |
+
```
|
39 |
+
### Example notebooks
|
40 |
+
<p align="center">
|
41 |
+
<img src = "https://raw.githubusercontent.com/DevoLearn/data-science-demos/master/Networks/nodes_matrix_long_smooth.gif" width = "40%">
|
42 |
+
<img src = "https://raw.githubusercontent.com/DevoLearn/data-science-demos/master/Networks/3d_node_map.gif" width = "40%">
|
43 |
+
</p>
|
44 |
+
|
45 |
+
* [Extracting centroid maps and making 3d centroid models](https://nbviewer.jupyter.org/github/DevoLearn/data-science-demos/blob/master/Networks/experiments_with_devolearn_node_maps.ipynb)
|
46 |
+
|
47 |
+
### Segmenting the Cell Membrane in C. elegans embryo
|
48 |
+
<p align="center">
|
49 |
+
<img src = "https://raw.githubusercontent.com/DevoLearn/devolearn/master/images/pred_centroids.gif" width = "80%">
|
50 |
+
</p>
|
51 |
+
|
52 |
+
* Importing the model
|
53 |
+
```python
|
54 |
+
from devolearn import cell_membrane_segmentor
|
55 |
+
segmentor = cell_membrane_segmentor()
|
56 |
+
|
57 |
+
```
|
58 |
+
|
59 |
+
* Running the model on an image and viewing the prediction
|
60 |
+
```python
|
61 |
+
seg_pred = segmentor.predict(image_path = "sample_data/images/seg_sample.jpg")
|
62 |
+
plt.imshow(seg_pred)
|
63 |
+
plt.show()
|
64 |
+
```
|
65 |
+
|
66 |
+
* Running the model on a video and saving the predictions into a folder
|
67 |
+
```python
|
68 |
+
filenames = segmentor.predict_from_video(video_path = "sample_data/videos/seg_sample.mov", centroid_mode = False, save_folder = "preds")
|
69 |
+
```
|
70 |
+
|
71 |
+
* Finding the centroids of the segmented features
|
72 |
+
```python
|
73 |
+
seg_pred, centroids = segmentor.predict(image_path = "sample_data/images/seg_sample.jpg", centroid_mode = True)
|
74 |
+
plt.imshow(seg_pred)
|
75 |
+
plt.show()
|
76 |
+
```
|
77 |
+
|
78 |
+
* Saving the centroids from each frame into a CSV
|
79 |
+
|
80 |
+
```python
|
81 |
+
df = segmentor.predict_from_video(video_path = "sample_data/videos/seg_sample.mov", centroid_mode = True, save_folder = "preds")
|
82 |
+
df.to_csv("centroids.csv")
|
83 |
+
```
|
84 |
+
|
85 |
+
### Segmenting the Cell Nucleus in C. elegans embryo
|
86 |
+
<p align="center">
|
87 |
+
<img src = "https://github.com/Mainakdeb/devolearn/blob/master/images/nucleus_segmentation.gif" width = "60%">
|
88 |
+
</p>
|
89 |
+
|
90 |
+
* Importing the model
|
91 |
+
```python
|
92 |
+
from devolearn import cell_nucleus_segmentor
|
93 |
+
segmentor = cell_nucleus_segmentor()
|
94 |
+
|
95 |
+
```
|
96 |
+
|
97 |
+
* Running the model on an image and viewing the prediction
|
98 |
+
```python
|
99 |
+
seg_pred = segmentor.predict(image_path = "sample_data/images/nucleus_seg_sample.jpg")
|
100 |
+
plt.imshow(seg_pred)
|
101 |
+
plt.show()
|
102 |
+
```
|
103 |
+
|
104 |
+
### Generating synthetic images of embryos with a Pre-trained GAN
|
105 |
+
<p align="center">
|
106 |
+
<img src = "https://raw.githubusercontent.com/devoworm/GSoC-2020/master/Pre-trained%20Models%20(DevLearning)/images/generated_embryos_3.gif" width = "30%">
|
107 |
+
</p>
|
108 |
+
|
109 |
+
* Importing the model
|
110 |
+
```python
|
111 |
+
from devolearn import Generator, embryo_generator_model
|
112 |
+
generator = embryo_generator_model()
|
113 |
+
|
114 |
+
```
|
115 |
+
|
116 |
+
* Generating a picture and viewing it with [matplotlib](https://matplotlib.org/)
|
117 |
+
```python
|
118 |
+
gen_image = generator.generate()
|
119 |
+
plt.imshow(gen_image)
|
120 |
+
plt.show()
|
121 |
+
|
122 |
+
```
|
123 |
+
|
124 |
+
* Generating n images and saving them into `foldername` with a custom size
|
125 |
+
|
126 |
+
```python
|
127 |
+
generator.generate_n_images(n = 5, foldername= "generated_images", image_size= (700,500))
|
128 |
+
```
|
129 |
+
|
130 |
+
---
|
131 |
+
|
132 |
+
### Predicting populations of cells within the C. elegans embryo
|
133 |
+
|
134 |
+
<p align="center">
|
135 |
+
<img src = "https://raw.githubusercontent.com/devoworm/GSoC-2020/master/Pre-trained%20Models%20(DevLearning)/images/resnet_preds_with_input.gif" width = "60%">
|
136 |
+
</p>
|
137 |
+
|
138 |
+
* Importing the population model for inferences
|
139 |
+
```python
|
140 |
+
from devolearn import lineage_population_model
|
141 |
+
```
|
142 |
+
|
143 |
+
* Loading a model instance to be used to estimate lineage populations of embryos from videos/photos.
|
144 |
+
```python
|
145 |
+
model = lineage_population_model(device = "cpu")
|
146 |
+
```
|
147 |
+
|
148 |
+
* Making a prediction from an image
|
149 |
+
```python
|
150 |
+
print(model.predict(image_path = "sample_data/images/embryo_sample.png"))
|
151 |
+
```
|
152 |
+
|
153 |
+
* Making predictions from a video and saving the predictions into a CSV file
|
154 |
+
```python
|
155 |
+
results = model.predict_from_video(video_path = "sample_data/videos/embryo_timelapse.mov", save_csv = True, csv_name = "video_preds.csv", ignore_first_n_frames= 10, ignore_last_n_frames= 10, postprocess = False)
|
156 |
+
```
|
157 |
+
|
158 |
+
* Plotting the model's predictions from a video
|
159 |
+
```python
|
160 |
+
plot = model.create_population_plot_from_video(video_path = "sample_data/videos/embryo_timelapse.mov", save_plot= True, plot_name= "plot.png", ignore_last_n_frames= 0, postprocess = False)
|
161 |
+
plot.show()
|
162 |
+
```
|
163 |
+
|
164 |
+
## Links to Datasets
|
165 |
+
| **Model** | **Data source** |
|
166 |
+
|-------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
167 |
+
| Segmenting the cell membrane in C. elegans embryo | [3DMMS: robust 3D Membrane Morphological Segmentation of C. elegans embryo](https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-019-2720-x#Abs1/) |
|
168 |
+
| Segmenting the nucleus in C. elegans embryo | [C. elegans Cell-Tracking-Challenge dataset](http://celltrackingchallenge.net/3d-datasets/)
|
169 |
+
| Cell lineage population prediction + embryo GAN | [EPIC dataset](https://epic.gs.washington.edu/)
|
170 |
+
|
171 |
+
## Authors/maintainers:
|
172 |
+
* [Mayukh Deb](https://twitter.com/mayukh091)
|
173 |
+
* [Ujjwal Singh](https://twitter.com/ujjjwalll)
|
174 |
+
* [Dr. Bradly Alicea](https://twitter.com/balicea1)
|
175 |
+
|
176 |
+
Feel free to join our [Slack workspace](https://openworm.slack.com/archives/CMVFU7Q4W)!
|