Commit Graph

31 Commits (779b86cd74dc8df9024f72ab9939531c693d84e2)

Author SHA1 Message Date
谢昕辰 53fe1ccf39
[Feature] Support MMSegInferencer (#2413)
## Motivation

Support `MMSegInferencer` for providing an easy and clean interface for
single or multiple images inferencing.

Ref: https://github.com/open-mmlab/mmengine/pull/773
https://github.com/open-mmlab/mmocr/pull/1608

## Modification

- mmseg/apis/mmseg_inferencer.py
- mmseg/visualization/local_visualizer.py
- demo/image_demo_with_inferencer.py

## Use cases (Optional)

Based on https://github.com/open-mmlab/mmengine/tree/inference

Add a new image inference demo with `MMSegInferencer`

- demo/image_demo_with_inferencer.py

```shell
python demo/image_demo_with_inferencer.py demo/demo.png fcn_r50-d8_4xb2-40k_cityscapes-512x1024
```

---------

Co-authored-by: MeowZheng <meowzheng@outlook.com>
2023-02-23 21:16:19 +08:00
谢昕辰 a947e3e754
[FIx] Set default `backend_args` values to None (#2597)
## Motivation

In MMEngine >= 0.2.0, it might directly determine what the backend is by
using the `data_root` path.

## Modification

Set all default `backend_args` values are `None`.
2023-02-16 15:33:52 +08:00
CSH 2e27f8b678
[Enhancement]Replace numpy ascontiguousarray with torch contiguous to speed-up (#2604)
## Motivation

Original motivation was after [MMDetection PR
#9533](https://github.com/open-mmlab/mmdetection/pull/9533)

With several experiments I found out that if a ndarray is contiguous,
numpy.transpose + torch.contiguous perform better, while if not, then
use numpy.ascontiguousarray + numpy.transpose

## Modification

Replace numpy.ascontiguousarray with torch.contiguous in
[PackSegInputs](https://github.com/open-mmlab/mmsegmentation/blob/1.x/mmseg/datasets/transforms/formatting.py)

Co-authored-by: MeowZheng <meowzheng@outlook.com>
2023-02-15 19:02:00 +08:00
谢昕辰 124b87ce90
[Refactor] Refactor fileio (#2543)
## Motivation

Use the new fileio from mmengine
https://github.com/open-mmlab/mmengine/pull/533

## Modification

1. Use `mmengine.fileio` to repalce FileClient  in mmseg/datasets
2. Use `mmengine.fileio` to repalce FileClient in
mmseg/datasets/transforms
3. Use `mmengine.fileio` to repalce FileClient in mmseg/visualization

## BC-breaking (Optional)

we modify all the dataset configurations, so please use the latest config file.
2023-02-01 17:53:22 +08:00
Siddharth Ancha 74e8b89b17
[Fix] Switch order of `reduce_zero_label` and applying `label_map` in 1.x (#2517)
This is an almost exact duplicate of #2500 (that was made to the
`master` branch) now applied to the `1.x` branch.

---

## Motivation

I want to fix a bug through this PR. The bug occurs when two options --
`reduce_zero_label=True`, and custom classes are used.
`reduce_zero_label` remaps the GT seg labels by remapping the zero-class
to 255 which is ignored. Conceptually, this should occur *before* the
`label_map` is applied, which maps *already reduced labels*. However,
currently, the `label_map` is applied before the zero label is reduced.

## Modification

The modification is simple:
- I've just interchanged the order of the two operations by moving a few
lines from bottom to top.
- I've added a test that passes when the fix is introduced, and fails on
the original `master` branch.

## BC-breaking (Optional)

I do not anticipate this change braking any backward-compatibility.

## Checklist

- [x] Pre-commit or other linting tools are used to fix the potential
lint issues.
  - _I've fixed all linting/pre-commit errors._
- [x] The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
  - _I've added a unit test._ 
- [x] If the modification has potential influence on downstream
projects, this PR should be tested with downstream projects, like MMDet
or MMDet3D.
  - _I don't think this change affects MMDet or MMDet3D._
- [x] The documentation has been modified accordingly, like docstring or
example tutorials.
- _This change fixes an existing bug and doesn't require modifying any
documentation/docstring._
2023-01-30 12:17:15 +08:00
Leeinsn 7fc8ca0312
CodeCamp #141 [Feature] Add BioMedical3DRandomFlip. (#2404)
## Motivation

Support for biomedical 3d images augmentation.

## Modification

Add BioMedical3DRandomFlip in mmseg/datasets/transforms/transforms.py.

Co-authored-by: MeowZheng <meowzheng@outlook.com>
2023-01-20 15:34:11 +08:00
Wencheng Wu 8dae9465a6
[Feature] Add `gt_edge_map` field. (#2466)
## Motivation

The motivation of this PR is to add `gt_edge_map` field to support
boundary loss.

## Modification

- GenerateEdge
Modify `gt_edge` field to `gt_edge_map`.

- PackSegInputs
Add `gt_edge_map` to data_sample.

- stack_batch
Pad `gt_edge_map` to max_shape.

## BC-breaking (Optional)

No

## Use cases (Optional)

Reference `GenerateEdge`.
2023-01-11 11:51:29 +08:00
谢昕辰 f90f7a56d4
[Fix] Fix incorrect `img_shape` value assignment in RandomCrop (#2469)
## Motivation

Fix incorrect `img_shape` value assignment.

## Modification

- mmseg/datasets/transforms/transforms.py
2023-01-10 18:03:43 +08:00
王永韬 2d67e51db3
CodeCamp #140 [New] [Feature] Add synapse dataset and data augmentation in dev-1.x. (#2432)
## Motivation

Add Synapse dataset in MMSegmentation.
Old PR: https://github.com/open-mmlab/mmsegmentation/pull/2372.
2023-01-06 16:14:54 +08:00
legendchilli 6af2b8eab9
[Feature] Add BioMedical3DPad (#2383)
## Motivation
Add the 3d pad transform for biomedical images, which follows the design
of the nnUNet.
2023-01-03 13:37:48 +08:00
Fivethousand 3ca690bad3
[Feature] Add BioMedicalRandomGamma (#2406)
Add the random gamma correction transform for biomedical images, which
follows the design of the nnUNet.
2023-01-02 21:29:03 +08:00
Haoyu Wang 26f3df7a45
[Feature] nnUNet-style Gaussian Noise and Blur (#2373)
## Motivation

implement nnUNet-style Gaussian Noise and Blur
2023-01-02 20:43:15 +08:00
Jin Ye 79e8578bfc [Feature] Add Biomedical 3D array random crop transform (#2378)
* [Feature] Add Biomedical 3D array random crop transform

* fix lint

* fix gen crop bbox

* fix gen crop bbox

* docstring

* typo

Co-authored-by: MeowZheng <meowzheng@outlook.com>
2022-12-30 22:52:07 +08:00
xiexinch 3b731edbd3 update copyright 2022-12-01 13:58:17 +08:00
xiexinch 5a62b0335f fix h,w order 2022-12-01 11:25:00 +08:00
xiexinch 721afaec31 add docstring 2022-11-24 16:22:07 +08:00
xiexinch 1910dffd6c minor change 2022-11-24 15:02:50 +08:00
xiexinch 68e3b25560 use mmcv.RandomChoiceResize as entry 2022-11-24 14:55:25 +08:00
xiexinch 721f4d01f3 add ut 2022-11-23 15:15:38 +08:00
xiexinch 056edc8e1a init 2022-11-22 19:51:38 +08:00
Miao Zheng ac9ee8c355
[Feature]Generate Edge for dataset (#2210)
* [WIP]Generate Edge for dataset

* add ut

* add repr

* add inti
2022-10-20 16:45:31 +08:00
Miao Zheng 20c7dc689c
[Feature] Add BioMedical data loading (#2176)
* [WIP] Add BioMedical data loading

* add depends nibabel

* fix bug

* fix ut

* fix

* add test data

* xyz2zyx zyx2xyz

* format

* remove ignore empty

* remove ignore empty

* remove with seg in LoadBiomedicalAnnotation

* float32

* docstring

* toxyz

* docstring
2022-10-18 16:30:08 +08:00
MengzhangLI f3cd44bebf
[Fix] Fix ResizeToMultiple transform in MMSeg 1.x (#2185) 2022-10-14 15:37:35 +08:00
Miao Zheng 8de0050f25
[Refactor] data flow (#1956)
* [WIP] Refactor data flow

* model return

* [WIP] Refactor data flow

* support data_samples is optional

* fix benchmark

* fix base

* minors

* rebase

* fix api

* ut

* fix api inference

* comments

* docstring

* docstring

* docstring

* fix bug of slide inference

* add assert c > 1
2022-08-26 15:54:23 +08:00
Miao Zheng 50546da85c
[Fix]Remove modules from mmcv.runner and mmcv.utils (#1966)
* [WIP] mmcv-clean

* [WIP]Remove modules from mmcv.runner and mmcv.utils

* wip

* fix import mmengine

* remove ut

* loadcheckpoint in mae
2022-08-25 15:15:21 +08:00
Miao Zheng e0499d5a77 [Fix] Fix repo based on refactoring standard (#1869)
* [Fix] Fix repo based on refactory standard

* fix ut
2022-08-19 20:50:02 +08:00
谢昕辰 167f94a70b rename data to structures (#1854) 2022-08-19 20:50:02 +08:00
MengzhangLI ecab73a892 [Feature] Add P1 DataTransform (#1843)
* [Feature] Add P1 DataTransform

* fix unit test error

* fix @cache_randomness location
2022-08-19 20:50:01 +08:00
谢昕辰 ba4d1d62aa
[Feature] Add LoadImageFromNdArray pipeline (#1810)
* add load image from ndarray pipeline

* fix import
2022-07-22 19:40:00 +08:00
Miao Zheng 4de57b49c5
[Fix] Fix register_all_modules and imports (#1793)
* [Fix] Fix register_all_modules and imports

* fix transforms import
2022-07-21 22:44:42 +08:00
zhengmiao 4b76f277a6 [Refactory] MMSegmentation Content 2022-07-15 15:47:29 +00:00