Error finetuning YOLO3

Hi, I’m trying to fine tune YOLO3 using the SSD example given in

I only make minor changes to that code (SSD to YOLO3). So I use:

net = gcv.model_zoo.get_model(‘yolo3_darknet53_voc’, pretrained=True)

and in the following function I change SSDDefaultTrainTransform to YOLO3DefaultTrainTransform:
def get_dataloader(net, train_dataset, data_shape, batch_size, num_workers):
from import YOLO3DefaultTrainTransform
with autograd.train_mode():

_, _, anchors = net(mx.nd.zeros((1, 3, height, width)))

I get the following error:
RuntimeError: Parameter ‘yolov35_yolooutputv30_conv0_weight’ has not been initialized. Note that you should initialize parameters and create Trainer with Block.collect_params() instead of Block.params because the later does not include Parameters of nested child Blocks

Any suggestions on how I can fix this error?

Thank you.


I can not reproduce this with the latest gluoncv package (from github), I’m guessing that your version doesn’t initialize the new prediction layer in the call to reset_class.

This was fixed on Feb 14:

Now, you can not reuse the SSD DataLoader like that, as the Yolo network works differently.

For instance, the purpose of this dummy call to the network is that the GluonCV’s SSD implementation generates the anchor boxes the first time the network is run:

_, _, anchors = net(mx.nd.zeros((1, 3, height, width)))

For Yolo they are created earlier, hardcoded in the call to yolo3_darknet53_voc.

If you want to finetune YoloV3 I would start from the YoloV3 training script instead: