-
Notifications
You must be signed in to change notification settings - Fork 58
Description
Would it be possible to also include an example of how to create the TFRecord with multiple labels? I've been working on this, but am stuck--not sure if I'm not interpreting the example incorrectly or what the issue is.
In def convert_to, I've changed 'label': _int64_feature(int(labels[index])) to 'label': labels[index,:], where labels is an array of n by 5--n examples with 5 different labels representing 5 different attributes of a possible image. To create the labels array, I use:
labels[i,:] = [_int64_feature(int(l1)), _int64_feature(int(l2)), _int64_feature(int(l3)), _int64_feature(int(l4)), _int64_feature(int(l5))]
where I loop through each line of my text file, parse it for the 5 specific numbers I need (read in as strings), cast them as ints, and then pass them to the _int64_feature function.
However, I get errors with only _int64_feature(int(l5)), where it says that TypeError: float() argument must be a string or a number. When I wasn't getting that error, using the convert_to function led to this error: TypeError: Parameter to MergeFrom() must be instance of same class: expected Feature got ndarray.
Apologies if this isn't the correct place to ask this question, I just figured that it'd be helpful for anyone else who's working on a similar thing to be able to refer to this issue to resolve their errors as well.