diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 4a81f79..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -supervisely==6.7.21 -supervisely[apps]==6.7.21 diff --git a/serve/README.md b/serve/README.md index 663291a..39e4b4d 100644 --- a/serve/README.md +++ b/serve/README.md @@ -44,6 +44,8 @@ Supported backbones: - [x] [Vision Transformer (ICLR'2021)](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/vit) - [x] [Swin Transformer (ICCV'2021)](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/swin) - [x] [Twins (NeurIPS'2021)](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/twins) +- [x] [BEiT (ICLR'2022)](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/beit) +- [x] [ConvNeXt (CVPR'2022)](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/convnext) Supported methods: @@ -80,6 +82,7 @@ Supported methods: - [x] [DPT (ArXiv'2021)](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/dpt) - [x] [Segmenter (ICCV'2021)](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/segmenter) - [x] [SegFormer (NeurIPS'2021)](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/segformer) +- [x] [K-Net (NeurIPS'2021)](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/knet) # How to Run diff --git a/serve/config.json b/serve/config.json index 5a929db..47edd88 100644 --- a/serve/config.json +++ b/serve/config.json @@ -7,7 +7,7 @@ "semantic segmentation" ], "description": "Deploy model as REST API service", - "docker_image": "supervisely/mmseg:1.2.0", + "docker_image": "supervisely/mmseg:1.3.0", "main_script": "serve/src/sly_serve.py", "gui_template": "serve/src/gui.html", "task_location": "application_sessions", diff --git a/train/README.md b/train/README.md index 1a9ba36..20a9f00 100644 --- a/train/README.md +++ b/train/README.md @@ -50,6 +50,8 @@ Supported backbones: - [x] [Vision Transformer (ICLR'2021)](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/vit) - [x] [Swin Transformer (ICCV'2021)](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/swin) - [x] [Twins (NeurIPS'2021)](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/twins) +- [x] [BEiT (ICLR'2022)](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/beit) +- [x] [ConvNeXt (CVPR'2022)](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/convnext) Supported methods: @@ -86,6 +88,7 @@ Supported methods: - [x] [DPT (ArXiv'2021)](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/dpt) - [x] [Segmenter (ICCV'2021)](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/segmenter) - [x] [SegFormer (NeurIPS'2021)](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/segformer) +- [x] [K-Net (NeurIPS'2021)](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/knet) # How to Run diff --git a/train/config.json b/train/config.json index a95c179..030474b 100644 --- a/train/config.json +++ b/train/config.json @@ -7,7 +7,7 @@ "semantic segmentation" ], "description": "Dashboard to configure, start and monitor training", - "docker_image": "supervisely/mmseg:1.2.0", + "docker_image": "supervisely/mmseg:1.3.0", "main_script": "train/src/main.py", "gui_template": "train/src/gui.html", "task_location": "workspace_tasks", diff --git a/train/src/sly_imgaugs.py b/train/src/sly_imgaugs.py index d41ae65..4cff9ad 100644 --- a/train/src/sly_imgaugs.py +++ b/train/src/sly_imgaugs.py @@ -1,84 +1,7 @@ import supervisely as sly from mmseg.datasets.builder import PIPELINES -from supervisely.sly_logger import logger -import imgaug.augmenters as iaa -def get_function(category_name, aug_name): - try: - submodule = getattr(iaa, category_name) - aug_f = getattr(submodule, aug_name) - return aug_f - except Exception as e: - logger.error(repr(e)) - # raise e - return None - -def build_pipeline(aug_infos, random_order=False): - pipeline = [] - for aug_info in aug_infos: - category_name = aug_info["category"] - aug_name = aug_info["name"] - params = aug_info["params"] - for param_name, param_val in params.items(): - if isinstance(param_val, dict): - if "x" in param_val.keys() and "y" in param_val.keys(): - param_val["x"] = tuple(param_val["x"]) - param_val["y"] = tuple(param_val["y"]) - elif isinstance(param_val, list): - params[param_name] = tuple(param_val) - - aug_func = get_function(category_name, aug_name) - - aug = aug_func(**params) - - sometimes = aug_info.get("sometimes", None) - if sometimes is not None: - aug = iaa.meta.Sometimes(sometimes, aug) - pipeline.append(aug) - augs = iaa.Sequential(pipeline, random_order=random_order) - return augs - - -def aug_to_python(aug_info): - pstr = "" - for name, value in aug_info["params"].items(): - v = value - if type(v) is list: #name != 'nb_iterations' and - v = (v[0], v[1]) - elif type(v) is dict and "x" in v.keys() and "y" in v.keys(): - v = {"x": (v["x"][0], v["x"][1]), "y": (v["y"][0], v["y"][1])} - - if type(value) is str: - pstr += f"{name}='{v}', " - else: - pstr += f"{name}={v}, " - method_py = f"iaa.{aug_info['category']}.{aug_info['name']}({pstr[:-2]})" - - res = method_py - if "sometimes" in aug_info: - res = f"iaa.Sometimes({aug_info['sometimes']}, {method_py})" - return res - - -def pipeline_to_python(aug_infos, random_order=False): - template = \ -"""import imgaug.augmenters as iaa -seq = iaa.Sequential([ -{} -], random_order={}) -""" - py_lines = [] - for info in aug_infos: - line = aug_to_python(info) - _validate = info["python"] - if line != _validate: - raise ValueError("Generated python line differs from the one from config: \n\n{!r}\n\n{!r}" - .format(line, _validate)) - py_lines.append(line) - res = template.format('\t' + ',\n\t'.join(py_lines), random_order) - return res - @PIPELINES.register_module() class SlyImgAugs(object): def __init__(self, config_path): diff --git a/train/src/ui/augs.py b/train/src/ui/augs.py index fa2c236..1bc5b87 100644 --- a/train/src/ui/augs.py +++ b/train/src/ui/augs.py @@ -3,7 +3,6 @@ import sly_globals as g from supervisely.app.v1.widgets.compare_gallery import CompareGallery import input_project -from sly_imgaugs import build_pipeline, pipeline_to_python _templates = [ @@ -46,8 +45,8 @@ def _load_template(json_path): config = sly.json.load_json_file(json_path) - pipeline = build_pipeline(config["pipeline"], random_order=config["random_order"]) # to validate - py_code = pipeline_to_python(config["pipeline"], config["random_order"]) + pipeline = sly.imgaug_utils.build_pipeline(config["pipeline"], random_order=config["random_order"]) # to validate + py_code = sly.imgaug_utils.pipeline_to_python(config["pipeline"], config["random_order"]) return pipeline, py_code, config diff --git a/train/src/ui/monitoring.py b/train/src/ui/monitoring.py index 1b4fb38..cb540b1 100644 --- a/train/src/ui/monitoring.py +++ b/train/src/ui/monitoring.py @@ -171,7 +171,6 @@ def prepare_segmentation_data(state, img_dir, ann_dir, palette): shutil.move(os.path.join(temp_project_seg_dir, dataset, img_dir, filename), os.path.join(g.project_seg_dir, img_dir)) - shutil.rmtree(g.project_dir) shutil.rmtree(temp_project_seg_dir) g.api.app.set_field(g.task_id, "state.preparingData", False)