I have 1500 png images and associated .txt files for each image that hold the multi-label values (1-7 values) for what is identified in each photo. The problem is that the labels are out of order with each image and one file could have 1 value and another all 7 values, in any arrangement. I don't know how to pull the information out, order it, and then one-hot-encode it accordingly. I need help please. I get the following error using le.fit() because of it:
ValueError: y contains previously unseen labels: ['label2\nlabel7\nlabel1', 'label2\nlabel1', 'label2\nlabel1\nlabel6',....
What I think needs to happen is:
- I create a dictionary (Dict={1:'label1',2:'label2',3:'label3'})
- I look in the folder that has the .txt files
- I match up what is in the files with the dictionary values and put the number into a list. So I will have a list of 1500 lists.
- Somehow I need to order those lists and put zeros in the missing number spots
That would give me the target values of each image one-hot-encoded.
Thanks in advance