ValueError: boxlists should have nonzero length using MobileNetV2 SSD FPN-Lite 320x320

Hello, I am performing an image classifier of three features with each feature clearly labeled within the specified bounding box using MobileNetV2 SSD FPN-Lite 320x320 and getting an error in the “Object Detection” tab. Potentially, this is the same error that is from tensorflow https://github.com/tensorflow/models/blob/master/research/object_detection/core/box_list_ops.py

Creating job... OK (ID: 2205638)

Job started
Splitting data into training and validation sets...
Splitting data into training and validation sets OK

Training model...
Training on 174 inputs, validating on 44 inputs
Building model and restoring weights for fine-tuning...
Traceback (most recent call last):
  File "/home/train.py", line 333, in <module>
    main_function()
  File "/home/train.py", line 157, in main_function
    model, override_mode, disable_per_channel_quantization = train_model(train_dataset, validation_dataset,
  File "/home/train.py", line 72, in train_model
    ei_tensorflow.object_detection.train(classes, 0.01, 100,
  File "/app/./resources/libraries/ei_tensorflow/object_detection.py", line 73, in train
    _ = detection_model.postprocess(prediction_dict, shapes)
  File "/app/keras/.venv/lib/python3.8/site-packages/object_detection/meta_architectures/ssd_meta_arch.py", line 764, in postprocess
    num_detections) = self._non_max_suppression_fn(
  File "/app/keras/.venv/lib/python3.8/site-packages/object_detection/core/post_processing.py", line 1244, in batch_multiclass_non_max_suppression
    batch_outputs = map_fn(
  File "/app/keras/.venv/lib/python3.8/site-packages/object_detection/utils/shape_utils.py", line 239, in static_or_dynamic_map_fn
    outputs = [fn(arg_tuple) for arg_tuple in arg_tuples]
  File "/app/keras/.venv/lib/python3.8/site-packages/object_detection/utils/shape_utils.py", line 239, in <listcomp>
    outputs = [fn(arg_tuple) for arg_tuple in arg_tuples]
  File "/app/keras/.venv/lib/python3.8/site-packages/object_detection/core/post_processing.py", line 1200, in _single_image_nms_fn
    nmsed_boxlist, num_valid_nms_boxes = multiclass_non_max_suppression(
  File "/app/keras/.venv/lib/python3.8/site-packages/object_detection/core/post_processing.py", line 630, in multiclass_non_max_suppression
    selected_boxes = box_list_ops.concatenate(selected_boxes_list)
  File "/app/keras/.venv/lib/python3.8/site-packages/object_detection/core/box_list_ops.py", line 634, in concatenate
    raise ValueError('boxlists should have nonzero length')
ValueError: boxlists should have nonzero length

Application exited with code 1 (Error)

Job failed (see above)
```

The generate features was really slow for around 200 images hence why the object detection step wasn’t working. Finally got it to work.

Hi @regarder7777,

Glad to hear you got it working. Was the problem that the feature extraction step had not completed before starting training?

Yes, I didn’t give the feature extraction step sufficient time before training the model. You can delete this question if you want. Thanks.

1 Like