teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

具体的なコードの追加

2020/11/27 18:21

投稿

moriten
moriten

スコア1

title CHANGED
File without changes
body CHANGED
@@ -61,4 +61,32 @@
61
61
  よろしくおねがいします。
62
62
 
63
63
  ##roi_headsのコード
64
- https://github.com/pytorch/vision/blob/10d5a55c332771164c13375f445331c52f8de6f1/torchvision/models/detection/roi_heads.py
64
+ https://github.com/pytorch/vision/blob/10d5a55c332771164c13375f445331c52f8de6f1/torchvision/models/detection/roi_heads.py
65
+
66
+ ##追加
67
+ すみませんほしいfc7の部分のコードはこちらになります。
68
+ ```
69
+ class TwoMLPHead(nn.Module):
70
+ """
71
+ Standard heads for FPN-based models
72
+ Arguments:
73
+ in_channels (int): number of input channels
74
+ representation_size (int): size of the intermediate representation
75
+ """
76
+
77
+ def __init__(self, in_channels, representation_size):
78
+ super(TwoMLPHead, self).__init__()
79
+
80
+ self.fc6 = nn.Linear(in_channels, representation_size)
81
+ self.fc7 = nn.Linear(representation_size, representation_size)
82
+
83
+ def forward(self, x):
84
+ x = x.flatten(start_dim=1)
85
+
86
+ x = F.relu(self.fc6(x))
87
+ x = F.relu(self.fc7(x))
88
+
89
+ return x
90
+ ```
91
+ ここの部分のすべてのコードはこちらです
92
+ https://github.com/pytorch/vision/blob/10d5a55c332771164c13375f445331c52f8de6f1/torchvision/models/detection/faster_rcnn.py