forked from bansheng/3D-R2N2-pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prediction_generator.py
62 lines (53 loc) · 2.02 KB
/
prediction_generator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# coding=UTF-8
'''
@Description: 用于创建Pytorch版本的网络的逐步重建3D信息
@Author: dingyadong
@Github: https://github.com/bansheng
@LastAuthor: dingyadong
@since: 2019-04-13 09:50:42
@lastTime: 2019-05-13 10:11:28
'''
import os
from demo import main, set_pred_file_name, set_model_name, set_weights
from lib.config import cfg_from_list
Checkpoint_dir = [
# './output/ResidualGRUNet/default_model',
# './output/GRUNet/default_model',
# './output/ResidualGRUNoBNNet/default_model',
'./output/ResidualGRUNet_No_Regularition/default_model'
]
Pre_dir = [
# './prediction/ResidualGRUNet/',
# './prediction/GRUNet/',
# './prediction/ResidualGRUNoBNNet/',
'./prediction/ResidualGRUNet_No_Regularition/',
]
Model_names = [
# 'ResidualGRUNet',
# 'GRUNet',
# 'ResidualGRUNoBNNet',
'ResidualGRUNet_No_Regularition',
]
if __name__ == "__main__":
# solver_init()
cfg_from_list(['CONST.BATCH_SIZE', 1])
for checkpoint_dir, pre_dir, model_name in zip(Checkpoint_dir, Pre_dir, Model_names):
# print(checkpoint_dir, pre_dir)
weights = os.path.join(checkpoint_dir, 'checkpoint.tar')
set_weights(weights)
set_model_name(model_name)
# if pre_dir == './prediction/ResidualGRUNet_No_Regularition/':
# cfg_from_list(['TEST.VOXEL_THRESH', [0.4]])
for index in range(1, 11):
checkpoint_path = os.path.join(checkpoint_dir, 'checkpoint.%d.tar' % (index*2000))
# print(save_path)
symlink_path = os.path.join(checkpoint_dir, 'checkpoint.tar')
if os.path.lexists(symlink_path):
os.remove(symlink_path)
os.symlink("%s" % os.path.abspath(checkpoint_path), symlink_path)
# set_pred_file_name
name = os.path.join(pre_dir, 'prediction.%d.obj' % (index*2000))
set_pred_file_name(name)
main()
# Make a symlink to the latest network params
# os.symlink("%s" % os.path.abspath(checkpoint_path), symlink_path)