ใช้งานง่ายและปรับแต่ง SOTA Semantic Semgentation รุ่นที่มีชุดข้อมูลมากมายใน Pytorch

มีการเปลี่ยนแปลงมากมายตั้งแต่ปี 2565 ทุกวันนี้มีแม้แต่แบบจำลองการแบ่งส่วนแบบเปิดโล่ง (ส่วนใดก็ได้) อย่างไรก็ตามแบบจำลองการแบ่งส่วนแบบดั้งเดิมยังคงเป็นที่ต้องการความแม่นยำสูงและกรณีการใช้งานที่กำหนดเอง repo นี้จะได้รับการอัปเดตตามรุ่น Pytorch ใหม่รุ่นที่อัปเดตและเอกสารประกอบสำหรับวิธีใช้กับชุดข้อมูลที่กำหนดเอง ฯลฯ
วันที่วางจำหน่ายที่คาดหวัง -> พฤษภาคม 2567
คุณสมบัติที่วางแผนไว้:
คุณสมบัติปัจจุบันที่จะถูกทิ้ง:
รองรับแบ็คโบน:
หัว/วิธีที่รองรับ:
รุ่นสแตนด์อโลนที่รองรับ:
โมดูลที่รองรับ:
อ้างถึงโมเดลสำหรับมาตรฐานและรุ่นที่ผ่านการฝึกอบรมมาก่อน
และตรวจสอบแบ็คโบนสำหรับแบ็คโบนที่รองรับ
หมายเหตุ: วิธีการส่วนใหญ่ไม่มีโมเดลที่ผ่านการฝึกอบรมมาก่อน เป็นการยากมากที่จะรวมโมเดลที่แตกต่างกับน้ำหนักที่ได้รับการฝึกอบรมไว้ล่วงหน้าในพื้นที่เก็บข้อมูลเดียวและทรัพยากรที่ จำกัด เพื่อฝึกฝนตัวเองอีกครั้ง
การแยกวิเคราะห์ฉาก:
การแยกวิเคราะห์ของมนุษย์:
การแยกวิเคราะห์หน้า:
คนอื่น:
อ้างถึงชุดข้อมูลสำหรับรายละเอียดเพิ่มเติมและการเตรียมชุดข้อมูล
ตรวจสอบสมุดบันทึกที่นี่เพื่อทดสอบเอฟเฟกต์การเสริม
การแปลงระดับพิกเซล:
การแปลงระดับเชิงพื้นที่:
จากนั้นโคลน repo และติดตั้งโครงการด้วย:
$ git clone https://github.com/sithu31296/semantic-segmentation
$ cd semantic-segmentation
$ pip install -e . สร้างไฟล์การกำหนดค่าใน configs ตัวอย่างการกำหนดค่าสำหรับชุดข้อมูล ADE20K สามารถดูได้ที่นี่ จากนั้นแก้ไขฟิลด์ที่คุณคิดว่าจำเป็น ไฟล์การกำหนดค่านี้จำเป็นสำหรับสคริปต์การฝึกอบรมการประเมินผลและการทำนายทั้งหมด
เพื่อฝึกด้วย GPU เดียว:
$ python tools/train.py --cfg configs/CONFIG_FILE.yaml หากต้องการฝึกอบรมด้วย GPU หลายตัวให้ตั้งค่าฟิลด์ DDP ในไฟล์กำหนดค่าเป็น true และทำงานดังนี้:
$ python -m torch.distributed.launch --nproc_per_node=2 --use_env tools/train.py --cfg configs/ < CONFIG_FILE_NAME > .yaml ตรวจสอบให้แน่ใจว่าได้ตั้ง MODEL_PATH ของไฟล์การกำหนดค่าไปยังไดเรกทอรีโมเดลที่ผ่านการฝึกอบรมของคุณ
$ python tools/val.py --cfg configs/ < CONFIG_FILE_NAME > .yaml ในการประเมินด้วยหลายระดับและพลิกให้เปลี่ยนฟิลด์ ENABLE ใน MSF เป็น true และเรียกใช้คำสั่งเดียวกันกับด้านบน
หากต้องการทำการอนุมานให้แก้ไขพารามิเตอร์ของไฟล์กำหนดค่าจากด้านล่าง
MODEL >> NAME และ BACKBONE เป็นโมเดลที่คุณต้องการDATASET >> NAME เป็นชื่อชุดข้อมูลขึ้นอยู่กับโมเดลที่ผ่านการฝึกอบรมTEST >> MODEL_PATH ถึงน้ำหนักที่ได้รับการแก้ไขของแบบจำลองการทดสอบTEST >> FILE ไปยังเส้นทางไฟล์หรือโฟลเดอร์รูปภาพที่คุณต้องการทดสอบSAVE_DIR # # example using ade20k pretrained models
$ python tools/infer.py --cfg configs/ade20k.yamlตัวอย่างผลการทดสอบ (Segformer-B2):

