Hello,
I have done something like this to include mobilenet as base network…using this Repo
But i am getting Map as 0 even after 5 epochs.
I have randomized the weights.
My input image is 31*512
… (512*512
, This is a different dataset) I want to train the network using both datasets. My first target is to work with 512*512
.
I have not changed anything else from the source code…
Please help me out in getting some good MAP… Let me know the mistake i have done in the network…
class MobileNet_mod(nn.HybridBlock):
def __init__(self, base_model, multiplier=0.25, classes=3, **kwargs):
super(MobileNet_mod, self).__init__(**kwargs)
with self.name_scope():
self.features = nn.HybridSequential(prefix='')
for layer in base_model.features[:-35]:
self.features.add(layer)
def hybrid_forward(self, F, x, *args, **kwargs):
x = self.features(x)
#x = self.output(x)
return x
class MObFastRCNNHead(HybridBlock):
def __init__(self, base_model, num_classes, feature_stride, **kwargs):
super(MObFastRCNNHead, self).__init__(**kwargs)
self.feature_stride = feature_stride
self.bottom = nn.HybridSequential()
# Include last 2 mobilenet feature layers
for layer in base_model.features[-2:]:
self.bottom.add(layer)
self.cls_score = nn.Dense(in_units=128, units=num_classes, weight_initializer=initializer.Normal(0.01))
self.bbox_pred = nn.Dense(in_units=128, units=num_classes * 4, weight_initializer=initializer.Normal(0.001))
def hybrid_forward(self, F, feature_map, rois):
x = F.ROIPooling(data=feature_map, rois=rois, pooled_size=(3, 3), spatial_scale=1.0 / self.feature_stride)
x = self.bottom(x)
cls_score = self.cls_score(x)
cls_prob = F.softmax(data=cls_score) # shape(roi_num, num_classes)
bbox_pred = self.bbox_pred(x) # shape(roi_num, num_classes*4)
return cls_prob, bbox_pred