1

I am working with EfficentDet and Tensorflow object detection API and have some problems with changing the config file.

It works fine for this:

config_dic = config_util.get_configs_from_pipeline_file(fpath)

config_dic["model"].ssd.num_classes = len(LabelMap)
config_dic["model"].ssd.image_resizer.keep_aspect_ratio_resizer.min_dimension = 512

config_dic["train_config"].batch_size = 1
config_dic["train_config"].fine_tune_checkpoint = os.path.join(path, model_name, "checkpoint/ckpt-0")
config_dic["train_config"].fine_tune_checkpoint_type = "detection"
config_dic["train_config"].use_bfloat16 = False # Set to True if training on a TPU
config_dic["train_config"].num_steps = 10000

config_dic["train_input_config"].label_map_path = path_label
config_dic["train_input_config"].tf_record_input_reader.input_path[:] = train_data

config_dic["eval_input_configs"][0].label_map_path = path_label
config_dic["eval_input_configs"][0].tf_record_input_reader.input_path[:] = valid_data

config_dic["model"].ssd.image_resizer.keep_aspect_ratio_resizer.pad_to_max_dimension = False
config_dic["model"].ssd.image_resizer.keep_aspect_ratio_resizer.max_dimension = 1024

But running this give me an error:

config_dic["train_config"].data_augmentation_options.random_horizontal_flip = False
config_dic["train_config"].data_augmentation_options.random_adjust_brightness = 0.4
config_dic["train_config"].data_augmentation_options.random_adjust_contrast = [0.6, 1.5]
config_dic["train_config"].data_augmentation_options.random_jitter_boxes = 0.1
config_dic["train_config"].data_augmentation_options.random_rotation90 = 0.5
'google.protobuf.pyext._message.RepeatedCompositeContainer' object has no attribute 'random_horizontal_flip'

and similar errors for the others too.

(I have tried with integers instead of False and get the same error message)

which is weird since i have this in the config file:

train_config {
  batch_size: 1
  data_augmentation_options {
    random_horizontal_flip {
    }
  }

Anyone know how to solve this?

edit (added some requested information):

I am using tensorflow 2.4.1 and protobuf 3.12.2

The only code that comes after the changes of the config file are:

# Save changes
config = config_util.create_pipeline_proto_from_configs(config_dic)
config_util.save_pipeline_config(config, dst)

# Train
!python workspace/model_main_tf2.py --model_dir=$dst --pipeline_config_path=$fpath
JKnecht
  • 231
  • 2
  • 16

1 Answers1

0

according to https://github.com/tensorflow/models/blob/master/research/object_detection/protos/preprocessor.proto random_horizontal_flip should take an integer, not a boolean.

Please also see What are possible values for data_augmentation_options in the TensorFlow Object Detection pipeline configuration?.

Semmel
  • 575
  • 2
  • 8
  • I have tried an integer but that does not work either, it seems like instead it doesnt recognize random_horizontal_flip or any of the other things i tried. – JKnecht Feb 06 '21 at 11:19
  • @JKnecht Mhh too bad. Can you tell us which protobuf version and which tensorflow version you are using? – Semmel Feb 06 '21 at 12:46
  • and please also share the code that uses the config. Maby there is a hint there ... – Semmel Feb 06 '21 at 12:51