ในการแปลงเป็น ONNX และ COREML, RUN:
$ python tools/export.py --cfg configs/ < CONFIG_FILE_NAME > .yamlหากต้องการแปลงเป็น openvino และ tflite ให้ดู Torch_optimize
# # ONNX Inference
$ python scripts/onnx_infer.py --model < ONNX_MODEL_PATH > --img-path < TEST_IMAGE_PATH >
# # OpenVINO Inference
$ python scripts/openvino_infer.py --model < OpenVINO_MODEL_PATH > --img-path < TEST_IMAGE_PATH >
# # TFLite Inference
$ python scripts/tflite_infer.py --model < TFLite_MODEL_PATH > --img-path < TEST_IMAGE_PATH > @article{xie2021segformer,
title={SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers},
author={Xie, Enze and Wang, Wenhai and Yu, Zhiding and Anandkumar, Anima and Alvarez, Jose M and Luo, Ping},
journal={arXiv preprint arXiv:2105.15203},
year={2021}
}
@misc{xiao2018unified,
title={Unified Perceptual Parsing for Scene Understanding},
author={Tete Xiao and Yingcheng Liu and Bolei Zhou and Yuning Jiang and Jian Sun},
year={2018},
eprint={1807.10221},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
@article{hong2021deep,
title={Deep Dual-resolution Networks for Real-time and Accurate Semantic Segmentation of Road Scenes},
author={Hong, Yuanduo and Pan, Huihui and Sun, Weichao and Jia, Yisong},
journal={arXiv preprint arXiv:2101.06085},
year={2021}
}
@misc{zhang2021rest,
title={ResT: An Efficient Transformer for Visual Recognition},
author={Qinglong Zhang and Yubin Yang},
year={2021},
eprint={2105.13677},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
@misc{huang2021fapn,
title={FaPN: Feature-aligned Pyramid Network for Dense Image Prediction},
author={Shihua Huang and Zhichao Lu and Ran Cheng and Cheng He},
year={2021},
eprint={2108.07058},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
@misc{wang2021pvtv2,
title={PVTv2: Improved Baselines with Pyramid Vision Transformer},
author={Wenhai Wang and Enze Xie and Xiang Li and Deng-Ping Fan and Kaitao Song and Ding Liang and Tong Lu and Ping Luo and Ling Shao},
year={2021},
eprint={2106.13797},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
@article{Liu2021PSA,
title={Polarized Self-Attention: Towards High-quality Pixel-wise Regression},
author={Huajun Liu and Fuqiang Liu and Xinyi Fan and Dong Huang},
journal={Arxiv Pre-Print arXiv:2107.00782 },
year={2021}
}
@misc{chao2019hardnet,
title={HarDNet: A Low Memory Traffic Network},
author={Ping Chao and Chao-Yang Kao and Yu-Shan Ruan and Chien-Hsiang Huang and Youn-Long Lin},
year={2019},
eprint={1909.00948},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
@inproceedings{sfnet,
title={Semantic Flow for Fast and Accurate Scene Parsing},
author={Li, Xiangtai and You, Ansheng and Zhu, Zhen and Zhao, Houlong and Yang, Maoke and Yang, Kuiyuan and Tong, Yunhai},
booktitle={ECCV},
year={2020}
}
@article{Li2020SRNet,
title={Towards Efficient Scene Understanding via Squeeze Reasoning},
author={Xiangtai Li and Xia Li and Ansheng You and Li Zhang and Guang-Liang Cheng and Kuiyuan Yang and Y. Tong and Zhouchen Lin},
journal={ArXiv},
year={2020},
volume={abs/2011.03308}
}
@ARTICLE{Yucondnet21,
author={Yu, Changqian and Shao, Yuanjie and Gao, Changxin and Sang, Nong},
journal={IEEE Signal Processing Letters},
title={CondNet: Conditional Classifier for Scene Segmentation},
year={2021},
volume={28},
number={},
pages={758-762},
doi={10.1109/LSP.2021.3070472}
}
@misc{yan2022lawin,
title={Lawin Transformer: Improving Semantic Segmentation Transformer with Multi-Scale Representations via Large Window Attention},
author={Haotian Yan and Chuang Zhang and Ming Wu},
year={2022},
eprint={2201.01615},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
@misc{yu2021metaformer,
title={MetaFormer is Actually What You Need for Vision},
author={Weihao Yu and Mi Luo and Pan Zhou and Chenyang Si and Yichen Zhou and Xinchao Wang and Jiashi Feng and Shuicheng Yan},
year={2021},
eprint={2111.11418},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
@misc{wightman2021resnet,
title={ResNet strikes back: An improved training procedure in timm},
author={Ross Wightman and Hugo Touvron and Hervé Jégou},
year={2021},
eprint={2110.00476},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
@misc{liu2022convnet,
title={A ConvNet for the 2020s},
author={Zhuang Liu and Hanzi Mao and Chao-Yuan Wu and Christoph Feichtenhofer and Trevor Darrell and Saining Xie},
year={2022},
eprint={2201.03545},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
@misc{li2022uniformer,
title={UniFormer: Unifying Convolution and Self-attention for Visual Recognition},
author={Kunchang Li and Yali Wang and Junhao Zhang and Peng Gao and Guanglu Song and Yu Liu and Hongsheng Li and Yu Qiao},
year={2022},
eprint={2201.09450},
archivePrefix={arXiv},
primaryClass={cs.CV}
}