Giter VIP home page Giter VIP logo

sssegmentation's Introduction


docs PyPI - Python Version PyPI license PyPI - Downloads PyPI - Downloads issue resolution open issues

Documents: https://sssegmentation.readthedocs.io/en/latest/

What's New

Introduction

SSSegmentation is an open source supervised semantic segmentation toolbox based on PyTorch. You can star this repository to keep track of the project if it's helpful for you, thank you for your support.

Major Features

  • High Performance

    The performance of re-implemented segmentation algorithms is better than or comparable to other codebases.

  • Modular Design and Unified Benchmark

    Various segmentation methods are unified into several specific modules. Benefiting from this design, SSSegmentation can integrate a great deal of popular and contemporary semantic segmentation frameworks and then, train and test them on unified benchmarks.

  • Fewer Dependencies

    SSSegmenation tries its best to avoid introducing more dependencies when reproducing novel semantic segmentation approaches.

Benchmark and Model Zoo

Supported Backbones

Backbone Model Zoo Paper Link Code Snippet
ConvNeXtV2 Click CVPR 2023 Click
MobileViTV2 Click ArXiv 2022 Click
ConvNeXt Click CVPR 2022 Click
MAE Click CVPR 2022 Click
MobileViT Click ICLR 2022 Click
BEiT Click ICLR 2022 Click
Twins Click NeurIPS 2021 Click
SwinTransformer Click ICCV 2021 Click
VisionTransformer Click IClR 2021 Click
BiSeNetV2 Click IJCV 2021 Click
ResNeSt Click ArXiv 2020 Click
CGNet Click TIP 2020 Click
HRNet Click CVPR 2019 Click
MobileNetV3 Click ICCV 2019 Click
FastSCNN Click ArXiv 2019 Click
BiSeNetV1 Click ECCV 2018 Click
MobileNetV2 Click CVPR 2018 Click
ERFNet Click T-ITS 2017 Click
ResNet Click CVPR 2016 Click
UNet Click MICCAI 2015 Click

Supported Segmentors

Segmentor Model Zoo Paper Link Code Snippet
EdgeSAM Click ArXiv 2023 Click
IDRNet Click NeurIPS 2023 Click
MobileSAM Click ArXiv 2023 Click
SAMHQ Click NeurIPS 2023 Click
SAM Click ArXiv 2023 Click
MCIBI++ Click TPAMI 2022 Click
Mask2Former Click CVPR 2022 Click
ISNet Click ICCV 2021 Click
MCIBI Click ICCV 2021 Click
MaskFormer Click NeurIPS 2021 Click
Segformer Click NeurIPS 2021 Click
SETR Click CVPR 2021 Click
ISANet Click IJCV 2021 Click
DNLNet Click ECCV 2020 Click
PointRend Click CVPR 2020 Click
OCRNet Click ECCV 2020 Click
GCNet Click TPAMI 2020 Click
APCNet Click CVPR 2019 Click
DMNet Click ICCV 2019 Click
ANNNet Click ICCV 2019 Click
EMANet Click ICCV 2019 Click
FastFCN Click ArXiv 2019 Click
SemanticFPN Click CVPR 2019 Click
CCNet Click ICCV 2019 Click
CE2P Click AAAI 2019 Click
DANet Click CVPR 2019 Click
PSANet Click ECCV 2018 Click
UPerNet Click ECCV 2018 Click
EncNet Click CVPR 2018 Click
Deeplabv3Plus Click ECCV 2018 Click
NonLocalNet Click CVPR 2018 Click
ICNet Click ECCV 2018 Click
Mixed Precision (FP16) Training Click ArXiv 2017 Click
Deeplabv3 Click ArXiv 2017 Click
PSPNet Click CVPR 2017 Click
FCN Click TPAMI 2017 Click

Supported Datasets

