Skip to content

Add empty box parser inside utilities.format_geometry #1101

@bw4sz

Description

@bw4sz

When an image has no predictions, it would be nice if utilities.format_geometry natively processed this into the output. Right now we have to do something like

result = utilities.format_geometry(pred, geom_type=geom_type)

predictions = m.predict_step(images, batch_index)
for pred in predictions:
    geometry = determine_geometry(pred)
    if len(pred[geometry]) == 0:
            y_pred = {}
            y_pred["y"] = torch.zeros(4)
            y_pred["labels"] = torch.zeros(1)
            y_pred["scores"] = torch.zeros(1)
    else:
            format_geometry(pred, geom_type=geometry)

Desired functionality

  1. a new single function 'format_prediction' that looks at a prediction dictionary, uses determine_geometry, format_geometry, and fills in the edge case of empty images.
  2. Minimal tests that shows this behavior for points and boxes, @jveitchmichaelis we don't have polygon prediction yet, right?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions