Skip to main content

3D cell shape analysis using geometric deep learning on point clouds

Project description

Python Version PyPI Downloads Wheel Development Status Tests Coverage Status Code style: black

Cellshape logo by Matt De Vries


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


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.1.1rc0.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cellshape_cloud-0.1.1rc0-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file cellshape-cloud-0.1.1rc0.tar.gz.

File metadata

  • Download URL: cellshape-cloud-0.1.1rc0.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for cellshape-cloud-0.1.1rc0.tar.gz
Algorithm Hash digest
SHA256 39b6a3c6b0dfb9d52dcb0da04597d7062130efa6d4ac5b47f9158792bad1a54e
MD5 8199632a4ee3bc48415856bcbf753e2d
BLAKE2b-256 e9edd396a04f36f6137002d229cca2682f4501d477156cab81108dfdd7a82f76

See more details on using hashes here.

File details

Details for the file cellshape_cloud-0.1.1rc0-py3-none-any.whl.

File metadata

File hashes

Hashes for cellshape_cloud-0.1.1rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 35ce027844a73d0b163442c869bfbaee05722e7b72afa59211ee2baa813bbf60
MD5 184a22b9c18005a965737d90e8245225
BLAKE2b-256 5138731de8ca7d42e24831bdc6963a78344c674c81f40321f690a2cf35e5447f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page