-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtest_model.py
More file actions
36 lines (27 loc) · 758 Bytes
/
test_model.py
File metadata and controls
36 lines (27 loc) · 758 Bytes
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
#!/usr/bin/env python3
# Written by feymanpriv(yangminbupt@outlook.com)
import init_path
import sys
import numpy as np
import paddle
from core.config import cfg
import core.config as config
from model.dolg_model import DOLG
def main():
model = DOLG()
model.eval()
print(model)
# load parameters
state_dict = paddle.load(cfg.TEST.WEIGHTS)
model.set_dict(state_dict)
dummy_input = np.ones((1,3,512,512), dtype='float32')
dummy_input = paddle.to_tensor(dummy_input)
fea = model(dummy_input)
fea_numpy = fea.numpy()
print(fea_numpy.shape)
if __name__ == '__main__':
print(sys.argv)
config.load_cfg_fom_args("Extract feature.")
config.assert_and_infer_cfg()
cfg.freeze()
main()