0

I have trained the resnet50_v1b_voc for two different objects and created the params file from the training. While the params files are working absolutely fine when I am doing prediction by loading only one throughout but getting issue in results if I load both of them together.

from gluoncv import model_zoo, data, utils
from matplotlib import pyplot as plt

net = model_zoo.get_model('faster_rcnn_resnet50_v1b_voc', pretrained=True, ctx=mx.gpu())

net.load_parameters('/home/ubuntu/abc/faster_rcnn_resnet50_v1b_voc_best.params', ctx=mx.gpu())
net.load_parameters('/home/ubuntu/xyz/faster_rcnn_resnet50_v1b_voc_best.params', ctx=mx.gpu())

net.reset_class(['abc'], reuse_weights={'abc': 'abc'})
class_IDs, scores, bounding_boxs = net(x)
# This works fine if I predict the abc object

# But when I do this the confidence score is too low for the xyz object
# Individually if I perform this task with xyz params the results are perfect
net.reset_class(['xyz'], reuse_weights={'xyz': 'xyz'})
class_IDs, scores, bounding_boxs = net(x)

Not sure what I am doing wrong here.

Nikhil Parmar
  • 876
  • 2
  • 11
  • 27

1 Answers1

0

The probable cause of the issue is the reset_class():

reset_class(classes, reuse_weights=None): Resets class categories and class predictors.

The pre-trained model supports many classes in the training dataset.

After call net.reset_class(['abc'],…), the net output will be changed to only support one class: ‘abc’. So, it would perform worse when predicting on ‘xyz’.

ArunJose
  • 1,999
  • 1
  • 10
  • 33