forked from qinzheng93/CNN-Calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpecMonitorForRadarNet.py
More file actions
35 lines (29 loc) · 1.46 KB
/
SpecMonitorForRadarNet.py
File metadata and controls
35 lines (29 loc) · 1.46 KB
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
from __future__ import print_function
from DNNCalculator import Tensor, DNNCalculator
class SpecMonitorForRadarNetCalc(DNNCalculator):
def __init__(self, only_mac=True):
super(SpecMonitorForRadarNetCalc, self).__init__(only_mac)
'''
Spec. Monitor for Radar Net Model.
Source: http://arxiv.org/abs/1705.00462
'''
def SpecMonitorForRadarNet(self, tensor):
tensor = self.Conv2d(tensor, out_c=48, size=(11, 11), stride=(1, 1), padding=(0, 0))
tensor = self.MaxPool2d(tensor, size=(11, 11), stride=(1, 1), padding=(0, 0))
tensor = self.Conv2d(tensor, out_c=128, size=(5, 5), stride=(1, 1), padding=(0, 0))
tensor = self.MaxPool2d(tensor, size=(5, 5), stride=(1, 1), padding=(0, 0))
tensor = self.Conv2d(tensor, out_c=192, size=(3, 3), stride=(1, 1), padding=(0, 0))
tensor = self.Conv2d(tensor, out_c=192, size=(3, 3), stride=(1, 1), padding=(0, 0))
tensor = self.Conv2d(tensor, out_c=128, size=(3, 3), stride=(1, 1), padding=(0, 0))
tensor = self.Flatten(tensor)
tensor = self.Linear(tensor, 1024)
tensor = self.Linear(tensor, 1024)
return tensor
def calculate(self):
tensor = Tensor(1, 64, 64)
tensor = self.SpecMonitorForRadarNet(tensor)
print('params: {}, flops: {}'.format(self.params, self.flops))
if __name__ == '__main__':
only_mac = False
calculator = SpecMonitorForRadarNetCalc(only_mac=only_mac)
calculator.calculate()