Dataset Project Link Paper Link Code Snippet Download Script
VSPW Click CVPR 2021 Click
CMD bash scripts/prepare_datasets.sh vspw
Supervisely Click Website Release 2020 Click
CMD bash scripts/prepare_datasets.sh supervisely
Dark Zurich Click ICCV 2019 Click
CMD bash scripts/prepare_datasets.sh darkzurich
Nighttime Driving Click ITSC 2018 Click
CMD bash scripts/prepare_datasets.sh nighttimedriving
CIHP Click ECCV 2018 Click
CMD bash scripts/prepare_datasets.sh cihp
COCOStuff10k Click CVPR 2018 Click
CMD bash scripts/prepare_datasets.sh cocostuff10k
COCOStuff164k Click CVPR 2018 Click
CMD bash scripts/prepare_datasets.sh coco
MHPv1&v2 Click ArXiv 2017 Click
CMD bash scripts/prepare_datasets.sh mhpv1 & bash scripts/prepare_datasets.sh mhpv2
LIP Click CVPR 2017 Click
CMD bash scripts/prepare_datasets.sh lip
ADE20k Click CVPR 2017 Click
CMD bash scripts/prepare_datasets.sh ade20k
SBUShadow Click ECCV 2016 Click
CMD bash scripts/prepare_datasets.sh sbushadow
CityScapes Click CVPR 2016 Click
CMD bash scripts/prepare_datasets.sh cityscapes
ATR Click ICCV 2015 Click
CMD bash scripts/prepare_datasets.sh atr
Pascal Context Click CVPR 2014 Click
CMD bash scripts/prepare_datasets.sh pascalcontext
MS COCO Click ECCV 2014 Click
CMD bash scripts/prepare_datasets.sh coco
HRF Click Int J Biomed Sci 2013 Click
CMD bash scripts/prepare_datasets.sh hrf
CHASE DB1 Click TBME 2012 Click
CMD bash scripts/prepare_datasets.sh chase_db1
PASCAL VOC Click IJCV 2010 Click
CMD bash scripts/prepare_datasets.sh pascalvoc
DRIVE Click TMI 2004 Click
CMD bash scripts/prepare_datasets.sh drive
STARE Click TMI 2000 Click
CMD bash scripts/prepare_datasets.sh stare

Citation

If you use SSSegmentation in your research, please consider citing this project,

@article{jin2023sssegmenation,
    title={SSSegmenation: An Open Source Supervised Semantic Segmentation Toolbox Based on PyTorch},
    author={Jin, Zhenchao},
    journal={arXiv preprint arXiv:2305.17091},
    year={2023}
}

@inproceedings{jin2021isnet,
    title={ISNet: Integrate Image-Level and Semantic-Level Context for Semantic Segmentation},
    author={Jin, Zhenchao and Liu, Bin and Chu, Qi and Yu, Nenghai},
    booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
    pages={7189--7198},
    year={2021}
}

@inproceedings{jin2021mining,
    title={Mining Contextual Information Beyond Image for Semantic Segmentation},
    author={Jin, Zhenchao and Gong, Tao and Yu, Dongdong and Chu, Qi and Wang, Jian and Wang, Changhu and Shao, Jie},
    booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
    pages={7231--7241},
    year={2021}
}

@article{jin2022mcibi++,
    title={MCIBI++: Soft Mining Contextual Information Beyond Image for Semantic Segmentation},
    author={Jin, Zhenchao and Yu, Dongdong and Yuan, Zehuan and Yu, Lequan},
    journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
    year={2022},
    publisher={IEEE}
}

@inproceedings{jin2023idrnet,
    title={IDRNet: Intervention-Driven Relation Network for Semantic Segmentation},
    author={Jin, Zhenchao and Hu, Xiaowei and Zhu, Lingting and Song, Luchuan and Yuan, Li and Yu, Lequan},
    booktitle={Thirty-Seventh Conference on Neural Information Processing Systems},
    year={2023}
}

References

We are very grateful to the following projects for their help in building SSSegmentation,

sssegmentation's People

Contributors

charlespikachu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sssegmentation's Issues

ISNet

Hi, thanks for your wonderful work, I want to ask where i can find ISNet code?

训练刚结束时的验证效果和保存并重新加载模型参数后进行验证的结果不一样

Environment (使用环境)

  • Installation method (安装方式): Install SSSegmentation for Developing
  • The version of sssegmentation (版本号): 1.5.3
  • Operating system (操作系统): Linux。使用slurm任务调度工具。
  • Python version (Python版本): 3.8.19

