Accelerate data driven research on embryos with deep learning models
Project description
Contents
- Example notebooks
- Segmenting the C. elegans embryo
- Generating synthetic images of embryos with a GAN
- Predicting populations of cells within the C. elegans embryo
- Contributing to DevoLearn
- Contact us
Installation
pip install devolearn
Example notebooks
Segmenting the C. elegans embryo
- Importing the model
from devolearn import embryo_segmentor
segmentor = embryo_segmentor()
- Running the model on an image and viewing the prediction
seg_pred = segmentor.predict(image_path = "sample_data/images/seg_sample.jpg")
plt.imshow(seg_pred)
plt.show()
- Running the model on a video and saving the predictions into a folder
filenames = segmentor.predict_from_video(video_path = "sample_data/videos/seg_sample.mov", centroid_mode = False, save_folder = "preds")
- Finding the centroids of the segmented features
seg_pred, centroids = segmentor.predict(image_path = "sample_data/images/seg_sample.jpg", centroid_mode = True)
plt.imshow(seg_pred)
plt.show()
- Saving the centroids from each frame into a CSV
df = segmentor.predict_from_video(video_path = "sample_data/videos/seg_sample.mov", centroid_mode = True, save_folder = "preds")
df.to_csv("centroids.csv")
Generating synthetic images of embryos with a Pre-trained GAN
- Importing the model
from devolearn import Generator, embryo_generator_model
generator = embryo_generator_model()
- Generating a picture and viewing it
gen_image = generator.generate()
plt.imshow(gen_image)
plt.show()
- Generating n images and saving them into
foldername
with a custom size
generator.generate_n_images(n = 5, foldername= "generated_images", image_size= (700,500))
Predicting populations of cells within the C. elegans embryo
- Importing the population model for inferences
from devolearn import lineage_population_model
- Loading a model instance to be used to estimate lineage populations of embryos from videos/photos.
model = lineage_population_model(mode = "cpu")
- Making a prediction from an image
print(model.predict(image_path = "sample_data/images/embryo_sample.png"))
- Making predictions from a video and saving the predictions into a CSV file
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 )
- Plotting the model's predictions from a video
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 )
plot.show()
Contact us
Authors/maintainers:
Feel free to join our Slack workspace!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
devolearn-0.2.0.tar.gz
(1.9 MB
view details)
Built Distribution
File details
Details for the file devolearn-0.2.0.tar.gz
.
File metadata
- Download URL: devolearn-0.2.0.tar.gz
- Upload date:
- Size: 1.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1e49dbc67322e2c98c292f94305712b1779c8c1c11936d3f410ed31f84d2a89 |
|
MD5 | 0d1690ae143b247b4f968143d61d55b8 |
|
BLAKE2b-256 | 58528e254218ab0587606170e3bf50db3506d37cc636d9ed19b37825d7f3e5dd |
File details
Details for the file devolearn-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: devolearn-0.2.0-py3-none-any.whl
- Upload date:
- Size: 1.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 495117e1582d6e16129bf5d1aff41e69c066113c84c8b79b279f52d349434957 |
|
MD5 | d265e32c9aa6b8b86e332c6c17510d49 |
|
BLAKE2b-256 | 17b3443b8a2914031f836b8a05226a33b16685d26ac012799edaefca3b9c21e9 |