Skip to content

Commit a810f67

Browse files
committed
adjust: save initial_point
#20221024001
1 parent ef89266 commit a810f67

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
pixel2point.load_state_dict(checkpoint['model_state_dict'])
4343
loss_function = checkpoint['criterion']
4444

45+
plotly_path = settings.output_path.joinpath('plotly')
46+
plotly_path.mkdir(parents=True, exist_ok=True)
47+
show_3d(pixel2point.initial_point, path=plotly_path.joinpath('initial_point.html'))
48+
4549
loss_test = 0
4650
pixel2point.train(mode=False)
4751
loss_function.train_param(mode=False)
@@ -53,18 +57,15 @@
5357

5458
output = pixel2point.forward(pred)
5559
output = output.type_as(gt).view((gt.shape[0], -1, 3))
56-
loss, _ = loss_function(output, gt)
60+
loss, _ = loss_function.forward(output, gt)
5761

5862
loss_test += loss.item()
5963
test_bar.set_description(f'Testing')
6064
test_bar.set_postfix(loss=loss.item())
6165

6266
if i_batch == 5:
63-
plotly_path = settings.output_path.joinpath('plotly')
64-
plotly_path.mkdir(parents=True, exist_ok=True)
65-
save_multiple_images(pred[:100].permute(0, 2, 3, 1).detach().cpu(), plotly_path.joinpath('imgs.png'))
66-
show_3d(pixel2point.initial_point, path=plotly_path.joinpath('initial_point.html'))
67-
watch_index = 82
67+
save_multiple_images(pred[:None].permute(0, 2, 3, 1).detach().cpu(), plotly_path.joinpath('imgs.png'))
68+
watch_index = 48
6869
show_result(pred[watch_index], output[watch_index], gt[watch_index], plotly_path, watch_index)
6970

7071
logger.debug(f'Testing Loss: {loss_test / len(test_loader)}')

0 commit comments

Comments
 (0)