I'm using Python 3.9, Tensorflow 2.6.0, Ubuntu 20.04, and following this tutorial. The tf.record files have just been generated, and I'm trying to get my training to start. the .config files were downloaded from the Tensorflow 2 Detection Model Zoo (https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.md).

While trying to kick off training for my Tensorflow model with the following code...:

python model_main_tf2.py --model_dir=path_to_model_dir/my_ssd_resnet50_v1_fpn --pipeline_config_path=path_to_model_dir/my_ssd_resnet50_v1_fpn/pipeline.config

...I received this error:

tensorflow.python.framework.errors_impl.InvalidArgumentError: assertion failed: [[0.0792563558][0.286692768][0.342465758]] [[0.000978473574][0.365949124][0.695694685]]

This Stack Overflow post (https://stackoverflow.com/questions/62075321/tensorflow-python-framework-errors-impl-invalidargumenterror-invalid-argument) outlines the error nicely, but I'm still needing assistance in solving it. I have checked, and there are no invalid entries (min/max values outside of the photo's dimensions, and no negative values). The most likely culprit is that several of the bounding boxes were drawn in a reverse order so that some of the min bounding box dimensions are larger than the max dimensions, as discussed by the post. I need to correct the bounding box dimensions before generating the tf.record files (for both my training and testing datasets).

I have labeled my images with Labelimg in Pascal VOC format, so each of my images have an XML file with them (I have roughly 10,900 of them). Is there a way to convert my xml files to a CSV document and THEN generate the tf.record files?

Once the CSV files are generated, I can correct the ordering of my min and max columns with the following code. I'm hoping to use these corrected csv files to generate the tf.record files.

#Designed to correctly modify min/max columns in the CSV files generated when producing tf.record files #Designed to run each line from the command line

import pandas import numpy as np import os import csv #Open CV file df = pandas.read_csv("C:\\desired_directory\\train.csv") df = df.assign( xmin=df[['xmin', 'xmax']].min(1), xmax=df[['xmin', 'xmax']].max(1), ymin=df[['ymin', 'ymax']].min(1), ymax=df[['ymin', 'ymax']].max(1), )

df.to_csv("C:\\desired_directory_to_save_csv_file\\train.csv")

More Isaac Barnhart's questions See All
Similar questions and discussions