Skip to content

Commit 5fc1979

Browse files
authored
[Fix] Update ddrnet readme (#3198)
1 parent 057155d commit 5fc1979

5 files changed

+75
-15
lines changed

configs/ddrnet/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ Semantic segmentation is a key technology for autonomous vehicles to understand
2424

2525
### Cityscapes
2626

27-
| Method | Backbone | Crop Size | Lr schd | Mem(GB) | Inf time(fps) | Device | mIoU | mIoU(ms+flip) | config | download |
28-
| ------ | ------------- | --------- | ------- | ------- | ------------- | ------ | ----- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
29-
| DDRNet | DDRNet23-slim | 1024x1024 | 120000 | 1.70 | 85.85 | A100 | 77.84 | 80.15 | [config](https://github.com/open-mmlab/mmsegmentation/blob/main/configs/ddrnet/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/ddrnet/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024_20230426_145312-6a5e5174.pth) \| [log](https://download.openmmlab.com/mmsegmentation/v0.5/ddrnet/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024_20230426_145312.json) |
30-
| DDRNet | DDRNet23 | 1024x1024 | 120000 | 7.26 | 33.41 | A100 | 79.99 | 81.71 | [config](https://github.com/open-mmlab/mmsegmentation/blob/main/configs/ddrnet/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/ddrnet/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024_20230425_162633-81601db0.pth) \| [log](https://download.openmmlab.com/mmsegmentation/v0.5/ddrnet/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024_20230425_162633.json) |
27+
| Method | Backbone | Crop Size | Lr schd | Mem (GB) | Inf time (fps) | Device | mIoU | mIoU(ms+flip) | config | download |
28+
| ------ | ------------- | --------- | ------- | -------- | -------------- | ------ | ----- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
29+
| DDRNet | DDRNet23-slim | 1024x1024 | 120000 | 1.70 | 85.85 | A100 | 77.84 | 80.15 | [config](https://github.com/open-mmlab/mmsegmentation/blob/main/configs/ddrnet/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/ddrnet/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024_20230426_145312-6a5e5174.pth) \| [log](https://download.openmmlab.com/mmsegmentation/v0.5/ddrnet/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024_20230426_145312.json) |
30+
| DDRNet | DDRNet23 | 1024x1024 | 120000 | 7.26 | 33.41 | A100 | 79.99 | 81.71 | [config](https://github.com/open-mmlab/mmsegmentation/blob/main/configs/ddrnet/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/ddrnet/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024_20230425_162633-81601db0.pth) \| [log](https://download.openmmlab.com/mmsegmentation/v0.5/ddrnet/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024_20230425_162633.json) |
3131

3232
## Notes
3333

configs/ddrnet/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1.0023, 0.9539, 0.9843, 1.1116, 0.9037, 1.0865, 1.0955, 1.0865, 1.1529,
1111
1.0507
1212
]
13-
13+
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/ddrnet/pretrain/ddrnet23s-in1kpre_3rdparty-1ccac5b1.pth' # noqa
1414
crop_size = (1024, 1024)
1515
data_preprocessor = dict(
1616
type='SegDataPreProcessor',
@@ -31,9 +31,7 @@
3131
ppm_channels=128,
3232
norm_cfg=norm_cfg,
3333
align_corners=False,
34-
init_cfg=dict(
35-
type='Pretrained',
36-
checkpoint='pretrained/ddrnet23s_in1k_mmseg.pth')),
34+
init_cfg=dict(type='Pretrained', checkpoint=checkpoint)),
3735
decode_head=dict(
3836
type='DDRHead',
3937
in_channels=32 * 4,

configs/ddrnet/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1.0023, 0.9539, 0.9843, 1.1116, 0.9037, 1.0865, 1.0955, 1.0865, 1.1529,
1111
1.0507
1212
]
13-
13+
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/ddrnet/pretrain/ddrnet23-in1kpre_3rdparty-9ca29f62.pth' # noqa
1414
crop_size = (1024, 1024)
1515
data_preprocessor = dict(
1616
type='SegDataPreProcessor',
@@ -31,9 +31,7 @@
3131
ppm_channels=128,
3232
norm_cfg=norm_cfg,
3333
align_corners=False,
34-
init_cfg=dict(
35-
type='Pretrained',
36-
checkpoint='pretrained/ddrnet23_in1k_mmseg.pth')),
34+
init_cfg=dict(type='Pretrained', checkpoint=checkpoint)),
3735
decode_head=dict(
3836
type='DDRHead',
3937
in_channels=64 * 4,

configs/ddrnet/metafile.yaml

+52-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Collections:
2-
- Name: ''
2+
- Name: DDRNet
33
License: Apache License 2.0
44
Metadata:
55
Training Data:
@@ -11,4 +11,54 @@ Collections:
1111
README: configs/ddrnet/README.md
1212
Frameworks:
1313
- PyTorch
14-
Models: []
14+
Models:
15+
- Name: ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024
16+
In Collection: DDRNet
17+
Results:
18+
Task: Semantic Segmentation
19+
Dataset: Cityscapes
20+
Metrics:
21+
mIoU: 77.84
22+
mIoU(ms+flip): 80.15
23+
Config: configs/ddrnet/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024.py
24+
Metadata:
25+
Training Data: Cityscapes
26+
Batch Size: 12
27+
Architecture:
28+
- DDRNet23-slim
29+
- DDRNet
30+
Training Resources: 2x A100 GPUS
31+
Memory (GB): 1.7
32+
Weights: https://download.openmmlab.com/mmsegmentation/v0.5/ddrnet/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024_20230426_145312-6a5e5174.pth
33+
Training log: https://download.openmmlab.com/mmsegmentation/v0.5/ddrnet/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024_20230426_145312.json
34+
Paper:
35+
Title: Deep Dual-resolution Networks for Real-time and Accurate Semantic Segmentation
36+
of Road Scenes
37+
URL: http://arxiv.org/abs/2101.06085
38+
Code: ''
39+
Framework: PyTorch
40+
- Name: ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024
41+
In Collection: DDRNet
42+
Results:
43+
Task: Semantic Segmentation
44+
Dataset: Cityscapes
45+
Metrics:
46+
mIoU: 79.99
47+
mIoU(ms+flip): 81.71
48+
Config: configs/ddrnet/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024.py
49+
Metadata:
50+
Training Data: Cityscapes
51+
Batch Size: 12
52+
Architecture:
53+
- DDRNet23
54+
- DDRNet
55+
Training Resources: 2x A100 GPUS
56+
Memory (GB): 7.26
57+
Weights: https://download.openmmlab.com/mmsegmentation/v0.5/ddrnet/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024_20230425_162633-81601db0.pth
58+
Training log: https://download.openmmlab.com/mmsegmentation/v0.5/ddrnet/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024_20230425_162633.json
59+
Paper:
60+
Title: Deep Dual-resolution Networks for Real-time and Accurate Semantic Segmentation
61+
of Road Scenes
62+
URL: http://arxiv.org/abs/2101.06085
63+
Code: ''
64+
Framework: PyTorch

tools/misc/publish_model.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Copyright (c) OpenMMLab. All rights reserved.
22
import argparse
33
import subprocess
4+
from hashlib import sha256
45

56
import torch
67

8+
BLOCK_SIZE = 128 * 1024
9+
710

811
def parse_args():
912
parser = argparse.ArgumentParser(
@@ -14,6 +17,17 @@ def parse_args():
1417
return args
1518

1619

20+
def sha256sum(filename: str) -> str:
21+
"""Compute SHA256 message digest from a file."""
22+
hash_func = sha256()
23+
byte_array = bytearray(BLOCK_SIZE)
24+
memory_view = memoryview(byte_array)
25+
with open(filename, 'rb', buffering=0) as file:
26+
for block in iter(lambda: file.readinto(memory_view), 0):
27+
hash_func.update(memory_view[:block])
28+
return hash_func.hexdigest()
29+
30+
1731
def process_checkpoint(in_file, out_file):
1832
checkpoint = torch.load(in_file, map_location='cpu')
1933
# remove optimizer for smaller file size
@@ -22,7 +36,7 @@ def process_checkpoint(in_file, out_file):
2236
# if it is necessary to remove some sensitive data in checkpoint['meta'],
2337
# add the code here.
2438
torch.save(checkpoint, out_file)
25-
sha = subprocess.check_output(['sha256sum', out_file]).decode()
39+
sha = sha256sum(in_file)
2640
final_file = out_file.rstrip('.pth') + f'-{sha[:8]}.pth'
2741
subprocess.Popen(['mv', out_file, final_file])
2842

0 commit comments

Comments
 (0)