Question description (问题描述)
我将unet模型的某个训练配置文件稍加修改,得到了fcn_unets5os16_spider.py并将该文件作为训练我自己数据集的配置,bs=32,epochs设为20。按默认设置,每隔10个epoch在验证集val上验证效果。训练返回的结果文件中,第20个epoch结束后的验证结果如下【结果1】:

2024-04-08 12:06:49 INFO  Rank 0 finished
2024-04-08 12:06:49 INFO  All Finished, all_preds: 480, all_gts: 480
2024-04-08 12:06:51 INFO  {'iou': {'__background__': 0.9306402134161759, 'spider': 0.6665832034694705}, 'miou': 0.7986117084428233, 'accuracy': array([0.96680556, 0.78754992]), 'mpa': 0.8771777369668247}

(accuracy和mpa是我加进去的)

之后我用测试脚本dist_test.sh,加载了第20个epoch结束后保存的参数文件epoch_20.pth进行验证,调用测试脚本的命令如下:

bash scripts/dist_test.sh 1 ssseg/configs/unet/fcn_unets5os16_spider.py fcn_unets5os16_spider_ep20/epoch_20.pth --slurm

单独运行测试脚本得到的结果如下【结果2】:

2024-04-08 15:22:14 INFO  Rank 0 finished
2024-04-08 15:22:14 INFO  All Finished, all_preds: 480, all_gts: 480
2024-04-08 15:22:16 INFO  {'iou': {'__background__': 0.9324833796798122, 'spider': 0.6735323713466238}, 'miou': 0.803007875513218, 'accuracy': array([0.96818855, 0.79066773]), 'mpa': 0.879428142561482}

这和前面训练时的验证结果不一样。我之后又运行了一次单独运行测试脚本的命令,结果和【结果2】一样。

请问为什么会这样?

关于测试

作者您好,按照代码中的指令bash scripts/distest.sh 1 ssseg/configs/memorynetv2/memorynetv2_upernet_swinlarge_vspw.py memorynetv2_upernet_swinlarge_vspw/epoch_240.pth进行测试时,会遇到运行到一半中断的情况,报错原因看上去像是显存爆炸(观测了显存使用情况,直接冲到99%附近),请问可能是什么原因呢,您有遇到过类似情况吗?十分感谢~
显卡是GPU v100;报错bug:RuntimeError: DataLoader worker (pid 211462) is killed by signal: Killed.
Processing 7420/12196 in rank 1: : 7419it [1:48:14, 1.15it/s]WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 211036 closing signal SIGTERM
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 211035) of binary:

关于单机单卡条件下训练模型

Environment (使用环境)

  • Installation method (安装方式): Install SSSegmentation for Developing
  • The version of sssegmentation (版本号): 1.5.3
  • Operating system (操作系统): Linux。使用slurm任务调度工具。
  • Python version (Python版本): 3.8.19

Question description (问题描述)
请问SSSegmentation能否在单机单卡情况下使用,如果可以,请问应该修改哪些配置参数?

关于支持的数据集

您好,感谢您开源的代码核突出贡献,我希望可以在自己的数据集上训练语义分割模型,为了保证一致性,请问您对数据集做了哪些预处理?我希望将我的数据集处理到和您在百度网盘中提供的数据集相同的程度。

mobilenetV3 bug

image

se_cf in the mobilenetV3, what does this bias mean, only keep an activation function on the line, otherwise it reports an error

[BUG]

Description
ssseg/modules/models/segmentors/base/base.py line128, it seems should use nn.SyncBatchNorm

Screenshot
image

Advice
change SyncBatchNorm to nn.SyncBatchNorm

编译错误

ModuleNotFoundError: No module named 'mmcv.ops'

Where is your difference between mmseg

Hello .Thanks for your wonderful work.
What is your different compared to mmseg?Since both of ssseg and mmseg are based on mmcv and need a config to run .

how to train with multi-gpu in one machine

hi,i wanna train the model with 4 gpus in one machine
however, your code 'distrain.sh' and 'train.py' can only train with distributed mode in multi-machine
how can i modify the code ?

