Coder Social home page Coder Social logo

rsipac_track2's Introduction

Introduction

Codes for RSIPAC track#2. Leave an issue if you have any problems.

How to run

Data perparing

Data directory should be like:

.
└── data
    ├── test
    │   ├── A
    │   ├── B
    │   └── instances_test.json
    └─── train
        ├── A
        ├── B
        └── label

Config

./configs/base.yaml is a baseline config, you can refer this for further development.

The first several lines define some global items and reusable items. Like name and version, these two is used for model log saving. Specifically, model checkpoints and logs will be saved to ./logs/{name}/{version}/*.{ckpt|yaml|csv}.

The following sections define each component in training:

1. model

I have implemented some common segmentation models by default, like segmentation_models_pytorch (smp) and mmsegmentation (mmseg). The superior model type is defined by model.type item in YAML.

1.1 SMPModel

For smp, I always use its Unet, so by default it will give you a Unet model. You can change this and other optional arguments in ./src/models/smp_models.py.

A reference config is like:

model:
  type: SMPModel
  model_type: Unet
  model_name: timm-efficientnet-b0
  pretrained_weight: noisy-student
  num_classes: 1

1.2 MMSegModel

For mmseg, the config defination is almost the same, but I added and deleted some components for my personal perferrence.

I used this instead of original mmseg is because it is time-consuming to install mmseg on Kaggle platform, so I channged every module that is imported from mmcv into pytorch native version. You can easily convert an mmseg model file into this repository by changing the import path.

The converted mmseg is at ./src/models/mmseg. There are already some files, including most frequently used segformer's MiT, segformer_head and uper_head, but not fully covered the whole mmseg.

For example:

model:
  type: MMSegModel
  backbone:
    type: timm
    model_name: resnet50
    pretrained: True
    in_chans: 6
  decode_head:
    type: UPerHead
    pool_scales: [1, 2, 3, 6]
    channels: 512
    dropout_ratio: 0.1
    num_classes: 1
    norm_cfg: {type: BN, requires_grad: True}
    align_corners: False

Here, I added timm backbone for every model that supports feature extraction. Arguments excepts type: timm will be passed to timm.create_model().

2. others

Code is simple, and you can refer the base.yaml and ./src/* for your custum changing.

Train

GPUS=0 # or 0,1 for multi-gpu training
python Solver --config /path/to/config --gpus $GPUS

Submission

First, define names in Submission.py, which is a list of your model names, that is, the name item in model config YAML file.

python Submission.py

The results will be saved at ./results/test.segm.json and ./results.zip.

rsipac_track2's People

Contributors

carnozhao avatar

Stargazers

Tobyzhou(zw2413221142@163.com) avatar  avatar  avatar  avatar Tianlong Ai avatar Jason avatar  avatar  avatar  avatar Qi Zhang avatar Wei Cui avatar  avatar Xukun Lu avatar  avatar Hailongn Jin avatar Yanll avatar  avatar Leo Kenway avatar  avatar  avatar vanden avatar Ye Ziyu avatar  avatar liu_1227 avatar huilin avatar  avatar JaxCen avatar  avatar  avatar PanYang avatar  avatar Megumi avatar Huang Xiaoyu avatar 李开宇 avatar Jiawei Jiang avatar  avatar kjc2023BF avatar

Watchers

 avatar

rsipac_track2's Issues

about result

          目前65.2

Originally posted by @CarnoZhao in #4 (comment)

您好,这个回答里您提到后续优化达到了65.2的好结果,方便问一下所使用的技术路线嘛?

use segformer

ModuleNotFoundError: No module named 'transformers'

score online?

非常棒的工作。请问有验证在线分数多少吗?

请求上传requirements.txt

你好,我是深度学习的初学者,想要学习您的代码,请问可以上传这个项目搭建环境的requirements.txt吗. 需要安装的包中存在版本不兼容的问题,谢谢!

FileNotFoundError: [Errno 2] No such file or directory: 'D:\\RSIPAC_Track2-rsipac\\c'

您好,运行solver.py的时候出现了以下问题
Traceback (most recent call last):
File "D:/RSIPAC_Track2-rsipac/Solver.py", line 74, in
cfg = OmegaConf.load(cfg)
File "D:\anaconda3\envs\deepl\lib\site-packages\omegaconf\omegaconf.py", line 187, in load
with io.open(os.path.abspath(file_), "r", encoding="utf-8") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'D:\RSIPAC_Track2-rsipac\c'

然后我尝试debug的时候发现cfg=c
而且在solver的第四行中parser.add_argument("--config", dest = "config", default = "config.yaml", type = str, nargs = "+")
项目中好像没有config.yaml文件,这个要怎么解决呢,或者要做什么修改采用其他的yaml吗

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.