Skip to content
Snippets Groups Projects
Unverified Commit e8d00094 authored by i-robot's avatar i-robot Committed by Gitee
Browse files

!3178 fix pspnet bug

Merge pull request !3178 from 周莉莉/issue
parents cccad698 958ab8ff
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,15 @@ The pyramid pooling module fuses features under four different pyramid scales.Fo
- [ADE20K Dataset Website](http://groups.csail.mit.edu/vision/datasets/ADE20K/)
- It contains 22,210 finely annotated images split into training and testing sets with 20,210 and 2,000 images respectively.
Datasets: attributes (names and colors) are needed, and please download as follows:
- [PASCAL VOC 2012 names.txt and colors.txt Website](https://github.com/hszhao/semseg/tree/master/data/voc2012)
- [ADE20K names.txt and colors.txt Website](https://github.com/hszhao/semseg/tree/master/data/ade20k)
# [Pretrained model](#contents)
[resnet50-imagenet pretrained model](https://download.mindspore.cn/thirdparty/pspnet/resnet_deepbase.ckpt)
# [Environmental requirements](#Contents)
- Hardware :(Ascend)
......@@ -61,10 +70,10 @@ The pyramid pooling module fuses features under four different pyramid scales.Fo
├── eval.py # Evaluation python file for ADE20K/VOC2012
├── export.py # export mindir
├── README.md # descriptions about PSPnet
├── config # the training config file
├── ade20k_pspnet50.yaml
└── voc2012_pspnet50.yaml
├── src # PSPNet
├── config # the training config file
├── ade20k_pspnet50.yaml
└── voc2012_pspnet50.yaml
├── dataset # data processing
├── dataset.py
└── transform.py
......@@ -89,7 +98,7 @@ The pyramid pooling module fuses features under four different pyramid scales.Fo
## Script Parameters
Set script parameters in src/config/ade20k_pspnet50.yaml and src/config/voc2012_pspnet50.yaml
Set script parameters in ./config/ade20k_pspnet50.yaml and ./config/voc2012_pspnet50.yaml
### Model
......
DATA:
data_root: /home/HEU_535/PSPNet/data/ADE/
data_root: ./data/ADE/
art_data_root: /cache/data/ADE
train_list: /home/HEU_535/PSPNet/data/ADE/training_list.txt
train_list: ./data/ADE/training_list.txt
art_train_list: /cache/data/ADE/training_list.txt
val_list: /home/HEU_535/PSPNet/data/ADE/val_list.txt
val_list: ./data/ADE/val_list.txt
art_val_list: /cache/data/ADE/val_list.txt
classes: 150
prefix: ADE
save_dir: /home/HEU_535/PSPNet/checkpoints/
save_dir: ./checkpoints/
backbone: resnet50
pretrain_path: /home/HEU_535/PSPNet/data/resnet_deepbase.ckpt
pretrain_path: ./data/resnet_deepbase.ckpt
art_pretrain_path: /cache/data/ADE/resnet_deepbase.ckpt
ckpt: /home/HEU_535/PSPNet/checkpoints/8P/ADE-100_316.ckpt
obs_save: obs://harbin-engineering-uni/PSPnet/save_checkpoint/ADE/
ckpt: ./checkpoints/8P/ADE-100_316.ckpt
obs_save: obs://PSPnet/save_checkpoint/ADE/
TRAIN:
arch: psp
......@@ -40,7 +40,7 @@ TRAIN:
TEST:
test_list: /home/HEU_535/PSPNet/data/ADE/list/validation.txt
test_list: ./data/ADE/list/validation.txt
split: val # split in [train, val and test]
base_size: 512 # based size for scaling
test_h: 473
......@@ -48,6 +48,6 @@ TEST:
scales: [1.0] # evaluation scales, ms as [0.5, 0.75, 1.0, 1.25, 1.5, 1.75]
index_start: 0 # evaluation start index in list
index_step: 0 # evaluation step index in list, 0 means to end
result_path: /home/HEU_535/PSPNet/result/ade/
color_txt: /home/HEU_535/PSPNet/config/ade20k/ade20k_colors.txt
name_txt: /home/HEU_535/PSPNet/config/ade20k/ade20k_names.txt
result_path: ./result/ade/
color_txt: ./ade20k/ade20k_colors.txt
name_txt: ./ade20k/ade20k_names.txt
DATA:
data_root: /home/HEU_535/PSPNet/data/voc/voc/
data_root: ./data/voc/voc/
art_data_root: /cache/data
train_list: /home/HEU_535/PSPNet/data/voc/voc/train_list.txt
train_list: ./data/voc/voc/train_list.txt
art_train_list: /cache/data/train_list.txt
val_list: /home/HEU_535/PSPNet/data/voc/voc/val_list.txt
val_list: ./data/voc/voc/val_list.txt
art_val_list: /cache/data/val_list.txt
classes: 21
prefix: voc
save_dir: /home/HEU_535/PSPNet/checkpoints/
save_dir: ./checkpoints/
backbone: resnet50
pretrain_path: /home/HEU_535/PSPNet/data/resnet_deepbase.ckpt
pretrain_path: ./data/resnet_deepbase.ckpt
art_pretrain_path: /cache/data/resnet_deepbase.ckpt
ckpt: /home/HEU_535/PSPNet/checkpoints/8P/voc-50_133.ckpt
obs_save: obs://harbin-engineering-uni/PSPnet/save_checkpoint/voc/
ckpt: ./checkpoints/8P/voc-50_133.ckpt
obs_save: obs://PSPnet/save_checkpoint/voc/
TRAIN:
arch: psp
......@@ -40,7 +40,7 @@ TRAIN:
TEST:
test_list: /home/HEU_535/PSPNet/dataset/voc2012/list/val.txt
test_list: ./dataset/voc2012/list/val.txt
split: val # split in [train, val and test]
base_size: 512 # based size for scaling
test_h: 473
......@@ -48,6 +48,6 @@ TEST:
scales: [1.0] # evaluation scales, ms as [0.5, 0.75, 1.0, 1.25, 1.5, 1.75]
index_start: 0 # evaluation start index in list
index_step: 0 # evaluation step index in list, 0 means to end
result_path: /home/HEU_535/PSPNet/result/voc/
color_txt: /home/HEU_535/PSPNet/config/voc2012/voc2012_colors.txt
name_txt: /home/HEU_535/PSPNet/config/voc2012/voc2012_names.txt
result_path: ./result/voc/
color_txt: ./voc2012/voc2012_colors.txt
name_txt: ./voc2012/voc2012_names.txt
......@@ -39,13 +39,13 @@ context.set_context(mode=context.GRAPH_MODE, device_target="Ascend",
def get_parser():
"""
Read parameter file
-> for ADE20k: ./src/config/voc2012_pspnet50.yaml
-> for voc2012: ./src/config/voc2012_pspnet50.yaml
-> for ADE20k: ./config/ade20k_pspnet50.yaml
-> for voc2012: ./config/voc2012_pspnet50.yaml
"""
parser = argparse.ArgumentParser(description='MindSpore Semantic Segmentation')
parser.add_argument('--config', type=str, required=True, default='./src/config/voc2012_pspnet50.yaml',
parser.add_argument('--config', type=str, required=True, default='./config/voc2012_pspnet50.yaml',
help='config file')
parser.add_argument('opts', help='see ./src/config/voc2012_pspnet50.yaml for all options', default=None,
parser.add_argument('opts', help='see ./config/voc2012_pspnet50.yaml for all options', default=None,
nargs=argparse.REMAINDER)
args_ = parser.parse_args()
assert args_.config is not None
......
......@@ -23,7 +23,7 @@ from mindspore import Tensor, context, load_checkpoint, load_param_into_net, exp
parser = argparse.ArgumentParser(description='maskrcnn export')
parser.add_argument("--device_id", type=int, default=0, help="Device id")
parser.add_argument("--batch_size", type=int, default=1, help="batch size")
parser.add_argument("--yaml_path", type=str, required=True, default='./src/config/voc2012_pspnet50.yaml',
parser.add_argument("--yaml_path", type=str, required=True, default='./config/voc2012_pspnet50.yaml',
help='yaml file path')
parser.add_argument("--ckpt_file", type=str, required=True, default='./checkpoints/voc/ADE-50_1063.ckpt',
help="Checkpoint file path.")
......
DATA:
data_root: ./data/ADE/
train_list: ./data/ADE/training_list.txt
val_list: ./data/ADE/val_list.txt # test_list: dataset/ade20k/list/validation.txt
classes: 150
prefix: ADE
save_dir: ./checkpoints/
backbone: resnet50
pretrain_path: ./data/resnet_deepbase.ckpt
ckpt: ./checkpoints/ade/ADE_1-100_2527.ckpt
TRAIN:
arch: psp
feature_size: 60
train_h: 473
train_w: 473
scale_min: 0.5 # minimum random scale
scale_max: 2.0 # maximum random scale
rotate_min: -10 # minimum random rotate
rotate_max: 10 # maximum random rotate
zoom_factor: 8 # zoom factor for final prediction during training, be in [1, 2, 4, 8]
ignore_label: 255
aux_weight: 0.4
data_name: ade
batch_size: 8 # batch size for training
batch_size_val: 8 # batch size for validation during training
base_lr: 0.005
epochs: 100
start_epoch: 0
power: 0.9
momentum: 0.9
weight_decay: 0.0001
TEST:
test_list: ./dataset/ade20k/list/validation.txt
split: val # split in [train, val and test]
base_size: 512 # based size for scaling
test_h: 473
test_w: 473
scales: [1.0] # evaluation scales, ms as [0.5, 0.75, 1.0, 1.25, 1.5, 1.75]
index_start: 0 # evaluation start index in list
index_step: 0 # evaluation step index in list, 0 means to end
result_path: ./result/ade/
color_txt: ./src/config/ade20k/ade20k_colors.txt
name_txt: ./src/config/ade20k/ade20k_names.txt
DATA:
data_root: /home/HEU_535/PSPNet/data/voc/voc/
train_list: /home/HEU_535/PSPNet/data/voc/voc/train_list.txt
val_list: /home/HEU_535/PSPNet/data/voc/voc/val_list.txt
classes: 21
prefix: voc
save_dir: /home/HEU_535/PSPNet/checkpoints/
backbone: resnet50
pretrain_path: /home/HEU_535/PSPNet/data/resnet_deepbase.ckpt
ckpt: /home/HEU_535/PSPNet/checkpoints/8P/voc-50_133.ckpt
TRAIN:
arch: psp
feature_size: 60
train_h: 473
train_w: 473
scale_min: 0.5 # minimum random scale
scale_max: 2.0 # maximum random scale
rotate_min: -10 # minimum random rotate
rotate_max: 10 # maximum random rotate
zoom_factor: 8 # zoom factor for final prediction during training, be in [1, 2, 4, 8]
ignore_label: 255
aux_weight: 0.4
data_name:
batch_size: 8 # batch size for training
batch_size_val: 8 # batch size for validation during training, memory and speed tradeoff
base_lr: 0.005
epochs: 50
start_epoch: 0
power: 0.9
momentum: 0.9
weight_decay: 0.0001
TEST:
test_list: /home/HEU_535/PSPNet/dataset/voc2012/list/val.txt
split: val # split in [train, val and test]
base_size: 512 # based size for scaling
test_h: 473
test_w: 473
scales: [1.0] # evaluation scales, ms as [0.5, 0.75, 1.0, 1.25, 1.5, 1.75]
index_start: 0 # evaluation start index in list
index_step: 0 # evaluation step index in list, 0 means to end
result_path: /home/HEU_535/PSPNet/result/voc/
color_txt: /home/HEU_535/PSPNet/config/voc2012/voc2012_colors.txt
name_txt: /home/HEU_535/PSPNet/config/voc2012/voc2012_names.txt
......@@ -14,7 +14,7 @@
# ============================================================================
""" PSPNet loss function """
from mindspore import nn
from src.utils.metrics import SoftmaxCrossEntropyLoss
from src.utils.aux_loss import SoftmaxCrossEntropyLoss
class Aux_CELoss_Cell(nn.Cell):
......
......@@ -14,7 +14,7 @@
# ============================================================================
""" eval_callback """
from mindspore.nn.metrics.metric import Metric
from src.utils.metrics import SoftmaxCrossEntropyLoss
from src.utils.aux_loss import SoftmaxCrossEntropyLoss
class pspnet_metric(Metric):
......
......@@ -48,8 +48,8 @@ Model_Art = False
def get_parser():
"""
Read parameter file
-> for ADE20k: ./src/config/voc2012_pspnet50.yaml
-> for voc2012: ./src/config/voc2012_pspnet50.yaml
-> for ADE20k: ./config/ade20k_pspnet50.yaml
-> for voc2012: ./config/voc2012_pspnet50.yaml
"""
global Model_Art
parser = argparse.ArgumentParser(description='MindSpore Semantic Segmentation')
......@@ -63,7 +63,7 @@ def get_parser():
help='Location of training outputs.')
parser.add_argument('--dataset_name', type=str, default='',
help='aux parameter for ModelArt')
parser.add_argument('opts', help='see ./src/config/voc2012_pspnet50.yaml for all options', default=None,
parser.add_argument('opts', help='see ./config/voc2012_pspnet50.yaml for all options', default=None,
nargs=argparse.REMAINDER)
args_ = parser.parse_args()
if args_.model_art:
......@@ -253,4 +253,4 @@ def psp_train():
if __name__ == "__main__":
args = get_parser()
print(args.obs_save)
# psp_train()
psp_train()
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment