ValueError: not enough values to unpack (expected 2, got 1)

Hi everyone,
I am doing mxnet rcnn trainign on my own data.
my data is of 512x512x3.
i am using mobilenet instead of vgg or resnet as a backbone.
i have added a symbol file in rcnn with mobilenet netowork.
i have params file of mobilenet0.25…
but when i run the training end2end.py script with network as mobilenet,
i am getting this below error.

Traceback (most recent call last):
File “train_end2end.py”, line 195, in
main()
File “train_end2end.py”, line 192, in main
lr=args.lr, lr_step=args.lr_step)
File “train_end2end.py”, line 84, in train_net
arg_params, aux_params = load_param(pretrained, epoch, convert=True)
File “/home/ubuntu/incubator-mxnet/example/rcnn/rcnn/utils/load_model.py”, line 66, in load_param
arg_params, aux_params = load_checkpoint(prefix, epoch)
File “/home/ubuntu/incubator-mxnet/example/rcnn/rcnn/utils/load_model.py”, line 36, in load_checkpoint
tp, name = k.split(’:’, 1)
ValueError: not enough values to unpack (expected 2, got 1)

what could be the problem here?
could you guys help me out in understanding this problem… thank you.

Hi @Ram124,

You seem to have a parameter file that’s not formatted in the way expected by the function. Could you share a link to the MobileNet-0.25 parameter file, so I can take a look. Or are you able to inspect the key to check that it is in “type:name” format, as expected by this function?

I have used the gluon mobilenet-0.25 param file.
I have not checked it…
I did not understand what it is exactly…
Gluon model does not support?

As with all models, MobileNet-0.25 contains a number of learnable parameters (the kernels, biases, weights, etc). Someone else has trained a MobileNet-0.25 model and saved the values of all their parameters after training, so you don’t have to train your own model. You then just create a MobileNet-0.25 network, and replace all of the parameters in your model with these pre-trained parameters: no training required!

BUT the parameters file must be in a specific format, and this is what I’d like to check. Where did you get this params file from? And Gluon does support this functionality.

I had done training using mobilenet-0.5 using gluon model.
I had used these commands to get the model.

import mxnet.gluon.nn as nn
import mxnet.gluon.model_zoo.vision.mobilenet as mn
mobileNet = vision.mobilenet0_5(pretrained=True, ctx=ctx)

After training i got the param file…

That param file i am trying to use it now…

But i am getting that error.

I have also meet the similar problem, hope this post will help you:

Load_checkpoint ValueError: not enough values to unpack

I have seen that post.
But i need to use this in RCNN example.
Do you know how to do it there?

I am using mobilenet-0.25 netowork.
I want the pretrained model for that network.
or Can i randomize the weights without using pretrained model?

since i have dataset with channel 1.

Thank You

During a multiple value assignment, the ValueError: not enough values to unpack occurs when either you have fewer objects to assign than variables, or you have more variables than objects. This error caused by the mismatch between the number of values returned and the number of variables in the assignment statement. This error happened mostly in the case of using python split function. Verify the assignment variables. If the number of assignment variables is greater than the total number of variables, delete the excess variable from the assignment operator. The number of objects returned, as well as the number of variables available are the same. This will resolve the value error.

The error message is fairly self-explanatory. Your program expects python split() to yield 2 elements, but in your case, it is only yielding 1 element. This could be because the data is not in the format you expect, a rogue malformed line, or maybe an empty line - there’s no way to know.

To see what line is causing the issue, you could add some debug statements like this:

if len(line.split()) != 2:
    print line