Trying some alternatives.
Modified one row of my csv-dataset to have an empty class label and set all bounding box vertices columns to string to allow passing an empty string.
# TODO: Remove this since it's only here to mockup a row where trying to insert a null-class example
# This might fail since documentation suggest this is not possible
mycsv['xmin'] = mycsv['xmin'].astype(str)
mycsv['ymin'] = mycsv['ymin'].astype(str)
mycsv['xmax'] = mycsv['xmax'].astype(str)
mycsv['ymax'] = mycsv['ymax'].astype(str)
mycsv.at[0,'class'] = ''
mycsv.at[0,'xmin'] = ''
mycsv.at[0,'ymin'] = ''
mycsv.at[0,'xmax'] = ''
mycsv.at[0,'ymax'] = ''
Fails during load:
/usr/local/lib/python3.7/dist-packages/tensorflow_examples/lite/model_maker/core/data_util/object_detector_dataloader_util.py in _get_xml_dict_from_csv_lines(images_dir, image_filename, lines)
335 for line in lines:
336 label = line[2].strip()
--> 337 xmin, ymin = float(line[3]) * width, float(line[4]) * height
338 xmax, ymax = float(line[7]) * width, float(line[8]) * height
339 obj = {
ValueError: could not convert string to float:
Leaving bbox columns as float and inserting None yeilds the same result
mycsv.at[0,'class'] = ''
mycsv.at[0,'xmin'] = None
mycsv.at[0,'ymin'] = None
mycsv.at[0,'xmax'] = None
mycsv.at[0,'ymax'] = None
Columns xmin, xmax, ymin and ymax becomes strings:
split |
filename |
class |
xmin |
ymin |
empty1 |
empty2 |
xmax |
ymax |
empty3 |
empty4 |
TEST |
file1.jpg |
|
|
|
|
|
|
|
|
|
TEST |
file2.jpg |
red |
0.27 |
0.0 |
|
|
1.0 |
1.0 |
|
|
TEST |
file3.jpg |
blue |
0.37 |
0.7866666666666666 |
|
|
1.0 |
1.0 |
|
|
TEST |
file4.jpg |
blue |
0.426 |
0.18 |
|
|
0.67 |
0.59 |
|
|
Fails during load again:
/usr/local/lib/python3.7/dist-packages/tensorflow_examples/lite/model_maker/core/data_util/object_detector_dataloader_util.py in _get_xml_dict_from_csv_lines(images_dir, image_filename, lines)
335 for line in lines:
336 label = line[2].strip()
--> 337 xmin, ymin = float(line[3]) * width, float(line[4]) * height
338 xmax, ymax = float(line[7]) * width, float(line[8]) * height
339 obj = {
ValueError: could not convert string to float: