3D cell shape analysis using geometric deep learning on point clouds
Project description
Cellshape-cloud is an easy-to-use tool to analyse the shapes of cells using deep learning and, in particular, graph-neural networks. The tool provides the ability to train popular graph-based autoencoders on point cloud data of 2D and 3D single cell masks as well as providing pre-trained networks for inference.
To install
pip install cellshape-cloud
Usage
Basic Usage
import torch
from cellshape_cloud import CloudAutoEncoder
model = CloudAutoEncoder(num_features=128,
k=20,
encoder_type="dgcnn",
decoder_type="foldingnet")
points = torch.randn(1, 2048, 3)
recon, features = model(points)
To train an autoencoder on a set of point clouds created using cellshape-helper:
import torch
from torch.utils.data import DataLoader
import cellshape_cloud as cloud
from cellshape_cloud.vendor.chamfer_distance import ChamferLoss
input_dir = "path/to/pointcloud/files/"
batch_size = 16
learning_rate = 0.0001
num_epochs = 1
output_dir = "path/to/save/output/"
model = cloud.CloudAutoEncoder(num_features=128,
k=20,
encoder_type="dgcnn",
decoder_type="foldingnet")
dataset = cloud.PointCloudDataset(input_dir)
dataloader = DataLoader(dataset, batch_size=batch_size, shuffle=True)
criterion = ChamferLoss()
optimizer = torch.optim.Adam(
model.parameters(),
lr=learning_rate * 16 / batch_size,
betas=(0.9, 0.999),
weight_decay=1e-6,
)
cloud.train(model, dataloader, num_epochs, criterion, optimizer, output_dir)
Parameters
num_features
: int.
The size of the latent space of the autoencoder.k
: int.
The number of neightbours to use in the k-nearest-neighbours graph construction.encoder_type
: str.
The type of encoder: 'foldingnet' or 'dgcnn'decoder_type
: str.
The type of decoder: 'foldingnet' or 'dgcnn'
References
[1] An Tao, 'Unsupervised Point Cloud Reconstruction for Classific Feature Learning', GitHub Repo, 2020
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
cellshape-cloud-0.0.27.tar.gz
(15.7 kB
view details)
Built Distribution
File details
Details for the file cellshape-cloud-0.0.27.tar.gz
.
File metadata
- Download URL: cellshape-cloud-0.0.27.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d874ee3c3d4f933227d767641e5c80d1ba42f07b6e8af9035605d78fca5475a5 |
|
MD5 | 584413649bd4fce3f1f94656febe8207 |
|
BLAKE2b-256 | 5f4d76a2ea5dd8591380e17cf0428be91662ae1fc0539c81ac8ee340edd9d522 |
File details
Details for the file cellshape_cloud-0.0.27-py3-none-any.whl
.
File metadata
- Download URL: cellshape_cloud-0.0.27-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c7fbe38919f1d63dc1591209f419e68697805e7e5b2c95b276524f9e27eba3c |
|
MD5 | cda83127b2ed08946e445f08a0e66f11 |
|
BLAKE2b-256 | 2aff32d37383363cda996020f6a63e07a2e4ca1e9568a7e6b1f6008e0f7f3513 |