How to create multi labels .lst file?


#1

hi,
I have a question on how to create .lst files with multi labels jpg. I have been spending a lot of time on this issue; however, as a newbie, I still can’t understand what’s the proper way to do it.

I have the jpg files under a folder. With their name as id_1_labels_[95, 66, 137, 70, 20].jpg. inside [ ] are the labels; each image has 5 to 20 labels

in the mxnet webpage it says :
integer_image_index \t label_1 \t label_2 \t label_3 \t label_4 \t path_to_image
but i am not smart enough to know how to impliment it. and the jpg i have has unequal amount of labels for each one.
i did find some code online that generate .lst file as:

 withh open('dataset.lst', 'w+') as f:
    for i in range(12):
        f.write(
            str(i) + '\t' +
            # idx
            str(4) + '\t' + str(5) + '\t' +
            # width of header and width of each object.
            str(256) + '\t' + str(256) + '\t' +
            # (width, height)
            str(1) + '\t' +
            # class
            str((i / 15)) + '\t' + str((i / 15)) + '\t' + str(((i + 3) / 15)) + '\t' +str(((i + 3) / 15)) + '\t' +

            str(2) + '\t' +
            # class
            str((i / 50)) + '\t' + str((i / 50)) + '\t' + str(((i + 3) / 50)) + '\t' + str(((i + 3) / 50)) + '\t' +

            str(3) + '\t' +
            # class
            str((i / 100)) + '\t' + str((i / 100)) + '\t' + str(((i + 3) / 100)) + '\t' + str(((i + 3) / 100)) + '\t' +
            # xmin, ymin, xmax, ymax
           str(i) + '.jpg\n'
        )

i am not sure how to run this .py script correctly so i run it as python lstgen.py /train
but still, the dataset.lst doesn’t look correct.

I also tried python im2rec.py --list test /train
but still the .lst file doesn’t look correct.

really appreciate for any help or guide, thank you.