Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,170 @@
|
|
1 |
---
|
2 |
license: mit
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
---
|
4 |
+
|
5 |
+
<p align="center">
|
6 |
+
<img src = "https://raw.githubusercontent.com/DevoLearn/devolearn/master/images/banner_1.jpg">
|
7 |
+
</p>
|
8 |
+
|
9 |
+

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