Hi there!
We are running Donkey 4 and found that sometimes our webcam would read in some empty data. They would be very few and far between, say about 4 faulty recordings per 8000 images. We found that when we ran the train script on our data folder, it would crash due to the empty images:
Records # Training 4335
Records # Validation 1084
Epoch 1/100
2021-11-04 20:30:23.748365: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10
cannot identify image file 'data/images/492_cam_image_array_.jpg'
failed to load image: data/images/492_cam_image_array_.jpg
2021-11-04 20:30:23.946395: W tensorflow/core/framework/op_kernel.cc:1741] Invalid argument: TypeError: %d format: a number is required, not str
Traceback (most recent call last):
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/tensorflow/python/ops/script_ops.py", line 243, in call
ret = func(*args)
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/tensorflow/python/autograph/impl/api.py", line 309, in wrapper
return func(*args, **kwargs)
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 785, in generator_py_func
values = next(generator_state.get_iterator(iterator_id))
File "/opt/local/donkeycar/donkeycar/pipeline/sequence.py", line 120, in next
return self.x_transform(record), self.y_transform(record)
File "/opt/local/donkeycar/donkeycar/pipeline/training.py", line 60, in get_x
record, self.image_processor)
File "/opt/local/donkeycar/donkeycar/parts/keras.py", line 241, in x_transform_and_process
x_process = img_processor(x_img)
File "/opt/local/donkeycar/donkeycar/pipeline/training.py", line 47, in image_processor
img_arr = self.transformation.run(img_arr)
File "/opt/local/donkeycar/donkeycar/pipeline/augmentations.py", line 120, in run
aug_img_arr = self.augmentations.augment_image(img_arr)
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/imgaug/augmenters/meta.py", line 766, in augment_image
type(image).name),)
TypeError: %d format: a number is required, not str
Traceback (most recent call last):
File "train.py", line 31, in
main()
File "train.py", line 27, in main
train(cfg, tubs, model, model_type, comment)
File "/opt/local/donkeycar/donkeycar/pipeline/training.py", line 145, in train
show_plot=cfg.SHOW_PLOT)
File "/opt/local/donkeycar/donkeycar/parts/keras.py", line 183, in train
use_multiprocessing=False)
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 66, in _method_wrapper
return method(self, *args, **kwargs)
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 848, in fit
tmp_logs = train_function(iterator)
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py", line 580, in call
result = self._call(*args, **kwds)
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py", line 644, in _call
return self._stateless_fn(*args, **kwds)
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 2420, in call
return graph_function._filtered_call(args, kwargs) # pylint: disable=protected-access
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 1665, in _filtered_call
self.captured_inputs)
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 1746, in _call_flat
ctx, args, cancellation_manager=cancellation_manager))
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 598, in call
ctx=ctx)
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/tensorflow/python/eager/execute.py", line 60, in quick_execute
inputs, attrs, num_outputs)
tensorflow.python.framework.errors_impl.InvalidArgumentError: TypeError: %d format: a number is required, not str
Traceback (most recent call last):
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/tensorflow/python/ops/script_ops.py", line 243, in call
ret = func(*args)
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/tensorflow/python/autograph/impl/api.py", line 309, in wrapper
return func(*args, **kwargs)
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 785, in generator_py_func
values = next(generator_state.get_iterator(iterator_id))
File "/opt/local/donkeycar/donkeycar/pipeline/sequence.py", line 120, in next
return self.x_transform(record), self.y_transform(record)
File "/opt/local/donkeycar/donkeycar/pipeline/training.py", line 60, in get_x
record, self.image_processor)
File "/opt/local/donkeycar/donkeycar/parts/keras.py", line 241, in x_transform_and_process
x_process = img_processor(x_img)
File "/opt/local/donkeycar/donkeycar/pipeline/training.py", line 47, in image_processor
img_arr = self.transformation.run(img_arr)
File "/opt/local/donkeycar/donkeycar/pipeline/augmentations.py", line 120, in run
aug_img_arr = self.augmentations.augment_image(img_arr)
File "/opt/conda/envs/donkey/lib/python3.7/site-packages/imgaug/augmenters/meta.py", line 766, in augment_image
type(image).name),)
TypeError: %d format: a number is required, not str
[[{{node PyFunc}}]]
[[IteratorGetNext]] [Op:__inference_train_function_1787]
Function call stack:
train_function
Our temporary workaround was to run an "ls -l" over the "images" folder and find the faulty recordings, to which we would then delete the problematic catalogues that pointed to those faulty images from the manifest.json file.