dsa-helpers 1.1.5.dev7__tar.gz → 1.1.5.dev9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dsa_helpers-1.1.5.dev7/dsa_helpers.egg-info → dsa_helpers-1.1.5.dev9}/PKG-INFO +1 -1
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/__init__.py +1 -1
- dsa_helpers-1.1.5.dev9/dsa_helpers/ml/segformer_semantic_segmentation/datasets.py +55 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/segformer_semantic_segmentation/evaluate.py +1 -1
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/segformer_semantic_segmentation/train.py +1 -1
- dsa_helpers-1.1.5.dev7/dsa_helpers/ml/segformer_semantic_segmentation/datasets.py → dsa_helpers-1.1.5.dev9/dsa_helpers/ml/segformer_semantic_segmentation/utils.py +2 -55
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9/dsa_helpers.egg-info}/PKG-INFO +1 -1
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers.egg-info/SOURCES.txt +1 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/pyproject.toml +1 -1
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/.gitignore +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/.readthedocs.yaml +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/LICENSE +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/README.md +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/app.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dev.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/docs/requirements.txt +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/docs/source/conf.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/docs/source/index.rst +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/cli_utils.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/dash/__init__.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/dash/dash_paperdragon_utils.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/dash/header.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/dash/header_callbacks.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/girder_utils.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/gpd_utils.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/image_utils.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/imread.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/imwrite.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/__init__.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/callbacks.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/datasets/SegFormerSegmentationDataset.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/datasets/__init__.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/datasets/utils.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/evaluate.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/metrics.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/object_detection/__init__.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/object_detection/get_pearce_roi_images.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/object_detection/tile_image.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/object_detection/utils.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/segformer_semantic_segmentation/__init__.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/segformer_semantic_segmentation/inference.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/segformer_semantic_segmentation/transforms.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/transforms/__init__.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/transforms/segformer_transforms.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/mongo_utils.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/tile_utils.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/tiling.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/utils.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers.egg-info/dependency_links.txt +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers.egg-info/requires.txt +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers.egg-info/top_level.txt +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/setup.cfg +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/tests/app/Dockerfile +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/tests/app/app.py +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/tests/docker-compose.yaml +0 -0
- {dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/tests/test.ipynb +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dsa_helpers
|
|
3
|
-
Version: 1.1.5.
|
|
3
|
+
Version: 1.1.5.dev9
|
|
4
4
|
Summary: Utility functions for working with the DSA girder client.
|
|
5
5
|
Author-email: "Juan C. Vizcarra" <jvizcar@emory.edu>
|
|
6
6
|
Maintainer-email: "Juan C. Vizcarra" <jvizcar@emory.edu>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from torch.utils.data import Dataset
|
|
2
|
+
import pandas as pd
|
|
3
|
+
from PIL import Image
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class SegFormerSegmentationDataset(Dataset):
|
|
7
|
+
"""PyTorch dataset class for semantic segmentation using
|
|
8
|
+
HuggingFaces SegFormer model.
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(
|
|
13
|
+
self, df: pd.DataFrame, extras: bool = False, group: str = "wsi_name"
|
|
14
|
+
):
|
|
15
|
+
"""Initiate an instance of the segmentation dataset.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
df (pandas.DataFrame): Must have columns "fp" and "mask_fp".
|
|
19
|
+
extras (bool, optional): Whether to include additional
|
|
20
|
+
columns "x", "y" and "group" in the dataset. Default
|
|
21
|
+
is False.
|
|
22
|
+
group (str | None, optional): Additional column to add when
|
|
23
|
+
extras is True. Default is "wsi_name".
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
self.image_files = df["fp"].tolist()
|
|
27
|
+
self.mask_files = df["mask_fp"].tolist()
|
|
28
|
+
self.extras = extras
|
|
29
|
+
|
|
30
|
+
if extras:
|
|
31
|
+
self.x = df["x"].tolist()
|
|
32
|
+
self.y = df["y"].tolist()
|
|
33
|
+
self.group = df[group].tolist()
|
|
34
|
+
|
|
35
|
+
def __len__(self):
|
|
36
|
+
return len(self.image_files)
|
|
37
|
+
|
|
38
|
+
def __getitem__(self, idx):
|
|
39
|
+
# Get the filepath to the image and its mask.
|
|
40
|
+
image_path = self.image_files[idx]
|
|
41
|
+
mask_path = self.mask_files[idx]
|
|
42
|
+
|
|
43
|
+
if self.extras:
|
|
44
|
+
return {
|
|
45
|
+
"pixel_values": Image.open(image_path),
|
|
46
|
+
"label": Image.open(mask_path),
|
|
47
|
+
"x": self.x[idx],
|
|
48
|
+
"y": self.y[idx],
|
|
49
|
+
"group": self.group[idx],
|
|
50
|
+
}
|
|
51
|
+
else:
|
|
52
|
+
return {
|
|
53
|
+
"pixel_values": Image.open(image_path),
|
|
54
|
+
"label": Image.open(mask_path),
|
|
55
|
+
}
|
|
@@ -10,7 +10,7 @@ from pathlib import Path
|
|
|
10
10
|
import torch
|
|
11
11
|
from torch import nn
|
|
12
12
|
|
|
13
|
-
from .
|
|
13
|
+
from .utils import create_segformer_segmentation_dataset
|
|
14
14
|
from .transforms import train_transforms, val_transforms
|
|
15
15
|
from .evaluate import per_class_dice_on_dataset
|
|
16
16
|
from ..callbacks import MetricsLoggerCallback
|
|
@@ -1,59 +1,6 @@
|
|
|
1
|
-
from torch.utils.data import Dataset as TorchDataset
|
|
2
|
-
import pandas as pd
|
|
3
|
-
from PIL import Image
|
|
4
1
|
from datasets import Dataset, Features, Image, Value
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class SegFormerSegmentationDataset(TorchDataset):
|
|
8
|
-
"""PyTorch dataset class for semantic segmentation using
|
|
9
|
-
HuggingFaces SegFormer model.
|
|
10
|
-
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
def __init__(
|
|
14
|
-
self, df: pd.DataFrame, extras: bool = False, group: str = "wsi_name"
|
|
15
|
-
):
|
|
16
|
-
"""Initiate an instance of the segmentation dataset.
|
|
17
|
-
|
|
18
|
-
Args:
|
|
19
|
-
df (pandas.DataFrame): Must have columns "fp" and "mask_fp".
|
|
20
|
-
extras (bool, optional): Whether to include additional
|
|
21
|
-
columns "x", "y" and "group" in the dataset. Default
|
|
22
|
-
is False.
|
|
23
|
-
group (str | None, optional): Additional column to add when
|
|
24
|
-
extras is True. Default is "wsi_name".
|
|
25
|
-
|
|
26
|
-
"""
|
|
27
|
-
self.image_files = df["fp"].tolist()
|
|
28
|
-
self.mask_files = df["mask_fp"].tolist()
|
|
29
|
-
self.extras = extras
|
|
30
|
-
|
|
31
|
-
if extras:
|
|
32
|
-
self.x = df["x"].tolist()
|
|
33
|
-
self.y = df["y"].tolist()
|
|
34
|
-
self.group = df[group].tolist()
|
|
35
|
-
|
|
36
|
-
def __len__(self):
|
|
37
|
-
return len(self.image_files)
|
|
38
|
-
|
|
39
|
-
def __getitem__(self, idx):
|
|
40
|
-
# Get the filepath to the image and its mask.
|
|
41
|
-
image_path = self.image_files[idx]
|
|
42
|
-
mask_path = self.mask_files[idx]
|
|
43
|
-
|
|
44
|
-
if self.extras:
|
|
45
|
-
return {
|
|
46
|
-
"pixel_values": Image.open(image_path),
|
|
47
|
-
"label": Image.open(mask_path),
|
|
48
|
-
"x": self.x[idx],
|
|
49
|
-
"y": self.y[idx],
|
|
50
|
-
"group": self.group[idx],
|
|
51
|
-
}
|
|
52
|
-
else:
|
|
53
|
-
return {
|
|
54
|
-
"pixel_values": Image.open(image_path),
|
|
55
|
-
"label": Image.open(mask_path),
|
|
56
|
-
}
|
|
2
|
+
import pandas as pd
|
|
3
|
+
from .datasets import SegFormerSegmentationDataset
|
|
57
4
|
|
|
58
5
|
|
|
59
6
|
def dataset_generator(dataset):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dsa_helpers
|
|
3
|
-
Version: 1.1.5.
|
|
3
|
+
Version: 1.1.5.dev9
|
|
4
4
|
Summary: Utility functions for working with the DSA girder client.
|
|
5
5
|
Author-email: "Juan C. Vizcarra" <jvizcar@emory.edu>
|
|
6
6
|
Maintainer-email: "Juan C. Vizcarra" <jvizcar@emory.edu>
|
|
@@ -45,6 +45,7 @@ dsa_helpers/ml/segformer_semantic_segmentation/evaluate.py
|
|
|
45
45
|
dsa_helpers/ml/segformer_semantic_segmentation/inference.py
|
|
46
46
|
dsa_helpers/ml/segformer_semantic_segmentation/train.py
|
|
47
47
|
dsa_helpers/ml/segformer_semantic_segmentation/transforms.py
|
|
48
|
+
dsa_helpers/ml/segformer_semantic_segmentation/utils.py
|
|
48
49
|
dsa_helpers/ml/transforms/__init__.py
|
|
49
50
|
dsa_helpers/ml/transforms/segformer_transforms.py
|
|
50
51
|
tests/docker-compose.yaml
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/dash/dash_paperdragon_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/object_detection/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/object_detection/tile_image.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dsa_helpers-1.1.5.dev7 → dsa_helpers-1.1.5.dev9}/dsa_helpers/ml/transforms/segformer_transforms.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|