質問編集履歴
1
具体的なコードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -125,3 +125,59 @@
|
|
125
125
|
##roi_headsのコード
|
126
126
|
|
127
127
|
https://github.com/pytorch/vision/blob/10d5a55c332771164c13375f445331c52f8de6f1/torchvision/models/detection/roi_heads.py
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
##追加
|
132
|
+
|
133
|
+
すみませんほしいfc7の部分のコードはこちらになります。
|
134
|
+
|
135
|
+
```
|
136
|
+
|
137
|
+
class TwoMLPHead(nn.Module):
|
138
|
+
|
139
|
+
"""
|
140
|
+
|
141
|
+
Standard heads for FPN-based models
|
142
|
+
|
143
|
+
Arguments:
|
144
|
+
|
145
|
+
in_channels (int): number of input channels
|
146
|
+
|
147
|
+
representation_size (int): size of the intermediate representation
|
148
|
+
|
149
|
+
"""
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
def __init__(self, in_channels, representation_size):
|
154
|
+
|
155
|
+
super(TwoMLPHead, self).__init__()
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
self.fc6 = nn.Linear(in_channels, representation_size)
|
160
|
+
|
161
|
+
self.fc7 = nn.Linear(representation_size, representation_size)
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
def forward(self, x):
|
166
|
+
|
167
|
+
x = x.flatten(start_dim=1)
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
x = F.relu(self.fc6(x))
|
172
|
+
|
173
|
+
x = F.relu(self.fc7(x))
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
return x
|
178
|
+
|
179
|
+
```
|
180
|
+
|
181
|
+
ここの部分のすべてのコードはこちらです
|
182
|
+
|
183
|
+
https://github.com/pytorch/vision/blob/10d5a55c332771164c13375f445331c52f8de6f1/torchvision/models/detection/faster_rcnn.py
|