Fixed per-class grouping of predictions

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
2019-09-13 13:48:58 +02:00
parent 75f4e4cb1e
commit 6a990b204a

View File

@ -92,13 +92,22 @@ def prepare_predictions(predictions: Sequence[Sequence[Sequence[Union[int, float
xmax += 1 xmax += 1
ymax += 1 ymax += 1
class_id = int(box[0]) if len(box) > nr_classes:
# Round the box coordinates to reduce the required memory. class_id = np.argmax(box[:-5])
confidence = box[1] confidence = np.amax(box[:-5])
xmin = round(box[2]) xmin = -5
ymin = round(box[3]) ymin = -4
xmax = round(box[4]) xmax = -3
ymax = round(box[5]) ymax = -2
else:
class_id = int(box[0])
# Round the box coordinates to reduce the required memory.
confidence = box[1]
xmin = round(box[xmin])
ymin = round(box[ymin])
xmax = round(box[xmax])
ymax = round(box[ymax])
prediction = (image_id, confidence, xmin, ymin, xmax, ymax) prediction = (image_id, confidence, xmin, ymin, xmax, ymax)
# Append the predicted box to the results list for its class. # Append the predicted box to the results list for its class.
results[class_id].append(prediction) results[class_id].append(prediction)