[note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for chainercv Running setup.py clean for chainercv Failed to build chainercv ERROR: Could not build wheels for chainercv, which is required to install pyproject.toml-based projects]

Environment (使用环境)

  • Installation method (安装方式):
  • The version of sssegmentation (版本号):
  • Operating system (操作系统):
  • Python version (Python版本):

Question description (问题描述)

Screenshot (报错截图)

Advice (修复建议)

assert num_classes == len(classnames) and num_classes == len(palette)

the previous error has gone when i made the number of classes 2, now left with this.
File "/home/mohammed/sssegmentation/ssseg/modules/datasets/ade20k.py", line 83, in
class ADE20kDataset(BaseDataset):
File "/home/mohammed/sssegmentation/ssseg/modules/datasets/ade20k.py", line 108, in ADE20kDataset
assert num_classes == len(classnames) and num_classes == len(palette)
AssertionError
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 1615854) of binary: /home/mohammed/miniconda3/envs/myenv/bin/python
Traceback (most recent call last):

i set the number of classes as 2 which you can see below.
class ADE20kDataset(BaseDataset):
num_classes = 2
classnames = ['defect']
palette = [(255, 0, 255)]
clsid2label = {0: 0}

when i set it like this

num_classes = 2

        # classnames = ['defect', 'no_defect']
        # palette = [(255, 0, 255), (0, 255, 0)]
        # clsid2label = {0: 0, 1: 1}

it leads to the previous error were it shows t >= 0 && t < n_classes failed.

the below is how my scenecategory looks

NT_label_2 defect
NT_label_1 defect
NF_label_1 defect
NF_label_0 defect
N7_label_1 defect
N7_label_0 defect
N4_label_2 defect
N4_label_1 defect
N4_label_0 defect
N3_label_3 defect
N3_label_2 defect
N3_label_1 defect
N3_label_0 defect
N2_label_2 defect
N2_label_1 defect
N2_label_0 defect
N1_label_3 defect
N1_label_2 defect
N1_label_1 defect
N1_label_0 defect
m9614_label_9 defect
m9614_label_8 defect
M9287_label_6 defect
M9287_label_4 defect
M9287_label_3 defect
M9287_label_1 defect
M7436_label_8 defect
M7436_label_6 defect
M7436_label_2 defect

关于VSPW数据集训练

作者您好,您在论文中提到在训练VSPW数据集时使用了2帧历史帧以获取时序信息,但是在代码中没有看到相关的模块或结构,vspw数据集的读取代码中使用了random.choice()只能随机读取一帧,请问相关部分的代码能麻烦您帮忙指出或提供吗,万分感谢!

MemoryNet训练时候一些问题

您好,我使用您的MemoryNet进行医学图像分割,当和OCRNet训练相同轮数的时候,MemoryNet的miou比OCRNet低很多,这是什么原因

MemoryNetV2 相关问题

非常精彩的论文,

有个问题,根据我的代码阅读,MemoryNetV2在推理的时候也会过self-attention block

是不是考虑在推理的时候换一种attention模块去做历史特征的聚合,这样会快比较多,也不会显著掉点?

验证代码

作者您好,我看您的代码中是不是没有训练时候的验证代码?

Training on custom dataset with 4 channels

Hi,
I want to train my own dataset which has images in 4 channels - RGB images and IR(infrared) images. Could you help me out with that? How can i modify the codes of this repo to accommodate that extra channel?

What does the 'fine-tuned' mean?

In ISNet, the models are fine-tuned for 160K iterations on ADE20K and LIP datasets. So do you pretrained the models on other datasets?

