cpa-seg

The offical code for CPA-Enhancer for segmentation tasks.

https://github.com/zyw-stu/cpa-seg

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.5%) to scientific vocabulary
Last synced: 10 months ago · JSON representation ·

Repository

The offical code for CPA-Enhancer for segmentation tasks.

Basic Info
  • Host: GitHub
  • Owner: zyw-stu
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Size: 9.72 MB
Statistics
  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 2 years ago · Last pushed over 2 years ago
Metadata Files
Readme License Citation

README.md

CPA-Enhancer: Chain-of-Thought Prompted Adaptive Enhancer for Object Detection under Unknown Degradations

This is the official repository of the paper: CPA-Enhancer: Chain-of-Thought Prompted Adaptive Enhancer for Object Detection under Unknown Degradations for segmentation tasks.

🛠️ Installation

  • Step0. Download and install Miniconda from the official website.
  • Step1. Create a conda environment and activate it.

shell conda create --name mmseg python=3.8 -y conda activate mmseg

shell conda install pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=11.3 -c pytorch

shell pip install -U openmim mim install mmengine mim install "mmcv>=2.0.0"

  • Step4. Install other related packages

shell cd CPA_Seg pip install -r ./cpa/requirements.txt

📁 Data Preparation

You can download our reorganized ACDC datase (in cityscapes format) from this link. (pwd: tuag) Remember to modify the data_root in configs/__base__/datasets/cityscapes.py.

🎯 Usage

  • Recompile the code.

python pip install -v -e .

  • Training

```python

CPA-Enhancer + deeplabv3plus

python tools/train.py configs/deeplabv3plus/acdcdeeplabv3plusconfig.py ```

```python

CPA-Enhancer + segformer

python tools/train.py configs/segformer/acdcsegformerconfig.py ```

  • Testing

```python

CPA-Enhancer + deeplabv3plus

python tools/test.py configs/deeplabv3plus/acdcdeeplabv3plusconfig.py cpa/pretrained_models/deeplabv3plus.epoch ```

```python

CPA-Enhancer + segformer

python tools/test.py configs/segformer/acdcsegformerconfig.py cpa/pretrained_models/segformer.epoch ```

  • Inference

python python demo/image_demo.py \ --img path/to/testimg.png # path to your input image --config path/to/configfile # Eg. ..configs/segformer/acdc_segformer_config.py --weights path/to/pretrained_models/xx.pth

You can download our pretrained models from this link. (pwd: m1r1)

📊 Results

We cascade our proposed CPA-Enhancer with two basic segmentation models, DeepLabv3+ and Segformer, and labeled them as Ours(D) and Ours(S) respectively.

Quantitative results

Overall Workflow of the CPA-Enhancer Framework
Quantitative comparisons on the ACDC test set.

Visual Results

Overall Workflow of the CPA-Enhancer Framework
Qualitative comparisons of semantic segmentation on the ACDC validation set. Zoom in on the colored annotation boxes to better observe the differences.

💐 Acknowledgments

Special thanks to the creators of mmsegmentation upon which this code is built, for their valuable work in advancing object detection research.

🔗 Citation

If you use this codebase, or CPA-Enhancer inspires your work, we would greatly appreciate it if you could star the repository and cite it using the following BibTeX entry. @misc{zhang2024cpaenhancer, title={CPA-Enhancer: Chain-of-Thought Prompted Adaptive Enhancer for Object Detection under Unknown Degradations}, author={Yuwei Zhang and Yan Wu and Yanming Liu and Xinyue Peng}, year={2024}, eprint={2403.11220}, archivePrefix={arXiv}, primaryClass={cs.CV} }

Owner

  • Name: zyw-stu
  • Login: zyw-stu
  • Kind: user
  • Location: BeiJing

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - name: "MMSegmentation Contributors"
title: "OpenMMLab Semantic Segmentation Toolbox and Benchmark"
date-released: 2020-07-10
url: "https://github.com/open-mmlab/mmsegmentation"
license: Apache-2.0

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Dependencies

docker/Dockerfile docker
  • pytorch/pytorch ${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel build
docker/serve/Dockerfile docker
  • pytorch/pytorch ${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel build
cpa/requirements.txt pypi
  • Pillow ==10.2.0
  • Requests ==2.31.0
  • SimpleITK ==2.3.1
  • albumentations ==1.4.2
  • cityscapesscripts ==2.2.2
  • detail ==0.2.2
  • einops ==0.7.0
  • ftfy ==6.2.0
  • h5py ==3.10.0
  • huggingface_hub ==0.21.4
  • ldm ==0.1.3
  • loguru ==0.7.2
  • matplotlib ==3.7.5
  • mmcv ==2.1.0
  • mmdet ==3.3.0
  • mmengine ==0.10.3
  • model_archiver ==1.0.3
  • nibabel ==5.2.1
  • numpy ==1.24.3
  • onnxruntime ==1.17.1
  • opencv_python ==4.9.0.80
  • osgeo ==0.0.1
  • packaging ==24.0
  • pandas ==2.0.3
  • prettytable ==3.10.0
  • pycocotools ==2.0.7
  • pydicom ==2.4.4
  • pytest ==8.1.1
  • pytorch_sphinx_theme ==0.0.19
  • regex ==2023.12.25
  • scikit_learn ==1.4.1.post1
  • scipy ==1.12.0
  • seaborn ==0.13.2
  • setuptools ==60.2.0
  • tifffile ==2024.2.12
  • timm ==0.9.16
  • torch ==1.11.0
  • torchvision ==0.12.0
  • tqdm ==4.65.2
  • transformers ==4.39.1
  • ts ==0.5.1
requirements/albu.txt pypi
  • albumentations >=0.3.2
requirements/docs.txt pypi
  • docutils ==0.16.0
  • myst-parser *
  • sphinx ==4.0.2
  • sphinx_copybutton *
  • sphinx_markdown_tables *
  • urllib3 <2.0.0
requirements/mminstall.txt pypi
  • mmcv >=2.0.0rc4,<2.2.0
  • mmengine >=0.5.0,<1.0.0
requirements/multimodal.txt pypi
  • ftfy *
  • regex *
requirements/optional.txt pypi
  • cityscapesscripts *
  • diffusers *
  • einops ==0.3.0
  • imageio ==2.9.0
  • imageio-ffmpeg ==0.4.2
  • invisible-watermark *
  • kornia ==0.6
  • nibabel *
  • omegaconf ==2.1.1
  • pudb ==2019.2
  • pytorch-lightning ==1.4.2
  • streamlit >=0.73.1
  • test-tube >=0.7.5
  • timm *
  • torch-fidelity ==0.3.0
  • torchmetrics ==0.6.0
  • transformers ==4.19.2
requirements/readthedocs.txt pypi
  • mmcv >=2.0.0rc1,<2.1.0
  • mmengine >=0.4.0,<1.0.0
  • prettytable *
  • scipy *
  • torch *
  • torchvision *
requirements/runtime.txt pypi
  • matplotlib *
  • numpy *
  • packaging *
  • prettytable *
  • scipy *
requirements/tests.txt pypi
  • codecov * test
  • flake8 * test
  • ftfy * test
  • interrogate * test
  • pytest * test
  • regex * test
  • xdoctest >=0.10.0 test
  • yapf * test
requirements.txt pypi
setup.py pypi