Skip to content

Commit be1212d

Browse files
committed
adds pdf thumbnail
1 parent 9c6cd76 commit be1212d

File tree

5 files changed

+87
-71
lines changed

5 files changed

+87
-71
lines changed

README.md

Lines changed: 83 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
# DermSynth3D
2-
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/sfu-mial/DermSynth3D/tree/main.svg?style=svg&circle-token=176de57353747d240e619bdf9aacf9f716e7d04f)](https://dl.circleci.com/status-badge/redirect/gh/sfu-mial/DermSynth3D/tree/main)
2+
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/sfu-mial/DermSynth3D/tree/main.svg?style=svg&circle-token=176de57353747d240e619bdf9aacf9f716e7d04f)](https://dl.circleci.com/status-badge/redirect/gh/sfu-mial/DermSynth3D/tree/main)
33
![GPLv3](https://img.shields.io/static/v1.svg?label=📃%20License&message=GPL%20v3.0&color=critical&style=flat-square)
4-
[![arXiv](https://img.shields.io/static/v1.svg?label=📄%20arXiv&message=2305.12621&color=important&style=flat-square)](https://arxiv.org/abs/2305.12621)
5-
[![DOI](https://img.shields.io/static/v1.svg?label=📄%20DOI&message=DOI&color=informational&style=flat-square)](https://doi.org/10.48550/arXiv.2305.12621)
4+
[![arXiv](https://img.shields.io/static/v1.svg?label=📄%20arXiv&message=2305.12621&color=important&style=flat-square)](https://arxiv.org/abs/2305.12621)
5+
[![DOI](https://img.shields.io/static/v1.svg?label=📄%20DOI&message=DOI&color=informational&style=flat-square)](https://doi.org/10.48550/arXiv.2305.12621)
66
[![request dataset](https://img.shields.io/static/v1.svg?label=Dataset&message=Request%20Dataset&style=flat-square&color=blueviolet)](https://cvi2.uni.lu/3dbodytexdermsynth/)
77
[![Video](https://img.shields.io/badge/Video-Youtube-ff69b4?style=flat-square)](https://www.youtube.com/watch?v=x3gDBJCI_3k)
88

9-
This is the official code repository following our work [DermSynth3D](https://arxiv.org/pdf/2305.12621.pdf).
9+
:scroll: This is the official code repository for **DermSynth3D**.
1010

11-
[![Video Thumbnail](assets/DERMSYNTH_YOUTUBE_THUMB.png)](http://www.youtube.com/watch?v=x3gDBJCI_3k)
11+
<a href="docs/preprint.pdf">
12+
<img src="assets/thumbnail1.png" alt="PDF thumbnail" height=auto width="100%">
13+
</a>
14+
15+
16+
:tv: Check out the video abstract for this work:
17+
[![Video Thumbnail](assets/DERMSYNTH_YOUTUBE_THUMB.png)](http://www.youtube.com/watch?v=x3gDBJCI_3k)
1218

1319
## TL;DR
1420

1521
A data generation pipeline for creating photorealistic _in-the-wild_ synthetic dermatological data with rich annotations such as semantic segmentation masks, depth maps, and bounding boxes for various skin analysis tasks.
1622

17-
![main pipeline](assets/pipeline.png)
23+
![main pipeline](assets/pipeline.png)
1824
>_The figure shows the DermSynth3D computational pipeline where 2D segmented skin conditions are blended into the texture image of a 3D mesh on locations outside of the hair and clothing regions. After blending, 2D views of the mesh are rendered with a variety of camera viewpoints and lighting conditions and combined with background images to create a synthetic dermatology dataset._
1925
2026
## Motivation
@@ -39,10 +45,10 @@ DermSynth3D/
3945
┣ out/ # the checkpoints are saved here (auto created)
4046
┣ data/ # directory to store the data
4147
┃ ┣ ... # detailed instructions in the dataset.md
42-
┣ dermsynth3d/ #
48+
┣ dermsynth3d/ #
4349
┃ ┣ datasets/ # class definitions for the datasets
4450
┃ ┣ deepblend/ # code for deep blending
45-
┃ ┣ losses/ # loss functions
51+
┃ ┣ losses/ # loss functions
4652
┃ ┣ models/ # model definitions
4753
┃ ┣ tools/ # wrappers for synthetic data generation
4854
┃ ┗ utils/ # helper functions
@@ -52,30 +58,38 @@ DermSynth3D/
5258
```
5359

5460
## Table of Contents
55-
- [Installation](#installation)
56-
- [using conda](#using-conda)
57-
- [using Docker](#using-docker) **recommended**
58-
- [Datasets](#datasets)
59-
- [Data for Blending](#data-for-blending)
60-
- [3DBodyTex.v1 dataset](#download-3dbodytexv1-meshes)
61-
- [3DBodyTex.v1 annotations](#download-the-3dbodytexv1-annotations)
62-
- [Fitzpatrick17k dataset](#download-the-fitzpatrick17k-dataset)
63-
- [Background Scenes](#download-the-background-scenes)
64-
- [Data For Training](#data-for-training)
65-
- [FUSeg dataset](#download-the-fuseg-dataset)
66-
- [Pratheepan dataset](#download-the-pratheepan-dataset)
67-
- [PH2 dataset](#download-the-ph2-dataset)
68-
- [DermoFit dataset](#download-the-dermofit-dataset)
69-
- [Creating the Synthetic dataset](#creating-the-synthetic-dataset)
70-
- [How to Use DermSynth3D](#how-to-use-dermsynth3d)
71-
- [Generating Synthetic Dataset](#generating-synthetic-dataset)
72-
- [Post-Process Renderings with Unity](#post-process-renderings-with-unity)
73-
- [Preparing Dataset for Experiments](#preparing-dataset-for-experiments)
74-
- [Cite](#cite)
75-
- [Demo Notebooks for Dermatology Tasks](#demo-notebooks-for-dermatology-tasks)
76-
- [Lesion Segmentation](#lesion-segmentation)
77-
- [Multi-Task Prediction](#multi-task-prediction)
78-
- [Lesion Detection](#lesion-detection)
61+
- [DermSynth3D](#dermsynth3d)
62+
- [TL;DR](#tldr)
63+
- [Motivation](#motivation)
64+
- [Repository layout](#repository-layout)
65+
- [Table of Contents](#table-of-contents)
66+
- [Installation](#installation)
67+
- [using conda](#using-conda)
68+
- [using Docker](#using-docker)
69+
- [Datasets](#datasets)
70+
- [The folder structure of data directory should be as follows:](#the-folder-structure-of-data-directory-should-be-as-follows)
71+
- [Data for Blending](#data-for-blending)
72+
- [Download 3DBodyTex.v1 meshes](#download-3dbodytexv1-meshes)
73+
- [Download the 3DBodyTex.v1 annotations](#download-the-3dbodytexv1-annotations)
74+
- [Download the Fitzpatrick17k dataset](#download-the-fitzpatrick17k-dataset)
75+
- [Download the Background Scenes](#download-the-background-scenes)
76+
- [Data For Training](#data-for-training)
77+
- [Download the FUSeg dataset](#download-the-fuseg-dataset)
78+
- [Download the Pratheepan dataset](#download-the-pratheepan-dataset)
79+
- [Download the PH2 dataset](#download-the-ph2-dataset)
80+
- [Download the DermoFit dataset](#download-the-dermofit-dataset)
81+
- [Creating the Synthetic dataset](#creating-the-synthetic-dataset)
82+
- [How to Use DermSynth3D](#how-to-use-dermsynth3d)
83+
- [Generating Synthetic Dataset](#generating-synthetic-dataset)
84+
- [Post-Process Renderings with Unity](#post-process-renderings-with-unity)
85+
- [Click to see the a visual comparison of the renderings obtained from Pytorch3D and Unity.](#click-to-see-the-a-visual-comparison-of-the-renderings-obtained-from-pytorch3d-and-unity)
86+
- [Preparing Dataset for Experiments](#preparing-dataset-for-experiments)
87+
- [Cite](#cite)
88+
- [Demo Notebooks for Dermatology Tasks](#demo-notebooks-for-dermatology-tasks)
89+
- [Lesion Segmentation](#lesion-segmentation)
90+
- [Multi-Task Prediction](#multi-task-prediction)
91+
- [Lesion Detection](#lesion-detection)
92+
- [Acknowledgements](#acknowledgements)
7993

8094
<a name="installation"></a>
8195

@@ -86,7 +100,7 @@ DermSynth3D/
86100
#### using conda
87101

88102
```bash
89-
git clone --recurse-submodules https://github.com/sfu-mial/DermSynth3D.git
103+
git clone --recurse-submodules https://github.com/sfu-mial/DermSynth3D.git
90104
cd DermSynth3D
91105
conda env create -f dermsynth3d.yml
92106
conda activate dermsynth3d
@@ -100,7 +114,7 @@ conda activate dermsynth3d
100114
# Build the container in the root dir
101115
docker build -t dermsynth3d --build-arg UID=$(id -u) --build-arg GID=$(id -g) -f Dockerfile .
102116
# Run the container in interactive mode for using DermSynth3D
103-
# See 3. How to use DermSynth3D
117+
# See 3. How to use DermSynth3D
104118
docker run --gpus all -it --rm -v /path/to/downloaded/data:/data dermsynth3d
105119
```
106120
We provide the [pre-built docker image](https://hub.docker.com/r/sinashish/dermsynth3d), which can be be used as well:
@@ -122,17 +136,17 @@ If you face any issues installing pytorch3d, please refer to their [installation
122136
## Datasets
123137

124138
Follow the instructions below to download the datasets for generating the synthetic data and training models for various tasks.
125-
All the datasets should be downloaded and placed in the `data` directory.
139+
All the datasets should be downloaded and placed in the `data` directory.
126140

127141
<a name="tree"></a>
128142

129143
<!-- #### The folder structure of data directory should be as follows: -->
130144
<details>
131145

132146
<a name="data_tree"></a>
133-
<summary>
147+
<summary>
134148

135-
### The folder structure of data directory should be as follows:
149+
### The folder structure of data directory should be as follows:
136150

137151
</summary>
138152

@@ -144,12 +158,12 @@ DermSynth3D/
144158
┃ ┣ fitzpatrick17k/
145159
┃ ┃ ┣ data/ # Fitzpatrick17k images
146160
┃ ┃ ┗ annotations/ # annotations for Fitzpatrick17k lesions
147-
┃ ┣ ph2/
161+
┃ ┣ ph2/
148162
┃ ┃ ┣ images/ # PH2 images
149163
┃ ┃ ┗ labels/ # PH2 annotations
150164
┃ ┣ dermofit/ # Dermofit dataset
151-
┃ ┃ ┣ images/ # Dermofit images
152-
┃ ┃ ┗ targets/ # Dermofit annotations
165+
┃ ┃ ┣ images/ # Dermofit images
166+
┃ ┃ ┗ targets/ # Dermofit annotations
153167
┃ ┣ FUSeg/
154168
┃ ┃ ┣ train/ # training set with images/labels for FUSeg
155169
┃ ┃ ┣ validation/ # val set with images/labels for FUSeg
@@ -173,12 +187,12 @@ The datasets used in this work can be broadly categorized into data required for
173187

174188
<a name="blend_data"></a>
175189
<summary>
176-
190+
177191
### Data for Blending
178192

179193
</summary> <blockquote>
180194
<!-- list of blending datasets -->
181-
<details>
195+
<details>
182196
<a name="mesh_data"></a>
183197
<summary>
184198

@@ -193,11 +207,11 @@ The datasets used in this work can be broadly categorized into data required for
193207

194208
The `3DBodyTex.v1` dataset can be downloaded from [here](https://cvi2.uni.lu/3dbodytexv1/).
195209

196-
`3DBodyTex.v1` contains the meshes and texture images used in this work and can be downloaded from the external site linked above (after accepting a license agreement).
210+
`3DBodyTex.v1` contains the meshes and texture images used in this work and can be downloaded from the external site linked above (after accepting a license agreement).
197211

198212
**NOTE**: These textured meshes are needed to run the code to generate the data.
199213

200-
We provide the non-skin texture maps annotations for 2 meshes: `006-f-run` and `221-m-u`.
214+
We provide the non-skin texture maps annotations for 2 meshes: `006-f-run` and `221-m-u`.
201215
Hence, to generate the data, make sure to get the `.obj` files for these two meshes and place them in `data/3dbodytex-1.1-highres` before excecuting `scripts/gen_data.py`.
202216

203217
After accepting the licence, download and unzip the data in `./data/`.
@@ -207,7 +221,7 @@ The datasets used in this work can be broadly categorized into data required for
207221
<details>
208222
<a name="mesh_annot_data"></a>
209223
<summary>
210-
224+
211225
### Download the 3DBodyTex.v1 annotations
212226

213227

@@ -242,16 +256,16 @@ The datasets used in this work can be broadly categorized into data required for
242256
We used the skin conditions from [Fitzpatrick17k](https://github.com/mattgroh/fitzpatrick17k).
243257
See their instructions to get access to the Fitzpatrick17k images.
244258
We provide the raw images for the Fitzpatrick17k dataset [here](https://vault.sfu.ca/index.php/s/cMuxZNzk6UUHNmX).
245-
259+
246260
After downloading the dataset, unzip the dataset:
247261
```bash
248262
unzip fitzpatrick17k.zip -d data/fitzpatrick17k/
249263
```
250-
264+
251265
We provide a few samples of the densely annotated lesion masks from the Fitzpatrick17k dataset within this repository under the `data` directory.
252266

253-
More of such annotations can be downloaded from [here](https://vault.sfu.ca/index.php/s/gemdbCeoZXoCqlS).
254-
267+
More of such annotations can be downloaded from [here](https://vault.sfu.ca/index.php/s/gemdbCeoZXoCqlS).
268+
255269
</details>
256270

257271
<details>
@@ -264,7 +278,7 @@ The datasets used in this work can be broadly categorized into data required for
264278

265279
![bg_scenes](./assets/readme_bg.png)
266280
>_A few examples of the background scenes used for rendering the synthetic data._
267-
<!--
281+
<!--
268282
|||
269283
|:-:|:-:|
270284
|![scene1](./assets/50.jpg)|![scene2](./assets/700.jpg)| -->
@@ -280,7 +294,7 @@ The datasets used in this work can be broadly categorized into data required for
280294
<a name="train_data"></a>
281295
<summary>
282296

283-
### Data For Training
297+
### Data For Training
284298

285299
</summary> <blockquote>
286300
<details>
@@ -296,8 +310,8 @@ The datasets used in this work can be broadly categorized into data required for
296310
<!-- |||
297311
|:-:|:-:|
298312
|![scene1](./assets/0011.png)|![scene2](./assets/0011_m.png)| -->
299-
300-
The Foot Ulcer Segmentation Challenge (FUSeg) dataset is available to download from [their official repository](https://github.com/uwm-bigdata/wound-segmentation/tree/master/data/Foot%20Ulcer%20Segmentation%20Challenge).
313+
314+
The Foot Ulcer Segmentation Challenge (FUSeg) dataset is available to download from [their official repository](https://github.com/uwm-bigdata/wound-segmentation/tree/master/data/Foot%20Ulcer%20Segmentation%20Challenge).
301315
Download and unpack the dataset at `data/FUSeg/`, maintaining the Folder Structure shown above.
302316

303317
For simplicity, we mirror the FUSeg dataset [here](https://vault.sfu.ca/index.php/s/2mb8kZg8wOltptT).
@@ -315,23 +329,23 @@ The datasets used in this work can be broadly categorized into data required for
315329
![prath](./assets/readme_prath.png)
316330
>_A few examples from the Pratheepan dataset showing the images and it's corresponding segmentation mask, in the top and bottom row respectively._
317331
318-
The Pratheepan dataset is available to download from [their official website](https://web.fsktm.um.edu.my/~cschan/downloads_skin_dataset.html).
332+
The Pratheepan dataset is available to download from [their official website](https://web.fsktm.um.edu.my/~cschan/downloads_skin_dataset.html).
319333
The images and the corresponding ground truth masks are available in a ZIP file hosted on Google Drive. Download and unpack the dataset at `data/Pratheepan_Dataset/`.
320334

321335
</details>
322336

323337
<details>
324338
<a name="ph2_data"></a>
325339
<summary>
326-
340+
327341
### Download the PH2 dataset
328342

329343
</summary>
330344

331345
![ph2](./assets/readme_ph2.png)
332346
>_A few examples from the PH2 dataset showing a lesion and it's corresponding segmentation mask, in the top and bottom row respectively._
333-
334-
The PH2 dataset can be downloaded from [the official ADDI Project website](https://www.fc.up.pt/addi/ph2%20database.html).
347+
348+
The PH2 dataset can be downloaded from [the official ADDI Project website](https://www.fc.up.pt/addi/ph2%20database.html).
335349
Download and unpack the dataset at `data/ph2/`, maintaining the Folder Structure shown below.
336350

337351
</details>
@@ -358,7 +372,7 @@ The datasets used in this work can be broadly categorized into data required for
358372
### Creating the Synthetic dataset
359373

360374
</summary>
361-
375+
362376
![synthetic data](./assets/fig_1-min.png)
363377
>_Generated synthetic images of multiple subjects across a range of skin tones in various skin conditions, background scene, lighting, and viewpoints._
364378
@@ -368,13 +382,13 @@ The datasets used in this work can be broadly categorized into data required for
368382

369383
If you want to train your models on a different split of the synthetic data, you can download a dataset generated by blending lesions on 26 3DBodyTex scans from [here](https://cvi2.uni.lu/3dbodytexdermsynth/).
370384
To prepare the synthetic dataset for training. Sample the `images`, and `targets` from the path where you saved this dataset and then organise them into `train/val`.
371-
385+
372386
**NOTE**: To download the synthetic 3DBodyTex.DermSynth dataset referred in the links above, you would need to request access by following the instructions on this [link](https://cvi2.uni.lu/3dbodytexdermsynth/).
373387

374388
Alternatively, you can use the provided script `scripts/prep_data.py` to create it.
375389

376390
Even better, you can generate your own dataset, by following the instructions [here](./README.md#generating-synthetic-dataset).
377-
391+
378392

379393

380394
</details>
@@ -387,7 +401,7 @@ The datasets used in this work can be broadly categorized into data required for
387401

388402
<a name='gen'></a>
389403

390-
### Generating Synthetic Dataset
404+
### Generating Synthetic Dataset
391405

392406
![annots](./assets/AnnotationOverview.png)
393407
> _A few examples of annotated data synthesized using DermSynth3D. The rows from top to bottom show respectively: the rendered images with blended skin conditions, bounding boxes around the lesions, GT semantic segmentation masks, grouped anatomical labels, and the monocular depth maps produced by the renderer._
@@ -400,7 +414,7 @@ bodytex_dir: './data/3dbodytex-1.1-highres/' # Name of the mesh to blend
400414
mesh_name: '006-f-run' # Path to FitzPatrick17k lesions
401415
fitz_dir: './data/fitzpatrick17k/data/finalfitz17k/' # Path to annotated Fitz17k lesions with masks
402416
annot_dir: './data/annotations/' # Path to save the new texture maps
403-
tex_dir: './data/lesions/'
417+
tex_dir: './data/lesions/'
404418
``` -->
405419

406420
Now, to *generate* the synthetic data with the default parameters, simply run the following command to generate 2000 views for a specified mesh:
@@ -412,24 +426,24 @@ python -u scripts/gen_data.py
412426
To change the blending or synthesis parameters only, run using:
413427
```bash
414428
# Use python scripts/gen_data.py -h for full list of arguments
415-
python -u scripts/gen_data.py --lr <learning rate> \
429+
python -u scripts/gen_data.py --lr <learning rate> \
416430
-m <mesh_name> \
417431
-s <path to save the views> \
418432
-ps <skin threshold> \
419433
-i <blending iterations> \
420434
-v <number of views> \
421-
-n <number of lesions per mesh>
435+
-n <number of lesions per mesh>
422436
```
423437

424438
Feel free to play around with other `random` parameter in `configs/blend.yaml` to control lighting, material and view points.
425439

426440
<a name="post_proc_data"></a>
427441

428-
### Post-Process Renderings with Unity
442+
### Post-Process Renderings with Unity
429443

430-
We use Pytorch3D as our choice of differential renderer to generate synthetic data.
444+
We use Pytorch3D as our choice of differential renderer to generate synthetic data.
431445
However, Pytorch3D is not a Physically Based Renderer (PBR) and hence, the renderings are not photorealistic or may not look photorealistic.
432-
To achieve photorealistic renderings, we use Unity to post-process the renderings obtained from Pytorch3D.
446+
To achieve photorealistic renderings, we use Unity to post-process the renderings obtained from Pytorch3D.
433447

434448
<details>
435449
<summary>
@@ -452,7 +466,7 @@ Follow the detailed instructions outlined [here](./docs/unity.md) to create phot
452466
<a name='train_prep'></a>
453467

454468
## Preparing Dataset for Experiments
455-
<!--
469+
<!--
456470
![synthetic data](./assets/fig_1-min.png)
457471
>_Generated synthetic images of multiple subjects across a range of skin tones in various skin conditions, background scene, lighting, and viewpoints._ -->
458472

@@ -472,7 +486,7 @@ You can look at `scripts/prep_data.py` for more details.
472486
If you find this work useful or use any part of the code in this repo, please cite our paper:
473487
```bibtext
474488
@misc{sinha2023dermsynth3d,
475-
title={DermSynth3D: Synthesis of in-the-wild Annotated Dermatology Images},
489+
title={DermSynth3D: Synthesis of in-the-wild Annotated Dermatology Images},
476490
author={Ashish Sinha and Jeremy Kawahara and Arezou Pakzad and Kumar Abhishek and Matthieu Ruthven and Enjie Ghorbel and Anis Kacem and Djamila Aouada and Ghassan Hamarneh},
477491
year={2023},
478492
eprint={2305.12621},

assets/thumbnail.png

806 KB
Loading

assets/thumbnail1.png

293 KB
Loading

dermsynth3d.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: dermsynth3d
22
channels:
33
- pytorch3d
44
- iopath
5+
- bottler
6+
- pytorch
57
- fvcore
68
- conda-forge
79
- defaults
@@ -56,6 +58,8 @@ dependencies:
5658
- pysocks=1.7.1=py38h06a4308_0
5759
- python=3.8.15=h7a1cb2a_2
5860
- python_abi=3.8=2_cp38
61+
- pytorch
62+
- torchvision
5963
- pytorch3d=0.7.2=py38_cu113_pyt1100
6064
- pyyaml=6.0=py38h0a891b7_5
6165
- readline=8.2=h5eee18b_0
@@ -164,8 +168,6 @@ dependencies:
164168
- pywavelets==1.4.1
165169
- pyzmq==24.0.1
166170
- qudida==0.0.4
167-
# - torch==1.10.0+cu111
168-
# - torchvision==0.11.0+cu111
169171
- regex==2022.10.31
170172
- rfc3339-validator==0.1.4
171173
- rfc3986-validator==0.1.1

docs/preprint.pdf

10.1 MB
Binary file not shown.

0 commit comments

Comments
 (0)