forked from QiXi9409/Simultaneous_ECG_Heartbeat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrpn_initor.py
41 lines (32 loc) · 1.19 KB
/
rpn_initor.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
import os
from torch import load
# from backbone.backbone_ import get_paprams, adjust_learning_rate, adjust_learning_rate2
from torch.nn import DataParallel
# from config import cfg as cfg2
from RPN import RPN
from config import cfg
from data_ import *
from backbone_ import *
match = {6: '0', 5: '1', 4: '2', 3: '0', 2: '1', 1: '2', 7: '2', 8: '0', 9: '1', 10: '2', 11: '0'}
from backbone_ import mb
class rpn_initor():
def __init__(self):
self.lr1 = 0.15
self.max_pre = 0
self.max_acc = 0
self.max_recall = 0
self.batch = 240
# os.environ["CUDA_VISIBLE_DEVICES"] = match[self.seed]
os.environ["CUDA_VISIBLE_DEVICES"] = '0'
self.features = mb().eval()
path = os.path.join(os.getcwd(), "base_max.p")
tmp = load(path)
print(path)
self.features.load_state_dict(tmp)
self.RPN = RPN()
# get_paprams(self.RPN)
self.features = self.features.cuda()
self.RPN = self.RPN.cuda()
self.RPN.apply(weights_init)
self.features = DataParallel(self.features, device_ids=[0])
self.RPN = DataParallel(self.RPN, device_ids=[0])