Skip to content
Snippets Groups Projects
Commit 1daf52a3 authored by chenjun2hao's avatar chenjun2hao
Browse files

update the accuracy

parent 383cb532
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,7 @@ download the pretrained model on imagenet or the segmentation model from the [of
## VAL
use the [official pretrained model](https://github.com/ydhongHIT/DDRNet) and our `eval.py` code. so the result may different from official.
use the [official pretrained model](https://github.com/ydhongHIT/DDRNet) and our `eval.py` code. with [ydhongHIT's](https://github.com/ydhongHIT) advice now can reach the same accuracy in the paper. Thanks.
```python
cd ${PROJECT}
......@@ -48,14 +48,14 @@ python tools/eval.py --cfg experiments/cityscapes/ddrnet23_slim.yaml
| model | Train Set | Test Set | OHEM | Multi-scale| Flip | mIoU | Link |
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
| DDRNet23_slim | unknown | eval | Yes | No | No | 76.83 | [official](https://github.com/ydhongHIT/DDRNet) |
| DDRNet23_slim | unknown | eval | Yes | No | Yes| 77.40 | [official](https://github.com/ydhongHIT/DDRNet) |
| DDRNet23 | unknown | eval | Yes | No | No | 78.41 | [official](https://github.com/ydhongHIT/DDRNet) |
| DDRNet23 | unknown | eval | Yes | No | Yes| 78.85 | [official](https://github.com/ydhongHIT/DDRNet) |
| DDRNet23_slim | unknown | eval | Yes | No | No | 77.83 | [official](https://github.com/ydhongHIT/DDRNet) |
| DDRNet23_slim | unknown | eval | Yes | No | Yes| 78.42 | [official](https://github.com/ydhongHIT/DDRNet) |
| DDRNet23 | unknown | eval | Yes | No | No | 79.51 | [official](https://github.com/ydhongHIT/DDRNet) |
| DDRNet23 | unknown | eval | Yes | No | Yes| 79.98 | [official](https://github.com/ydhongHIT/DDRNet) |
**Note**
- [the official repository](https://github.com/ydhongHIT/DDRNet) on DDRNet23_slim without Flip can reach 77.40 on cityscapes dataset
- with the `ALIGN_CORNERS: false` in `***.yaml` will reach higher accuracy.
## TRAIN
......@@ -78,6 +78,7 @@ python -m torch.distributed.launch --nproc_per_node=2 tools/train.py --cfg exper
| DDRNet39 | train | eval | Yes | No | Yes | ~ | None |
**Note**
- set the `ALIGN_CORNERS: true` in `***.yaml`, because i use the default setting in [HRNet-Semantic-Segmentation OCR](https://github.com/HRNet/HRNet-Semantic-Segmentation/tree/HRNet-OCR).
- Multi-scale with scales: 0.5,0.75,1.0,1.25,1.5,1.75. it runs too slow.
- from [ydhongHIT](https://github.com/ydhongHIT), can change the `align_corners=True` with better performance, the default option is `False`
......
......@@ -18,6 +18,7 @@ MODEL:
NAME: ddrnet_23
NUM_OUTPUTS: 2
PRETRAINED: "pretrained_models/DDRNet23_imagenet.pth"
ALIGN_CORNERS: false
LOSS:
USE_OHEM: true
OHEMTHRES: 0.9
......@@ -49,7 +50,7 @@ TEST:
- 1024
BASE_SIZE: 2048
BATCH_SIZE_PER_GPU: 4
FLIP_TEST: false
FLIP_TEST: true
MULTI_SCALE: false
MODEL_FILE: "pretrained_models/best_val.pth"
OUTPUT_INDEX: 0
......@@ -18,6 +18,7 @@ MODEL:
NAME: ddrnet_23_slim
NUM_OUTPUTS: 2
PRETRAINED: "pretrained_models/DDRNet23s_imagenet.pth"
ALIGN_CORNERS: false
LOSS:
USE_OHEM: true
OHEMTHRES: 0.9
......@@ -49,9 +50,9 @@ TEST:
- 1024
BASE_SIZE: 2048
BATCH_SIZE_PER_GPU: 4
FLIP_TEST: true
FLIP_TEST: false
MULTI_SCALE: false
SCALE_LIST: [1]
#0.5,0.75,1.0,1.25,1.5,1.75
MODEL_FILE: "pretrained_models/best_val_smaller.pth"
# MODEL_FILE: "pretrained_models/best_val_smaller.pth"
OUTPUT_INDEX: 0
......@@ -27,7 +27,7 @@ def parse_args():
parser.add_argument('--cfg',
help='experiment configure file name',
default="experiments/map/map_hrnet_ocr_w18_small_v2_512x1024_sgd_lr1e-2_wd5e-4_bs_12_epoch484.yaml",
default="experiments/cityscapes/ddrnet23_slim.yaml",
type=str)
parser.add_argument('opts',
help="Modify config options using the command-line",
......@@ -46,7 +46,7 @@ class onnx_net(nn.Module):
def forward(self, x):
x1, x2 = self.backone(x)
y = F.interpolate(x2, size=(480,640), mode='bilinear')
y = F.interpolate(x1, size=(480,640), mode='bilinear')
# y = F.softmax(y, dim=1)
y = torch.argmax(y, dim=1)
......@@ -94,18 +94,19 @@ def main():
model.load_state_dict(model_dict)
net = onnx_net(model)
net = net.eval()
# x = torch.randn((1, 3, 512, 384))
x = torch.randn((1,3,480,640))
torch_out = net(x)
# output_path = "output/tensorrt/resnet50/resnet50_bilinear.onnx"
output_path = "output/hrnetv2_w18_480_640.onnx"
output_path = "output/ddrnet23_slim.onnx"
torch.onnx.export(net, # model being run
x, # model input (or a tuple for multiple inputs)
output_path, # where to save the model (can be a file or file-like object)
export_params=True, # store the trained parameter weights inside the model file
opset_version=9, # the ONNX version to export the model to
opset_version=11, # the ONNX version to export the model to
do_constant_folding=True, # whether to execute constant folding for optimization
input_names = ['inputx'], # the model's input names
output_names = ['outputy'], # the model's output names
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment