Skin stretch regression using deep learning or Skinstression is a deep learning framework to predict the stress-strain curve of skin tissue. A convolutional neural network is trained on second harmonic generation images of skin tissue, matched with stretch measurements as targets.
Training data is not made publicly available.
A common CLI workflow includes:
Task | Terminal |
---|---|
Login to wandb | wandb login |
Initializing a sweep | wandb sweep sweep.yaml |
Running a wandb sweep agent | wandb agent |
Training a model | python train.py |
Predicting using a model | python predict.py |
For logging to wandb, it is required to login to wandb.
NOTE: please take a look at train.py
or predict.py
when training or predicting.
They contain settings you may need to change before launching scripts.
Some settings are consumed by Pytorch Lightning (docs).
Training with python train.py
will make a tmp
directory containing the splits.
Subsequent runs will reuse the splits.
Users can modify the splits.
Users can modify training parameters in train.py
.
Predict with python predict.py
, will make use of the tmp
directory containing the splits, or make the splits if they don't exist yet.
Data is read sequentially.
If save_plots=True
, plots are save to the tmp
directory.
Lines are color coded by slice index (which is not necessarily depth first, depending on the scanning protocol).
Running hyperparameter optimization can be done with Wandb Sweep.
First initialize the orchestrator with wandb sweep sweep.yaml
.
Then, on agent devices, run wandb agent <sweep id>
, where the sweep id given at initialization should be given.
Hyperparameter ranges can be configured with sweep.yaml
.
stacks.zarr
The SkinstressionDataset
and SkinstressionDataModule
rely on the iamges to be written to a zarr store.
Every 3D image should be saved separately in a zarr store.
This allows for easy migration to 3D models, which are currently not implemented, because they require a lot of GPU memory, not always available.
Use notebooks/13-sj-tozarr.ipynb
as a starting point to achieve conversion to Zarr.
params.csv
This is the target file. The first column indicates the sample. Subsequent columns indicate the target parameters.
sample_to_person.csv
File mapping samples (sample_id
) to person identifiers (person_id
).
curves/
This directory contains curves with <sample_id>.csv
and has columns strain
and stress
, making up the stress-strain curves.
params.csv
was calculated using these curves.
Any user can contribute their own models and datasets by modifying skinstression/dataset.py
or skinstression/model.py
.
Do below steps in a python environment. Skinstression is tested with python 3.11.
Install pytorch for your system. See pytorch.org.
Clone this repository and install the needed dependencies.
git clone https://github.com/siemdejong/skinstression
cd skinstression
pip install .
If you would like to make changes, install as editable with pip install -e .
.
Contributions are welcome.
- Create an issue.
- Fork this repository.
- Clone the fork.
- Make a new branch.
- Commit changes.
- Push the new branch to the fork.
- Make a pull request to this repository.