|
42 | 42 | pixel2point.load_state_dict(checkpoint['model_state_dict'])
|
43 | 43 | loss_function = checkpoint['criterion']
|
44 | 44 |
|
| 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 | + |
45 | 49 | loss_test = 0
|
46 | 50 | pixel2point.train(mode=False)
|
47 | 51 | loss_function.train_param(mode=False)
|
|
53 | 57 |
|
54 | 58 | output = pixel2point.forward(pred)
|
55 | 59 | output = output.type_as(gt).view((gt.shape[0], -1, 3))
|
56 |
| - loss, _ = loss_function(output, gt) |
| 60 | + loss, _ = loss_function.forward(output, gt) |
57 | 61 |
|
58 | 62 | loss_test += loss.item()
|
59 | 63 | test_bar.set_description(f'Testing')
|
60 | 64 | test_bar.set_postfix(loss=loss.item())
|
61 | 65 |
|
62 | 66 | 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 |
68 | 69 | show_result(pred[watch_index], output[watch_index], gt[watch_index], plotly_path, watch_index)
|
69 | 70 |
|
70 | 71 | logger.debug(f'Testing Loss: {loss_test / len(test_loader)}')
|
0 commit comments