ERROR: Could not build wheels for chainercv, which is required to install pyproject.toml-based projects

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for chainercv
Running setup.py clean for chainercv
Building wheel for chainer (setup.py) ... done
Created wheel for chainer: filename=chainer-7.8.1-py3-none-any.whl size=967716 sha256=8c04b26d59f9c9a7948bdaddf433a834e23959b9a1cc52bfc118919187807a64
Stored in directory: /home/mohammed/.cache/pip/wheels/c5/01/d5/3ef194fa83dbf1d97bab826ca2bf235071f412861189a7b9df
Building wheel for iopath (setup.py) ... done
Created wheel for iopath: filename=iopath-0.1.10-py3-none-any.whl size=31530 sha256=6bf140ecbf8c873308103a7c8ebd313cb75226c9d5673e94ac6333a0b1604b88
Stored in directory: /home/mohammed/.cache/pip/wheels/89/3e/24/0f349c0b2eeb6965903035f3b00dbb5c9bea437b4a2f18d82c
Building wheel for typing (setup.py) ... done
Created wheel for typing: filename=typing-3.7.4.3-py3-none-any.whl size=26305 sha256=3b4c4b6304afadcb8fc95d74ae6dd87c9bcd4b92f4c42dcdf90faad9a077f294
Stored in directory: /home/mohammed/.cache/pip/wheels/5e/5d/01/3083e091b57809dad979ea543def62d9d878950e3e74f0c930
Successfully built fvcore chainer iopath typing
Failed to build chainercv
ERROR: Could not build wheels for chainercv, which is required to install pyproject.toml-based projects

单机多卡问题

你好,请教一下单机多卡问题,
不管设置gpu数量为多少,实际只使用了一张卡
默认的bs=8,单卡显存可以吃满,改为16还是一张卡,也没有溢出
无任何报错

IDRNet

... Hello, thank you for your outstanding contribution to the open source code core, the performance of IDRNet is very impressive, I would like to know how to configure mask2former+Idrnet, as described in your paper

医学图像分割也很有意义,我想给你一些公开的医学图像数据集。哈哈哈哈

Hi @CharlesPikachu !UNet 也是大名鼎鼎的分割模型啊,它在医学图像分割领域是 SOTA,个人认为 Supported Models 列表里应该有名字,而且应该在 FCN 之后。哈哈哈 🥇

虽然 PyTorch Hub 已经有预训练的 UNet 了,但我想要皮卡丘也有! 🛩️

这里提供一些医学数据集给你参考:

SWIN-B with DeepLabv3+ training on custom dataset

Hi, I am learning about Segmentation and want to try out the segmentation my custom data set. Could you please provide steps on how to use supported backbones with some particular architectures?

If I want to use SWIN-B as my backbone on DeepLabV3+ using a custom dataset, what should be the commands and all. I could not find anything on the docs and on the github page. Could you please help.

[BUG]

Screenshot (报错截图)
train.py line 173
1689852899414
Advice (修复建议)
cfg_file_path = self.cfg_file_path

模型复杂度计算和FLOPS

您好,我最近看了您的mcibi论文,很精彩,我想请问一下论文中的表格3的模型的复杂度和FLOPS是如何获取的

[BUG]: ERROR: Failed building wheel for chainercv

Environment (使用环境)

Question description (问题描述)

Building wheel for chainercv (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [57 lines of output]

error during training

(venv) mohammed@c24032:~/sssegmentation$ bash scripts/dist_train.sh 4 ssseg/configs/annnet/annnet_resnet50os16_ade20k.py


Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed.


2024-01-10 08:33:59 WARNING ngpus_per_node is not equal to nproc_per_node, force ngpus_per_node = nproc_per_node by default
Traceback (most recent call last):
File "ssseg/train.py", line 252, in
main()
File "ssseg/train.py", line 247, in main
client.start()
File "ssseg/train.py", line 70, in start
torch.cuda.set_device(cmd_args.local_rank)
File "/home/mohammed/model/new ss/venv/lib/python3.8/site-packages/torch/cuda/init.py", line 261, in set_device
torch._C._cuda_setDevice(device)

损失函数

您好,如果我想要在训练的时同时使用两种损失函数,那么config文件里面损失函数那块该怎么去写

关于每个数据集的通道正则化

您好,我有点疑惑,请问VOC, Cityscapes , Ade20k数据集的正则化都是:
('Normalize', {'mean': [123.675, 116.28, 103.53], 'std': [58.395, 57.12, 57.375]}), 嘛

pt2onnx

How to convert pt to onnx.
ples.
thanks

isnet:imagelevel.py

imagelevel.py :
47: feats_il = self.correlate_net(x, torch.cat([x_global, x], dim=1))

isanet.py:
47:context = super(SelfAttentionBlock, self).forward(x, x)

is there any problem? bug?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.