net.py
Go to the documentation of this file.
1 from __future__ import print_function
2 
3 import itertools, pkg_resources, sys
4 from distutils.version import LooseVersion
5 if LooseVersion(pkg_resources.get_distribution("chainer").version) >= LooseVersion('7.0.0') and \
6  sys.version_info.major == 2:
7  print('''Please install chainer < 7.0.0:
8 
9  sudo pip install chainer==6.7.0
10 
11 c.f https://github.com/jsk-ros-pkg/jsk_recognition/pull/2485
12 ''', file=sys.stderr)
13  sys.exit(1)
14 if [p for p in list(itertools.chain(*[pkg_resources.find_distributions(_) for _ in sys.path])) if "cupy-" in p.project_name ] == []:
15  print('''Please install CuPy
16 
17  sudo pip install cupy-cuda[your cuda version]
18 i.e.
19  sudo pip install cupy-cuda91
20 
21 ''', file=sys.stderr)
22  # sys.exit(1)
23 import chainer
24 import chainer.functions as F
25 import chainer.links as L
26 
27 
28 class EncoderFC3Dropout(chainer.Chain):
29 
30  def __init__(self):
31  super(EncoderFC3Dropout, self).__init__()
32  with self.init_scope():
33  self.fc1 = L.Linear(2133, 1024)
34  self.fc2 = L.Linear(1024, 1024)
35  self.fc3 = L.Linear(1024, 85)
36 
37  def __call__(self, x):
38  h = self.fc1(x)
39  h = F.relu(h)
40  h = F.dropout(h)
41  h = self.fc2(h)
42  h = F.relu(h)
43  h = F.dropout(h)
44  h = self.fc3(h)
45  return h


jsk_perception
Author(s): Manabu Saito, Ryohei Ueda
autogenerated on Mon May 3 2021 03:03:27