forked from huawei/mindspore2022
!20942 Improve performance of EPP-MVSNet
Merge pull request !20942 from NewMesc/master
This commit is contained in:
commit
70607366ed
|
|
@ -60,7 +60,7 @@ After installing MindSpore via the official website and Dataset is correctly gen
|
|||
|
||||
```python
|
||||
# run evaluation example with BlendedMVS dataset
|
||||
sh eval.sh
|
||||
sh eval.sh [DATA_PATH] [GPU_ID]
|
||||
```
|
||||
|
||||
# [Script Description](#contents)
|
||||
|
|
@ -107,7 +107,7 @@ Parameters for EPP-MVSNet evaluation can be set in validate.py.
|
|||
- EPP-MVSNet evaluation on GPU
|
||||
|
||||
```python
|
||||
sh eval.sh
|
||||
sh eval.sh [DATA_PATH] [GPU_ID]
|
||||
```
|
||||
|
||||
Evaluation result will be stored in "./results/blendedmvs/val/metrics.txt". You can find the result like the
|
||||
|
|
@ -117,7 +117,7 @@ Parameters for EPP-MVSNet evaluation can be set in validate.py.
|
|||
stage3_l1_loss:1.1738
|
||||
stage3_less1_acc:0.8734
|
||||
stage3_less3_acc:0.938
|
||||
mean forward time(s/pic):0.2697
|
||||
mean forward time(s/pic):0.1259
|
||||
```
|
||||
|
||||
# [Model Description](#contents)
|
||||
|
|
@ -128,16 +128,16 @@ Parameters for EPP-MVSNet evaluation can be set in validate.py.
|
|||
|
||||
| Parameter | EPP-MVSNet GPU |
|
||||
| ------------------------------ | ---------------------------- |
|
||||
| Model Version | Inception V1 |
|
||||
| Model Version | Inception V2 |
|
||||
| Resource | Tesla V100 16GB; Ubuntu16.04 |
|
||||
| uploaded Date | 06/22/2021(month/day/year) |
|
||||
| uploaded Date | 07/27/2021(month/day/year) |
|
||||
| MindSpore Version | 1.3.0 |
|
||||
| Dataset | BlendedMVS |
|
||||
| Batch_size | 1 |
|
||||
| Output | ./results/blendedmvs/val |
|
||||
| Acc_less_1mm | 0.8734 |
|
||||
| Acc_less_3mm | 0.938 |
|
||||
| mean_time(s/pic) | 0.2697 |
|
||||
| mean_time(s/pic) | 0.1259 |
|
||||
|
||||
# [Description of random situation](#contents)
|
||||
|
||||
|
|
|
|||
|
|
@ -54,15 +54,15 @@ class SingleStage(nn.Cell):
|
|||
depth_interval = depth_interval.view(B, 1, 1, 1)
|
||||
interim_scale = 1
|
||||
|
||||
ref_ncdhw = self.expand_dims(ref_feat, 2).view(B, C, 1, -1)
|
||||
ref_ncdhw = self.tile(ref_ncdhw, (1, 1, D, 1)).view(B, C, D, H, W)
|
||||
ref_ncdhw = self.transpose(ref_feat, (0, 2, 3, 1)).view(B, 1, -1, C)
|
||||
ref_ncdhw = self.tile(ref_ncdhw, (1, D, 1, 1)).view(B, D, H, W, C)
|
||||
|
||||
pair_results = [] # MVS
|
||||
|
||||
weight_sum = self.zeros((ref_ncdhw.shape[0], 1, 1, ref_ncdhw.shape[3] // interim_scale,
|
||||
ref_ncdhw.shape[4] // interim_scale), mstype.float32)
|
||||
fused_interim = self.zeros((ref_ncdhw.shape[0], 8, ref_ncdhw.shape[2] // interim_scale, ref_ncdhw.shape[3] //
|
||||
interim_scale, ref_ncdhw.shape[4] // interim_scale), mstype.float32)
|
||||
weight_sum = self.zeros((ref_ncdhw.shape[0], 1, 1, ref_ncdhw.shape[2] // interim_scale,
|
||||
ref_ncdhw.shape[3] // interim_scale), mstype.float32)
|
||||
fused_interim = self.zeros((ref_ncdhw.shape[0], 8, ref_ncdhw.shape[1] // interim_scale, ref_ncdhw.shape[2] //
|
||||
interim_scale, ref_ncdhw.shape[3] // interim_scale), mstype.float32)
|
||||
|
||||
depth_values = get_depth_values(depth_start, D, depth_interval, False)
|
||||
|
||||
|
|
@ -221,8 +221,8 @@ class SingleStageP2_S1(nn.Cell):
|
|||
|
||||
B, C, H, W = ref_feat.shape
|
||||
|
||||
ref_ncdhw = self.expand_dims(ref_feat, 2).view(B, C, 1, -1)
|
||||
ref_ncdhw = self.tile(ref_ncdhw, (1, 1, 32, 1)).view(B, C, 32, H, W)
|
||||
ref_ncdhw = self.transpose(ref_feat, (0, 2, 3, 1)).view(B, 1, -1, C)
|
||||
ref_ncdhw = self.tile(ref_ncdhw, (1, 32, 1, 1)).view(B, 32, H, W, C)
|
||||
|
||||
src_feat = src_feats[:, idx]
|
||||
proj_mat = proj_mats[:, idx]
|
||||
|
|
@ -279,8 +279,8 @@ class SingleStageP2_S3(nn.Cell):
|
|||
depth_start = depth_start.reshape(B, 1, 1, 1)
|
||||
depth_end = depth_start + (D - 1) * depth_interval
|
||||
|
||||
ref_ncdhw = self.expand_dims(ref_feat, 2).view(B, C, 1, -1)
|
||||
ref_ncdhw = self.tile(ref_ncdhw, (1, 1, 96, 1)).view(B, C, 96, H, W)
|
||||
ref_ncdhw = self.transpose(ref_feat, (0, 2, 3, 1)).view(B, 1, -1, C)
|
||||
ref_ncdhw = self.tile(ref_ncdhw, (1, 96, 1, 1)).view(B, 96, H, W, C)
|
||||
|
||||
src_feat = src_feats[:, idx]
|
||||
proj_mat = proj_mats[:, idx]
|
||||
|
|
|
|||
|
|
@ -335,7 +335,6 @@ class HomoWarp(nn.Cell):
|
|||
x_s = squeeze(x_s)
|
||||
y_s = squeeze(y_s)
|
||||
out_fmap = self.bilinear_sampler(input_fmap, x_s, y_s)
|
||||
out_fmap = trans(out_fmap, (0, 4, 1, 2, 3))
|
||||
|
||||
return out_fmap
|
||||
|
||||
|
|
@ -429,8 +428,8 @@ def entropy_num_based(volume, dim, depth_num, keepdim=False):
|
|||
|
||||
|
||||
def groupwise_correlation(v1, v2, groups, dim):
|
||||
n, c, d, h, w = v1.shape
|
||||
reshaped_size = (n, groups, c // groups, d, h, w)
|
||||
n, d, h, w, c = v1.shape
|
||||
reshaped_size = (n, d, h, w, groups, c // groups)
|
||||
v1_reshaped = v1.view(*reshaped_size)
|
||||
v2_reshaped = v2.view(*reshaped_size)
|
||||
vc = P.ReduceSum()(v1_reshaped * v2_reshaped, dim + 1)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ def get_opts():
|
|||
parser = ArgumentParser()
|
||||
parser.add_argument('--gpu_id', type=int, default=0, choices=[0, 1, 2, 3, 4, 5, 6, 7],
|
||||
help='which gpu used to inference')
|
||||
## vis
|
||||
## data
|
||||
parser.add_argument('--root_dir', type=str,
|
||||
default='/home/ubuntu/data/DTU/mvs_training/dtu/',
|
||||
help='root directory of dtu dataset')
|
||||
|
|
@ -73,7 +73,7 @@ def get_opts():
|
|||
|
||||
if __name__ == "__main__":
|
||||
args = get_opts()
|
||||
context.set_context(mode=0, device_target='GPU', device_id=args.gpu_id, save_graphs=False)
|
||||
context.set_context(mode=0, device_target='GPU', device_id=args.gpu_id, save_graphs=False, enable_graph_kernel=True)
|
||||
|
||||
dataset = BlendedMVSDataset(args.root_dir, args.split, n_views=args.n_views, depth_interval=args.depth_interval,
|
||||
img_wh=tuple(args.img_wh), levels=args.levels, scan=args.scan)
|
||||
|
|
|
|||
Loading…
Reference in New Issue