Skip to content

Commit bc9d8a0

Browse files
authored
Revert "Mmseg initial support (airctic#1079)" (airctic#1082)
This reverts commit 20c3ff5.
1 parent 20c3ff5 commit bc9d8a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+127
-3410
lines changed

.github/workflows/build-pkg.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ jobs:
2525
run: |
2626
# pip install numpy
2727
pip install -e .
28-
python -c "from icevision.all import *"
28+
python -c "from icevision.all import *"

.github/workflows/ci-all-testing.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ jobs:
2424

2525
- name: Install package
2626
run: |
27-
sh ./icevision_install.sh cpu
28-
pip install -e ".[all,dev]"
29-
pip install fiftyone
30-
27+
sh ./icevision_install.sh cpu
28+
pip install -e ".[all,dev]"
29+
pip install fiftyone
30+
3131
- name: Lint with flake8
3232
run: |
3333
# stop the build if there are Python syntax errors or undefined names
@@ -45,4 +45,4 @@ jobs:
4545
file: ./coverage.xml
4646
flags: unittests
4747
name: codecov-umbrella
48-
fail_ci_if_error: false
48+
fail_ci_if_error: false

.gitignore

-5
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,3 @@ archives/
155155
notebooks/wandb/latest-run
156156

157157
checkpoints
158-
159-
wandb
160-
wandb/*
161-
162-
*/artifacts/*

docker/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ RUN pip install git+https://github.com/airctic/icedata.git -U
66
RUN pip install yolov5-icevision -U
77
RUN pip install mmcv-full==1.3.7 -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.8.0/index.html -U
88
RUN pip install mmdet==2.13.0 -U
9-
RUN pip install mmsegmentation==0.17.0 -U
109
RUN pip install ipywidgets

icevision/core/exceptions.py

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
__all__ = [
2-
"InvalidDataError",
3-
"AutofixAbort",
4-
"AbortParseRecord",
5-
"InvalidMMSegModelType",
6-
"PreTrainedVariantNotFound",
7-
]
1+
__all__ = ["InvalidDataError", "AutofixAbort", "AbortParseRecord"]
82

93

104
class InvalidDataError(Exception):
@@ -17,11 +11,3 @@ class AutofixAbort(Exception):
1711

1812
class AbortParseRecord(Exception):
1913
pass
20-
21-
22-
class InvalidMMSegModelType(Exception):
23-
pass
24-
25-
26-
class PreTrainedVariantNotFound(Exception):
27-
pass

icevision/core/mask.py

+6-27
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,10 @@ class MaskArray(Mask):
6464
6565
# Arguments
6666
data: Mask array, with the dimensions: (num_instances, height, width)
67-
pad_dim: bool
6867
"""
6968

70-
def __init__(self, data: np.uint8, pad_dim: bool = True):
71-
if pad_dim and (len(data.shape) == 2):
69+
def __init__(self, data: np.uint8):
70+
if len(data.shape) == 2:
7271
data = np.expand_dims(data, 0)
7372
self.data = data.astype(np.uint8)
7473

@@ -138,21 +137,10 @@ class MaskFile(Mask):
138137
def __init__(self, filepath: Union[str, Path]):
139138
self.filepath = Path(filepath)
140139

141-
def to_mask(self, h=None, w=None):
142-
mask_img = open_img(self.filepath, gray=True)
143-
144-
if (h is not None) and (w is not None):
145-
# If the dimensions provided in h and w do not match the size of the mask, resize the mask accordingly
146-
(w_org, h_org) = mask_img.size
147-
148-
# TODO: Check NEAREST is always the best option or only for binary?
149-
if w_org != w or h_org != h:
150-
mask_img = mask_img.resize((w, h), resample=PIL.Image.NEAREST)
151-
152-
mask = np.array(mask_img)
140+
def to_mask(self, h, w):
141+
mask = np.array(open_img(self.filepath, gray=True))
153142
obj_ids = np.unique(mask)[1:]
154143
masks = mask == obj_ids[:, None, None]
155-
156144
return MaskArray(masks)
157145

158146
def to_coco_rle(self, h, w) -> List[dict]:
@@ -287,26 +275,17 @@ def __init__(self, filepath: Union[str, Path], binary=False):
287275
self.filepath = Path(filepath)
288276
self.binary = binary
289277

290-
def to_mask(self, h, w, pad_dim=True):
278+
def to_mask(self, h, w):
291279
# TODO: convert the 255 masks
292280
mask = open_img(self.filepath, gray=True)
293-
294-
# If the dimensions provided in h and w do not match the size of the mask, resize the mask accordingly
295-
(w_org, h_org) = mask.size
296-
297-
# TODO: Check NEAREST is always the best option or only for binary?
298-
if w_org != w or h_org != h:
299-
mask = mask.resize((w, h), resample=PIL.Image.NEAREST)
300-
301281
# HACK: because open_img now return PIL
302282
mask = np.array(mask)
303283

304284
# convert 255 pixels to 1
305285
if self.binary:
306286
mask[mask == 255] = 1
307287

308-
# control array padding behaviour
309-
return MaskArray(mask, pad_dim=pad_dim)
288+
return MaskArray(mask[None])
310289

311290
def to_coco_rle(self, h, w) -> List[dict]:
312291
raise NotImplementedError

icevision/metrics/__init__.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
from icevision.metrics.metric import *
22
from icevision.metrics.coco_metric import *
33
from icevision.metrics.confusion_matrix import *
4-
from icevision.metrics.segmentation_accuracy import *
5-
from icevision.metrics.dice_coefficient import *
6-
from icevision.metrics.jaccard_index import *

icevision/metrics/dice_coefficient/__init__.py

-2
This file was deleted.

icevision/metrics/dice_coefficient/binary_dice_coefficient.py

-49
This file was deleted.

icevision/metrics/dice_coefficient/multiclass_dice_coefficient.py

-73
This file was deleted.

icevision/metrics/jaccard_index/__init__.py

-1
This file was deleted.

icevision/metrics/jaccard_index/binary_jaccard_index.py

-47
This file was deleted.

icevision/metrics/segmentation_accuracy/__init__.py

-1
This file was deleted.

icevision/metrics/segmentation_accuracy/segmentation_accuracy.py

-70
This file was deleted.

icevision/models/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,3 @@
3030

3131
if SoftDependencies.sahi:
3232
from icevision.models import inference_sahi
33-
if SoftDependencies.mmseg:
34-
from icevision.models import mmseg

0 commit comments

Comments
 (0)